Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -102,10 +102,10 @@ agent = initialize_agent(
|
|
| 102 |
# β
Chat ν¨μ (Memory μ μ§)
|
| 103 |
# ββββββββββββββββββββββββββββββ
|
| 104 |
def chat(message, history):
|
|
|
|
| 105 |
try:
|
| 106 |
# λν κΈ°λ‘μ LangChain memoryμ λ°μ
|
| 107 |
memory.chat_memory.add_user_message(message)
|
| 108 |
-
raw = agent.run(message)
|
| 109 |
# JSON ννλ‘ λ°ν μ νμ±
|
| 110 |
text = str(raw)
|
| 111 |
match = re.search(r"\{.*\}", text, re.DOTALL)
|
|
@@ -118,7 +118,7 @@ def chat(message, history):
|
|
| 118 |
# AI μλ΅μ memoryμ μΆκ°
|
| 119 |
memory.chat_memory.add_ai_message(text)
|
| 120 |
except Exception as e:
|
| 121 |
-
text =
|
| 122 |
|
| 123 |
history = history + [(message, text)]
|
| 124 |
return history, history, ""
|
|
|
|
| 102 |
# β
Chat ν¨μ (Memory μ μ§)
|
| 103 |
# ββββββββββββββββββββββββββββββ
|
| 104 |
def chat(message, history):
|
| 105 |
+
raw = agent.run(message)
|
| 106 |
try:
|
| 107 |
# λν κΈ°λ‘μ LangChain memoryμ λ°μ
|
| 108 |
memory.chat_memory.add_user_message(message)
|
|
|
|
| 109 |
# JSON ννλ‘ λ°ν μ νμ±
|
| 110 |
text = str(raw)
|
| 111 |
match = re.search(r"\{.*\}", text, re.DOTALL)
|
|
|
|
| 118 |
# AI μλ΅μ memoryμ μΆκ°
|
| 119 |
memory.chat_memory.add_ai_message(text)
|
| 120 |
except Exception as e:
|
| 121 |
+
text = str(raw)
|
| 122 |
|
| 123 |
history = history + [(message, text)]
|
| 124 |
return history, history, ""
|