Skip to content

Commit 98a9291

Browse files
Fix: Any Bugs
修复Action无法反馈至AI,新增ConfigManage.py输出改为星号保护隐私
1 parent f6875b8 commit 98a9291

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

Functions/ConfigManage.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def get_config(name: str, default: Union[str, int, float, bool, List, Dict, None
7373
# 转换值
7474
converted_value = convert_value(cfg_vl)
7575

76-
print(f"[CFG LOADER] READ FROM {path}: {name} = {converted_value} | Type: {type(converted_value)}")
76+
print(f'[CFG LOADER] READ FROM {path}: {name} = {"*" * len(converted_value)} | Type: {type(converted_value)}')
7777
return converted_value
7878

7979
def wnGet(name: str, default: Union[str, int, float, bool, List, Dict, None] = None, path: str = cfg_default_path) -> Any:

files/prompt.txt

+7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,19 @@
11
<!-- IMPORTANT -->
22

33
你是一个智能助手。通过OpenProject-AI/OpenProject项目与用户对话。
4+
由于上下文限制,你可能会"忘掉"一些信息。如果不清楚,请让客户提供给你缺失的信息。
45

56
【输出标准】
67
1. 实事求是:不会的/不可信的请告诉用户这些信息可能有误
78
2. 适当加入Emoji:帮助用户更容易理解信息
89
3. 避免过度使用缩写:缩写可能不容易被理解
910
4. 使用标准:使用OpenProject-AI/OpenProject标准化的动作,输出这些可以使你操控用户电脑
1011
5. 避免过度使用标准:不要在用户不需要你帮他做的事情上使用标准指令(即OpenProject-AI/stdAction-Local标准)
12+
6. 出现错误时:请告诉用户发生了什么错误,并提供解决方案,并且提示用户提交项目Issue。
13+
7. 当用户要求你做项目时,请先问用户项目文件夹路径,使用动作去获取文件夹内容,分析一遍。
14+
15+
【搜索】
16+
目前不要尝试搜索,因为搜索获取到的结果过长会导致程序出现问题。将会在下一个OpenProject-App release中支持搜索功能。
1117

1218
【OpenProject-AI/stdAction-Local操作标准】
1319
## 动作列表
@@ -58,6 +64,7 @@
5864

5965
## 结果返回标准
6066
> 以`~+~action-callback~-~`开头,后面跟着动作的执行结果,结尾是`~-~`,YAML格式。
67+
你无需返回结果,此格式是返回给你的,不是给用户的。结果将会在下一轮对话中通过用户role/tool role给你(YAML格式,开头是`~+~action-callback~-~`或`~+~action-callback~+~`,结尾是`~-~`),你可以告诉用户Action结果(自然语言)
6168

6269
### 字段说明
6370
- `action_type`:动作类型,如`File`、`Directory`、`Command`、`Network`、`Comment`、`Tip`、`Warning`、`Error`等。

main.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ def round_chat(chat_history: list, user_input, length_limit=10):
5050
action = ActionManage.wnGetActionContent(response) # 获取动作指令
5151
if action != None: # 如果存在动作指令,则执行动作,如果没有,则返回None
5252
action_cback = ActionManage.action_runner(action)
53+
chat_history = action_round(chat_history, action_cback)["chat_history"] # 修补漏洞
5354
else:
5455
action_cback = None
5556
# 判断是否包含思考过程
@@ -75,7 +76,7 @@ def action_round(chat_history: list, action_cback: dict):
7576
# 将动作结果加入上下文
7677
chat_history.append(
7778
{
78-
"role": "tool",
79+
"role": "user",
7980
"content": action_cback
8081
}
8182
)
@@ -103,7 +104,7 @@ def action_round(chat_history: list, action_cback: dict):
103104
while True:
104105
user_input = input("User >> ")
105106
result = round_chat(chat_history, user_input)
106-
if result["chat_history"][-1]["content"] in "</think>":
107+
if "</think>" in result["chat_history"][-1]["content"]:
107108
print("Assistant >> " + result["chat_history"][-1]["content"].split("</think>")[1])
108109
else:
109110
print("Assistant >> " + result["chat_history"][-1]["content"])

0 commit comments

Comments
 (0)