Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -31,7 +31,12 @@ candidate_tasks = [
|
|
| 31 |
]
|
| 32 |
|
| 33 |
def generate_response(intent):
|
| 34 |
-
prompt =
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
output = text_generator(prompt, max_new_tokens=100, do_sample=True)[0]['generated_text']
|
| 36 |
return output
|
| 37 |
|
|
@@ -158,5 +163,3 @@ if session["system_result"] is not None:
|
|
| 158 |
suggestion = generate_response(intent)
|
| 159 |
st.markdown(f"**• {intent.capitalize()}**")
|
| 160 |
st.code(suggestion)
|
| 161 |
-
if st.button("Copy to agent reply box", key=f"btn_{selected_customer}_{intent}"):
|
| 162 |
-
session["agent_reply"] = suggestion
|
|
|
|
| 31 |
]
|
| 32 |
|
| 33 |
def generate_response(intent):
|
| 34 |
+
prompt = (
|
| 35 |
+
f"Generate a customer service reply for: '{intent}'. "
|
| 36 |
+
"Structure your answer into: 1. Greeting, 2. Summary of customer's current situation (e.g., current plan is Plan X costing ¥X/month or balance is ¥X), "
|
| 37 |
+
"3. Your suggested recommendation (e.g., upgrade to Plan Y with XX GB), and 4. End with a helpful and polite question. "
|
| 38 |
+
"Use anonymized or placeholder values for all specific customer data."
|
| 39 |
+
)
|
| 40 |
output = text_generator(prompt, max_new_tokens=100, do_sample=True)[0]['generated_text']
|
| 41 |
return output
|
| 42 |
|
|
|
|
| 163 |
suggestion = generate_response(intent)
|
| 164 |
st.markdown(f"**• {intent.capitalize()}**")
|
| 165 |
st.code(suggestion)
|
|
|
|
|
|