openfree commited on
Commit
f438be7
ยท
verified ยท
1 Parent(s): 3db5c7b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
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({"role": "user", "content": h[0]})
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((message, assistant_response))
 
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)}"