Spaces:
Paused
Paused
:boom: [Fix] Chat API: Coroutine issue
Browse files- 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 |
-
|
| 101 |
-
|
| 102 |
-
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(
|