Skip to content

Commit

Permalink
small cleanup in chat. fix mode read in doc agent
Browse files Browse the repository at this point in the history
  • Loading branch information
momuno committed Nov 14, 2024
1 parent c5657f4 commit f53a6f7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ async def create_document(
return mode.is_running()

# Run
mode = self._state.mode
logger.info("Document Agent in mode %s", mode.get_name())
mode_method = self._get_mode_method(mode)
if mode_method:
Expand Down
18 changes: 7 additions & 11 deletions assistants/prospector-assistant/assistant/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,6 @@ async def on_message_created(
await legacy.provide_guidance_if_necessary(context)


@assistant.events.conversation.message.command.on_created
async def on_command_message_created(
context: ConversationContext, event: ConversationEvent, message: ConversationMessage
) -> None:
pass


@assistant.events.conversation.message.chat.on_created
async def on_chat_message_created(
context: ConversationContext, event: ConversationEvent, message: ConversationMessage
Expand All @@ -146,10 +139,13 @@ async def on_chat_message_created(
config = await assistant_config.get(context.assistant)
metadata: dict[str, Any] = {"debug": {"content_safety": event.data.get(content_safety.metadata_key, {})}}

if config.guided_workflow == "Form Completion":
await form_fill_execute(context, message)
else: # "Document Creation"
await create_document_execute(config, context, message, metadata)
match config.guided_workflow:
case "Form Completion":
await form_fill_execute(context, message)
case "Document Creation":
await create_document_execute(config, context, message, metadata)
case _:
logger.error("Guided workflow unknown or not supported.")


background_tasks: set[asyncio.Task] = set()
Expand Down

0 comments on commit f53a6f7

Please sign in to comment.