Update app.py
Browse files
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import requests
|
|
| 4 |
import json
|
| 5 |
|
| 6 |
def create_deepseek_interface():
|
| 7 |
-
# ์ฑํ
๊ธฐ๋ก ์ด๊ธฐํ
|
| 8 |
chat_history = []
|
| 9 |
|
| 10 |
# DeepSeek API ํธ์ถ ํจ์
|
|
@@ -15,8 +15,7 @@ def create_deepseek_interface():
|
|
| 15 |
# API ์์ฒญ์ ์ํ ๋ํ ๊ธฐ๋ก ์ค๋น
|
| 16 |
messages = []
|
| 17 |
for h in history:
|
| 18 |
-
messages.append(
|
| 19 |
-
messages.append({"role": "assistant", "content": h[1]})
|
| 20 |
|
| 21 |
# ์ ์ฌ์ฉ์ ๋ฉ์์ง ์ถ๊ฐ
|
| 22 |
messages.append({"role": "user", "content": message})
|
|
@@ -48,9 +47,10 @@ def create_deepseek_interface():
|
|
| 48 |
result = response.json()
|
| 49 |
assistant_response = result.get("choices", [{}])[0].get("message", {}).get("content", "")
|
| 50 |
|
| 51 |
-
# ๋ํ ๊ธฐ๋ก ์
๋ฐ์ดํธ
|
| 52 |
new_history = history.copy()
|
| 53 |
-
new_history.append(
|
|
|
|
| 54 |
return new_history, ""
|
| 55 |
except requests.exceptions.RequestException as e:
|
| 56 |
error_msg = f"API ์ค๋ฅ: {str(e)}"
|
|
|
|
| 4 |
import json
|
| 5 |
|
| 6 |
def create_deepseek_interface():
|
| 7 |
+
# ์ฑํ
๊ธฐ๋ก ์ด๊ธฐํ (๋ฉ์์ง ํ์)
|
| 8 |
chat_history = []
|
| 9 |
|
| 10 |
# DeepSeek API ํธ์ถ ํจ์
|
|
|
|
| 15 |
# API ์์ฒญ์ ์ํ ๋ํ ๊ธฐ๋ก ์ค๋น
|
| 16 |
messages = []
|
| 17 |
for h in history:
|
| 18 |
+
messages.append(h)
|
|
|
|
| 19 |
|
| 20 |
# ์ ์ฌ์ฉ์ ๋ฉ์์ง ์ถ๊ฐ
|
| 21 |
messages.append({"role": "user", "content": message})
|
|
|
|
| 47 |
result = response.json()
|
| 48 |
assistant_response = result.get("choices", [{}])[0].get("message", {}).get("content", "")
|
| 49 |
|
| 50 |
+
# ๋ํ ๊ธฐ๋ก ์
๋ฐ์ดํธ (๋ฉ์์ง ํ์์ผ๋ก)
|
| 51 |
new_history = history.copy()
|
| 52 |
+
new_history.append({"role": "user", "content": message})
|
| 53 |
+
new_history.append({"role": "assistant", "content": assistant_response})
|
| 54 |
return new_history, ""
|
| 55 |
except requests.exceptions.RequestException as e:
|
| 56 |
error_msg = f"API ์ค๋ฅ: {str(e)}"
|