Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove Extraneous Awaits #157

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions api/routers/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ async def convo_turn():
yield f"Error: {str(e)}"
return

await create_messages_and_metamessages(
create_messages_and_metamessages(
app.id, user.id, inp.conversation_id, inp.message, thought, response
)

Expand All @@ -74,26 +74,26 @@ async def convo_turn():
)


async def create_messages_and_metamessages(
def create_messages_and_metamessages(
app_id, user_id, conversation_id, user_message, thought, ai_response
):
try:
# These operations will use the DB layer's built-in retry logic
await honcho.apps.users.sessions.messages.create(
honcho.apps.users.sessions.messages.create(
is_user=True,
session_id=str(conversation_id),
app_id=app_id,
user_id=user_id,
content=user_message,
)
new_ai_message = await honcho.apps.users.sessions.messages.create(
new_ai_message = honcho.apps.users.sessions.messages.create(
is_user=False,
session_id=str(conversation_id),
app_id=app_id,
user_id=user_id,
content=ai_response,
)
await honcho.apps.users.sessions.metamessages.create(
honcho.apps.users.sessions.metamessages.create(
app_id=app_id,
session_id=str(conversation_id),
user_id=user_id,
Expand Down
Loading