Skip to content

Commit

Permalink
improve logic
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-XT committed Dec 23, 2024
1 parent c54f25d commit 72d73ae
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions agixt/endpoints/Completions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,17 +34,19 @@ async def chat_completion(
# prompt.model is the agent name
# prompt.user is the conversation name
# Check if conversation name is a uuid, if so, it is the conversation_id and nedds convertd
try:
conversation_id = str(uuid.UUID(prompt.user))
except:
conversation_id = None
if conversation_id:
prompt.user = get_conversation_name_by_id(conversation_id)
conversation_name = prompt.user
if conversation_name != "-":
try:
conversation_id = str(uuid.UUID(conversation_name))
except:
conversation_id = None
if conversation_id:
conversation_name = get_conversation_name_by_id(conversation_id)
agixt = AGiXT(
user=user,
agent_name=prompt.model,
api_key=authorization,
conversation_name=prompt.user,
conversation_name=conversation_name,
)
return await agixt.chat_completions(prompt=prompt)

Expand Down

0 comments on commit 72d73ae

Please sign in to comment.