Update main.py
Browse files
main.py
CHANGED
|
@@ -77,7 +77,11 @@ class ZaiClient:
|
|
| 77 |
|
| 78 |
# ββ chat CRUD βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 79 |
|
| 80 |
-
async def create_chat(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 81 |
"""POST /api/v1/chats/new β creates a new chat session."""
|
| 82 |
msg_id = str(uuid.uuid4())
|
| 83 |
ts = int(time.time())
|
|
@@ -353,6 +357,7 @@ async def main() -> None:
|
|
| 353 |
# 3. Create chat
|
| 354 |
user_message = "Hello"
|
| 355 |
print(f"\n[3] Creating chat with first message: {user_message!r}")
|
|
|
|
| 356 |
chat = await client.create_chat(user_message)
|
| 357 |
chat_id = chat["id"]
|
| 358 |
print(f" chat_id : {chat_id}")
|
|
|
|
| 77 |
|
| 78 |
# ββ chat CRUD βββββββββββββββββββββββββββββββββββββββββββββββββββ
|
| 79 |
|
| 80 |
+
async def create_chat(
|
| 81 |
+
self,
|
| 82 |
+
user_message: str,
|
| 83 |
+
model: str = DEFAULT_MODEL,
|
| 84 |
+
) -> dict:
|
| 85 |
"""POST /api/v1/chats/new β creates a new chat session."""
|
| 86 |
msg_id = str(uuid.uuid4())
|
| 87 |
ts = int(time.time())
|
|
|
|
| 357 |
# 3. Create chat
|
| 358 |
user_message = "Hello"
|
| 359 |
print(f"\n[3] Creating chat with first message: {user_message!r}")
|
| 360 |
+
messages = [{"role": "user", "content": user_message}]
|
| 361 |
chat = await client.create_chat(user_message)
|
| 362 |
chat_id = chat["id"]
|
| 363 |
print(f" chat_id : {chat_id}")
|