seawolf2357 commited on
Commit
b294e03
Β·
verified Β·
1 Parent(s): 86074a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -7
app.py CHANGED
@@ -88,20 +88,20 @@ async def generate_response(message):
88
  # μœ μ‚¬ν•œ 데이터 μ°ΎκΈ°
89
  most_similar_data = find_most_similar_data(user_input)
90
 
 
 
 
91
  system_message = f"""
92
  당신은 'kAI'λΌλŠ” μ΄λ¦„μ˜ ν•œκ΅­ λ³΄ν—˜ μƒν’ˆμ— λŒ€ν•œ AI μ‘°μ–Έμžμž…λ‹ˆλ‹€.
93
  λ°˜λ“œμ‹œ 제곡된 λ°μ΄ν„°μ…‹μ˜ μ •λ³΄λ§Œμ„ μ‚¬μš©ν•˜μ—¬ λ‹΅λ³€ν•΄μ•Ό ν•©λ‹ˆλ‹€.
94
- 제곡된 데이터에 μ—†λŠ” 정보에 λŒ€ν•΄μ„œλŠ” "μ£„μ†‘ν•©λ‹ˆλ‹€. ν•΄λ‹Ή μ •λ³΄λŠ” μ œκ°€ κ°€μ§„ 데이터에 μ—†μŠ΅λ‹ˆλ‹€."라고 λ‹΅λ³€ν•˜μ‹­μ‹œμ˜€.
95
  λͺ¨λ“  닡변은 ν•œκΈ€λ‘œ ν•˜κ³ , markdown ν˜•μ‹μœΌλ‘œ 좜λ ₯ν•˜μ„Έμš”.
 
 
96
  """
97
 
98
  conversation_history.append({"role": "user", "content": user_input})
99
- messages = [{"role": "system", "content": system_message}] + conversation_history
100
-
101
- if most_similar_data:
102
- messages.append({"role": "system", "content": f"κ΄€λ ¨ 정보: {most_similar_data}"})
103
- else:
104
- return f"{user_mention}, μ£„μ†‘ν•©λ‹ˆλ‹€. κ·€ν•˜μ˜ 질문과 κ΄€λ ¨λœ 정보λ₯Ό 찾을 수 μ—†μŠ΅λ‹ˆλ‹€."
105
 
106
  logging.debug(f'Messages to be sent to the model: {messages}')
107
 
 
88
  # μœ μ‚¬ν•œ 데이터 μ°ΎκΈ°
89
  most_similar_data = find_most_similar_data(user_input)
90
 
91
+ if not most_similar_data:
92
+ return f"{user_mention}, μ£„μ†‘ν•©λ‹ˆλ‹€. κ·€ν•˜μ˜ 질문과 κ΄€λ ¨λœ 정보λ₯Ό 찾을 수 μ—†μŠ΅λ‹ˆλ‹€."
93
+
94
  system_message = f"""
95
  당신은 'kAI'λΌλŠ” μ΄λ¦„μ˜ ν•œκ΅­ λ³΄ν—˜ μƒν’ˆμ— λŒ€ν•œ AI μ‘°μ–Έμžμž…λ‹ˆλ‹€.
96
  λ°˜λ“œμ‹œ 제곡된 λ°μ΄ν„°μ…‹μ˜ μ •λ³΄λ§Œμ„ μ‚¬μš©ν•˜μ—¬ λ‹΅λ³€ν•΄μ•Ό ν•©λ‹ˆλ‹€.
97
+ 제곡된 데이터에 μ—†λŠ” 정보에 λŒ€ν•΄μ„œλŠ” μ ˆλŒ€ λ‹΅λ³€ν•˜μ§€ λ§ˆμ„Έμš”.
98
  λͺ¨λ“  닡변은 ν•œκΈ€λ‘œ ν•˜κ³ , markdown ν˜•μ‹μœΌλ‘œ 좜λ ₯ν•˜μ„Έμš”.
99
+ λ‹€μŒμ€ μ§ˆλ¬Έμ— κ΄€λ ¨λœ λ°μ΄ν„°μž…λ‹ˆλ‹€. 이 λ°μ΄ν„°λ§Œμ„ μ‚¬μš©ν•˜μ—¬ λ‹΅λ³€ν•˜μ„Έμš”:
100
+ {most_similar_data}
101
  """
102
 
103
  conversation_history.append({"role": "user", "content": user_input})
104
+ messages = [{"role": "system", "content": system_message}, {"role": "user", "content": user_input}]
 
 
 
 
 
105
 
106
  logging.debug(f'Messages to be sent to the model: {messages}')
107