Refactored gemini, openai and claude into one file and removed logic from the base class, also made helper class definable from command line
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
class InferenceBot(ABC):
|
||||
@abstractmethod
|
||||
async def start(self):
|
||||
"""Starts the bot."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def clear_conversation_history(self, user_id):
|
||||
"""Clears the conversation history for a given user."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def switch_model(self):
|
||||
"""Switches the model (if applicable)."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def set_processing_status(self, user_id, message_id):
|
||||
"""Sets the processing status for a user, typically with a message ID."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def handle_message(self, user_id, user_message):
|
||||
"""Handles an incoming message from a user."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def clear_processing_status(self, user_id):
|
||||
"""Clears the processing status for a user."""
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
async def abort_processing(self, user_id):
|
||||
"""Aborts any ongoing processing for a user."""
|
||||
pass
|
||||
|
||||
@property
|
||||
@abstractmethod
|
||||
def processing_status(self):
|
||||
"""
|
||||
An attribute (e.g., a dictionary) to store the processing status for users.
|
||||
Example usage in subclass: self.processing_status.get(user_id)
|
||||
"""
|
||||
pass
|
||||
Reference in New Issue
Block a user