Hansimov commited on
Commit
c5c1677
1 Parent(s): 3425246

:boom: [Fix] Chat API: Coroutine issue

Browse files
Files changed (1) hide show
  1. apis/chat_api.py +4 -5
apis/chat_api.py CHANGED
@@ -97,12 +97,11 @@ class ChatAPIApp:
97
  conversation_id=item.conversation_id,
98
  invocation_id=item.invocation_id,
99
  )
100
- session = ConversationSession(
101
- conversation_style=item.model,
102
- connector=connector,
 
103
  )
104
- with session:
105
- session.chat(prompt=item.prompt)
106
 
107
  class ChatCompletionsPostItem(BaseModel):
108
  model: str = Field(
 
97
  conversation_id=item.conversation_id,
98
  invocation_id=item.invocation_id,
99
  )
100
+
101
+ return EventSourceResponse(
102
+ connector.stream_chat(prompt=item.prompt, yield_output=True),
103
+ media_type="text/event-stream",
104
  )
 
 
105
 
106
  class ChatCompletionsPostItem(BaseModel):
107
  model: str = Field(