Spaces:
Runtime error
Runtime error
seawolf2357
commited on
Commit
β’
c4670be
1
Parent(s):
0940998
Update app.py
Browse files
app.py
CHANGED
@@ -37,7 +37,7 @@ if SPECIFIC_CHANNEL_ID:
|
|
37 |
SPECIFIC_CHANNEL_ID = int(SPECIFIC_CHANNEL_ID)
|
38 |
|
39 |
# μΉν
URL μ€μ
|
40 |
-
WEBHOOK_URL =
|
41 |
|
42 |
# μ μ‘ μ€ν¨ μ μ¬μλ νμ
|
43 |
MAX_RETRIES = 3
|
@@ -124,8 +124,12 @@ async def generate_reply(comment, transcript):
|
|
124 |
prompt = f"{system_prompt}\nλκΈ: {comment}\nλΉλμ€ μλ§: {transcript}"
|
125 |
response = hf_client.text_generation(prompt)
|
126 |
if response:
|
127 |
-
|
128 |
-
|
|
|
|
|
|
|
|
|
129 |
except Exception as e:
|
130 |
logging.error(f"Error generating reply: {e}")
|
131 |
return "λ΅λ³μ μμ±ν μ μμ΅λλ€."
|
|
|
37 |
SPECIFIC_CHANNEL_ID = int(SPECIFIC_CHANNEL_ID)
|
38 |
|
39 |
# μΉν
URL μ€μ
|
40 |
+
WEBHOOK_URL = "https://connect.pabbly.com/workflow/sendwebhookdata/IjU3NjUwNTY1MDYzMjA0MzA1MjY4NTUzMDUxMzUi_pc"
|
41 |
|
42 |
# μ μ‘ μ€ν¨ μ μ¬μλ νμ
|
43 |
MAX_RETRIES = 3
|
|
|
124 |
prompt = f"{system_prompt}\nλκΈ: {comment}\nλΉλμ€ μλ§: {transcript}"
|
125 |
response = hf_client.text_generation(prompt)
|
126 |
if response:
|
127 |
+
try:
|
128 |
+
response_json = json.loads(response) # λ¬Έμμ΄μ JSONμΌλ‘ νμ±
|
129 |
+
return response_json.get("generated_text", "").strip()
|
130 |
+
except json.JSONDecodeError:
|
131 |
+
logging.error(f"Failed to decode JSON: {response}")
|
132 |
+
return "λ΅λ³μ μμ±ν μ μμ΅λλ€."
|
133 |
except Exception as e:
|
134 |
logging.error(f"Error generating reply: {e}")
|
135 |
return "λ΅λ³μ μμ±ν μ μμ΅λλ€."
|