Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -37,11 +37,10 @@ This way you directly address the user's question in a manner that reflects the
|
|
37 |
of a customer support representative (female).
|
38 |
Chat History: {chat_history}
|
39 |
Question: {question}
|
40 |
-
Table: {table}
|
41 |
Answer:
|
42 |
"""
|
43 |
daysoff_assistant_prompt = PromptTemplate(
|
44 |
-
input_variables=["chat_history", "question"
|
45 |
template=daysoff_assistant_template,
|
46 |
)
|
47 |
|
@@ -115,22 +114,15 @@ async def handle_message(message: cl.Message):
|
|
115 |
f"| ๐๐ฃ๐๐ก๐ช๐๐๐ | {booking_data.get('included', 'N/A')} |"
|
116 |
)
|
117 |
|
118 |
-
# --invoke LLM w/ table + user_message
|
119 |
-
response = await llm_chain.ainvoke({
|
120 |
-
"table": table,
|
121 |
-
"question": user_message,
|
122 |
-
"chat_history": ""
|
123 |
-
}, callbacks=[cl.AsyncLangchainCallbackHandler()])
|
124 |
-
|
125 |
# --send both as combined_message
|
126 |
-
combined_message = f"###
|
127 |
await cl.Message(content=combined_message).send()
|
128 |
|
129 |
except Exception as e:
|
130 |
await cl.Message(content=f"Error processing booking data: {str(e)}").send()
|
131 |
|
132 |
else:
|
133 |
-
await cl.Message(content="Booking not found
|
134 |
|
135 |
except requests.exceptions.RequestException as e:
|
136 |
await cl.Message(content=f"Request failed: {str(e)}").send()
|
|
|
37 |
of a customer support representative (female).
|
38 |
Chat History: {chat_history}
|
39 |
Question: {question}
|
|
|
40 |
Answer:
|
41 |
"""
|
42 |
daysoff_assistant_prompt = PromptTemplate(
|
43 |
+
input_variables=["chat_history", "question"],
|
44 |
template=daysoff_assistant_template,
|
45 |
)
|
46 |
|
|
|
114 |
f"| ๐๐ฃ๐๐ก๐ช๐๐๐ | {booking_data.get('included', 'N/A')} |"
|
115 |
)
|
116 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
117 |
# --send both as combined_message
|
118 |
+
combined_message = f"### Informasjon for Bestillingskode:\n\n{table}\n\n### Comment:\n\n{response.get('text')}"
|
119 |
await cl.Message(content=combined_message).send()
|
120 |
|
121 |
except Exception as e:
|
122 |
await cl.Message(content=f"Error processing booking data: {str(e)}").send()
|
123 |
|
124 |
else:
|
125 |
+
await cl.Message(content="Booking not found").send()
|
126 |
|
127 |
except requests.exceptions.RequestException as e:
|
128 |
await cl.Message(content=f"Request failed: {str(e)}").send()
|