Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -26,6 +26,18 @@ def respond(
|
|
26 |
top_p,
|
27 |
system_message,
|
28 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
29 |
try:
|
30 |
stream = client.chat_completion(
|
31 |
messages,
|
|
|
26 |
top_p,
|
27 |
system_message,
|
28 |
):
|
29 |
+
try:
|
30 |
+
client = get_client(model_name) # 여기서 client를 정의합니다.
|
31 |
+
except ValueError as e:
|
32 |
+
chat_history.append((message, str(e)))
|
33 |
+
return chat_history
|
34 |
+
|
35 |
+
messages = [{"role": "system", "content": system_message}]
|
36 |
+
for human, assistant in chat_history:
|
37 |
+
messages.append({"role": "user", "content": human})
|
38 |
+
messages.append({"role": "assistant", "content": assistant})
|
39 |
+
messages.append({"role": "user", "content": message})
|
40 |
+
|
41 |
try:
|
42 |
stream = client.chat_completion(
|
43 |
messages,
|