Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -36,6 +36,8 @@ def build_ui():
|
|
36 |
task_match = re.search(r"负责(.*?)(、|。)", response) # 提取任务描述
|
37 |
task = task_match.group(1).strip() if task_match else "任务解析失败"
|
38 |
|
|
|
|
|
39 |
# 动态生成解法选项
|
40 |
solution_message = f"""根据以下任务描述,生成三个解决方案选项:
|
41 |
任务:{task}
|
@@ -43,10 +45,14 @@ def build_ui():
|
|
43 |
|
44 |
# 调用模型生成解法选项
|
45 |
solution_response = taskgen_client.predict(message=solution_message, api_name="/chat")
|
46 |
-
|
|
|
|
|
47 |
# 解析模型返回的解法选项(假设模型返回每个选项单独一行)
|
48 |
solution_options = solution_response.split("\n") # 假设解法选项按行分开
|
49 |
|
|
|
|
|
50 |
return task, solution_options, jd_text, task, solution_options
|
51 |
|
52 |
def handle_submit(selected_option, comment_text, final_solution_text):
|
|
|
36 |
task_match = re.search(r"负责(.*?)(、|。)", response) # 提取任务描述
|
37 |
task = task_match.group(1).strip() if task_match else "任务解析失败"
|
38 |
|
39 |
+
print(f"提取的任务:{task}") # 添加调试信息
|
40 |
+
|
41 |
# 动态生成解法选项
|
42 |
solution_message = f"""根据以下任务描述,生成三个解决方案选项:
|
43 |
任务:{task}
|
|
|
45 |
|
46 |
# 调用模型生成解法选项
|
47 |
solution_response = taskgen_client.predict(message=solution_message, api_name="/chat")
|
48 |
+
|
49 |
+
print(f"模型返回的解法选项:{solution_response}") # 输出模型的响应,查看格式
|
50 |
+
|
51 |
# 解析模型返回的解法选项(假设模型返回每个选项单独一行)
|
52 |
solution_options = solution_response.split("\n") # 假设解法选项按行分开
|
53 |
|
54 |
+
print(f"解析后的解法选项:{solution_options}") # 添加调试信息,查看解析结果
|
55 |
+
|
56 |
return task, solution_options, jd_text, task, solution_options
|
57 |
|
58 |
def handle_submit(selected_option, comment_text, final_solution_text):
|