merge conflicts resolved
This commit is contained in:
@@ -53,17 +53,10 @@ functions = []
|
||||
for tool in tools:
|
||||
functions.extend(tool.get_functions())
|
||||
|
||||
def get_keyboard():
|
||||
keyboard = [
|
||||
['/status', '/reset']
|
||||
]
|
||||
return ReplyKeyboardMarkup(keyboard, resize_keyboard=True)
|
||||
|
||||
async def start(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
logging.info("Bot started")
|
||||
await update.message.reply_text(
|
||||
"Hello! I'm your AI assistant. How can I help you today? You can send me images and then ask questions about them.",
|
||||
reply_markup=get_keyboard()
|
||||
"Hello! I'm your AI assistant. How can I help you today? You can send me images and then ask questions about them."
|
||||
)
|
||||
|
||||
async def clear(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
@@ -74,7 +67,7 @@ async def clear(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
tool.clear()
|
||||
|
||||
logging.info(f"Cleared conversation history and image for user {user_id}")
|
||||
await update.message.reply_text("Conversation history and image cleared. Let's start fresh!", reply_markup=get_keyboard())
|
||||
await update.message.reply_text("Conversation history and image cleared. Let's start fresh!")
|
||||
|
||||
async def update_status_message(context: ContextTypes.DEFAULT_TYPE, chat_id: int, message_id: int, status: str):
|
||||
keyboard = [
|
||||
@@ -162,7 +155,7 @@ async def handle_message(update: Update, context: ContextTypes.DEFAULT_TYPE) ->
|
||||
|
||||
except Exception as e:
|
||||
logging.error(f"An error occurred: {str(e)}")
|
||||
await update.message.reply_text("Sorry, an error occurred while processing your request.", reply_markup=get_keyboard())
|
||||
await update.message.reply_text("Sorry, an error occurred while processing your request.")
|
||||
|
||||
def call_tool(function_call):
|
||||
function_name = function_call.name
|
||||
@@ -198,7 +191,7 @@ def get_claude_response(messages):
|
||||
return response
|
||||
|
||||
async def status(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
await update.message.reply_text("Currently using claude-3-5-sonnet-20240620", reply_markup=get_keyboard())
|
||||
await update.message.reply_text("Currently using claude-3-5-sonnet-20240620")
|
||||
|
||||
async def abort_processing(update: Update, context: ContextTypes.DEFAULT_TYPE) -> None:
|
||||
query = update.callback_query
|
||||
@@ -223,8 +216,6 @@ def main() -> None:
|
||||
# Add handlers
|
||||
application.add_handler(CommandHandler("start", start))
|
||||
application.add_handler(CommandHandler("clear", clear))
|
||||
application.add_handler(CommandHandler("switch", switch))
|
||||
application.add_handler(CommandHandler("toggle", switch_providers))
|
||||
application.add_handler(CommandHandler("status", status))
|
||||
application.add_handler(MessageHandler(filters.TEXT & ~filters.COMMAND, handle_message))
|
||||
application.add_handler(CallbackQueryHandler(abort_processing, pattern='^abort$'))
|
||||
|
||||
Reference in New Issue
Block a user