rename bot app class
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
[project]
|
||||
name = "quickbot-agent"
|
||||
name = "quickbot_agent"
|
||||
version = "0.1.0"
|
||||
description = "Add your description here"
|
||||
readme = "README.md"
|
||||
|
||||
@@ -8,7 +8,7 @@ from openai.types.chat import ChatCompletionMessage
|
||||
from pydantic import BaseModel
|
||||
from quickbot.model.user import UserBase
|
||||
from sqlmodel.ext.asyncio.session import AsyncSession
|
||||
from quickbot import QBotApp, BotContext
|
||||
from quickbot import QuickBot, BotContext
|
||||
from quickbot.model.crud_service import ForbiddenError, NotFoundError
|
||||
from quickbot.model.crud_command import CrudCommand
|
||||
from ..utils import get_message_log, add_message_log, generate_gpt_tools_schemas
|
||||
@@ -165,11 +165,17 @@ async def handle_openai_cycle(
|
||||
try:
|
||||
if iscoroutinefunction(process_descriptor.process_class.run):
|
||||
result = await process_descriptor.process_class.run(
|
||||
context, parameters=process_descriptor.input_schema(**function_args)
|
||||
context,
|
||||
parameters=process_descriptor.input_schema(
|
||||
**function_args
|
||||
),
|
||||
)
|
||||
else:
|
||||
result = process_descriptor.process_class.run(
|
||||
context, parameters=process_descriptor.input_schema(**function_args)
|
||||
context,
|
||||
parameters=process_descriptor.input_schema(
|
||||
**function_args
|
||||
),
|
||||
)
|
||||
except Exception as e:
|
||||
result = {"error": f"Error: {e}"}
|
||||
@@ -209,7 +215,7 @@ async def handle_message(
|
||||
message: Message,
|
||||
db_session: AsyncSession,
|
||||
user: UserBase,
|
||||
app: QBotApp,
|
||||
app: QuickBot,
|
||||
app_state: State,
|
||||
) -> None:
|
||||
plugin: "AgentPlugin" = app.plugins["AgentPlugin"]
|
||||
@@ -249,7 +255,7 @@ async def handle_business_message(
|
||||
message: Message,
|
||||
db_session: AsyncSession,
|
||||
user: UserBase,
|
||||
app: QBotApp,
|
||||
app: QuickBot,
|
||||
app_state: State,
|
||||
) -> None:
|
||||
plugin: "AgentPlugin" = app.plugins["AgentPlugin"]
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
from aiogram.utils.i18n.lazy_proxy import LazyProxy
|
||||
from quickbot import QBotApp, BotEntity, BotProcess
|
||||
from quickbot import QuickBot, BotEntity, BotProcess
|
||||
from quickbot.model.crud_command import CrudCommand
|
||||
from quickbot.model.descriptors import BotContext
|
||||
from typing import Callable
|
||||
@@ -26,7 +26,7 @@ class AgentPlugin:
|
||||
self.tools_context = tools_context
|
||||
self._gpt_tools_metadata = []
|
||||
|
||||
def register(self, app: QBotApp) -> None:
|
||||
def register(self, app: QuickBot) -> None:
|
||||
if not callable(self.tools_context):
|
||||
self._gpt_tools_metadata = generate_gpt_tools_schemas(
|
||||
app.bot_metadata, self.tools_context
|
||||
|
||||
@@ -303,7 +303,9 @@ def generate_gpt_tools_schemas(
|
||||
entity, commands = tool_item
|
||||
if commands:
|
||||
gpt_tools_schemas.extend(
|
||||
generate_crud_tool_schemas(entity.bot_entity_descriptor, commands=commands)
|
||||
generate_crud_tool_schemas(
|
||||
entity.bot_entity_descriptor, commands=commands
|
||||
)
|
||||
)
|
||||
else:
|
||||
gpt_tools_schemas.extend(
|
||||
|
||||
Reference in New Issue
Block a user