diff --git a/chagpt-adapter/config.yaml b/chagpt-adapter/config.yaml
new file mode 100644
index 0000000..2740a1c
--- /dev/null
+++ b/chagpt-adapter/config.yaml
@@ -0,0 +1,26 @@
+server:
+ port: 8080
+ #proxied: http://127.0.0.1:7890
+ password: 'xxx'
+ think_reason: true
+ debug: false
+
+browser-less:
+ enabled: true
+ port: 8081
+ #reversal: http://127.0.0.1:8081
+ disabled-gpu: true
+ headless: new
+
+matcher:
+ - match: I do not engage
+ over: ":\n"
+ notice:
+ regex: |
+ "(?i)I do not engage .+:\n":""
+ - match:
+ over:
+ notice:
+ think_reason: true
+ regex: |
+ "(?s)(.+)":"$1"
\ No newline at end of file
diff --git a/game_task/game_chatgpt_qa.py b/game_task/game_chatgpt_qa.py
index 419d733..acf3b16 100644
--- a/game_task/game_chatgpt_qa.py
+++ b/game_task/game_chatgpt_qa.py
@@ -8,6 +8,7 @@ def extract_content(data_string):
data = json.loads(data_string)
# 提取content字段
content = data["choices"][0]["message"].get("content", "")
+ print(content)
return content
except json.JSONDecodeError:
print("Invalid JSON")
@@ -57,14 +58,14 @@ def game_question_json(question):
每个问题都应当独立,问题之间不应具有连贯性或延续性。
避免重复提问或相似问题,确保每个问题都是全新的。
,问题需要有一定的难度,回答完毕之后用户能有所收获,并且对问题进行打分,同时根据问题难度告知答对之后给多少分(1-10)请只返回JSON格式的内容:
- 格式要求如下:{\"question\": \"哪个国家最早将玫瑰与爱情联系起来?\", \"score\":\"1\", \"answer\": \"波斯\",\"description\":\"描述问题答案的原因\"}
+ 格式要求如下(请不要加上markdown 的符号):{\"question\": \"哪个国家最早将玫瑰与爱情联系起来?\", \"score\":\"1\", \"answer\": \"波斯\",\"description\":\"描述问题答案的原因\"}
"""
return message_task_json(prompt, question)
def game_answer_json(answar):
- prompt = "你是一个益智百科问答大师,可以根据用户回答的答案进行判断,并且对问题(question)答案(answer)进行打分,打分时请参考最高分要求(top_score),告知用户能获得多少分,请在description中描述打分理由,请只返回JSON格式的内容:格式要求如下:{\"question\": \"哪个国家最早将玫瑰与爱情联系起来?\", \"score\":\"1\", \"answer\": \"波斯\",\"description\":\"描述问题答案的原因\"}"
+ prompt = "你是一个益智百科问答大师,可以根据用户回答的答案进行判断,并且对问题(question)答案(answer)进行打分,打分时请参考最高分要求(top_score),告知用户能获得多少分,请在description中描述打分理由,请只返回JSON格式的内容:格式要求如下(请不要加上markdown 的符号):{\"question\": \"哪个国家最早将玫瑰与爱情联系起来?\", \"score\":\"1\", \"answer\": \"波斯\",\"description\":\"描述问题答案的原因\"}"
return message_task_json(prompt, answar)
diff --git a/game_task/game_task_encyclopedia.py b/game_task/game_task_encyclopedia.py
index 5b62245..d9031f5 100644
--- a/game_task/game_task_encyclopedia.py
+++ b/game_task/game_task_encyclopedia.py
@@ -241,6 +241,7 @@ def submit_answer(group_id, player_id, task_id, answer):
# 调用内部方法校验答案
answer_json = {"question": question, "top_score": str(top_score), "answer": answer}
result = game_answer_json(answer_json)
+ print(result)
points = int(result["score"])
description = result["description"]
is_correct = points > 0
@@ -297,7 +298,8 @@ def submit_answer(group_id, player_id, task_id, answer):
conn.commit()
return message
- except ValueError:
+ except ValueError as e:
+ print(f"submit_answer:{e}")
return (
f"😅 哎呀,小调皮\n"
f"🌟 任务ID格式不对哦\n"
@@ -474,8 +476,8 @@ def setup_schedule():
# 主程序
if __name__ == "__main__":
# 测试抢答功能
- print(game_process_message("47530198896@chatroom", "player1001", "/start", "玩家1"))
- print(game_process_message("47530198896@chatroom", "player1002", "/start", "玩家2"))
- print(game_process_message("47530198896@chatroom", "player1001", "/gettask"))
+ # print(game_process_message("47530198896@chatroom", "player1001", "/start", "玩家1"))
+ # print(game_process_message("47530198896@chatroom", "player1002", "/start", "玩家2"))
+ # print(game_process_message("47530198896@chatroom", "player1001", "/gettask"))
# 玩家2 抢答玩家1的任务
- print(game_process_message("47530198896@chatroom", "player1002", "/answer 1 珠穆朗玛峰"))
\ No newline at end of file
+ print(game_process_message("45317011307@chatroom", "Jyunere", "/answer 18 罗马斗兽场"))
\ No newline at end of file