Skip to content

Commit d623694

Browse files
author
linyuan.yang
committed
prompt
1 parent 76b3c0c commit d623694

10 files changed

Lines changed: 108 additions & 21 deletions

File tree

packages/admin/src/i18n/en.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ export default {
416416
contains_custom: 'Contains custom prompts',
417417
custom_title: 'Custom',
418418
vars_label: 'Variables:',
419+
cat_system: 'System',
420+
cat_agent: 'Agents',
421+
cat_memory: 'Memory',
422+
cat_wiki: 'Wiki',
423+
cat_skills: 'Skills',
424+
cat_tools: 'Tools',
419425
},
420426
scheduler: {
421427
title: 'Scheduler',
@@ -583,7 +589,7 @@ export default {
583589
acp_command: 'Command',
584590
acp_command_placeholder: 'e.g. npx, opencode, qwen',
585591
acp_args: 'Arguments',
586-
acp_args_placeholder: 'e.g. -y @agentclientprotocol/claude-agent-acp',
592+
acp_args_placeholder: "e.g. -y {'@'}agentclientprotocol/claude-agent-acp",
587593
acp_args_hint: 'Space-separated arguments',
588594
acp_session_mode: 'Session Mode',
589595
acp_env: 'Environment Variables',

packages/admin/src/i18n/zh.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,12 @@ export default {
416416
contains_custom: '包含自定义提示词',
417417
custom_title: '自定义',
418418
vars_label: '可用变量:',
419+
cat_system: '系统',
420+
cat_agent: '智能体',
421+
cat_memory: '记忆',
422+
cat_wiki: '知识库',
423+
cat_skills: '技能',
424+
cat_tools: '工具',
419425
},
420426
scheduler: {
421427
title: '计时器管理',
@@ -583,7 +589,7 @@ export default {
583589
acp_command: '启动命令',
584590
acp_command_placeholder: '如 npx, opencode, qwen',
585591
acp_args: '启动参数',
586-
acp_args_placeholder: '如 -y @agentclientprotocol/claude-agent-acp',
592+
acp_args_placeholder: "如 -y {'@'}agentclientprotocol/claude-agent-acp",
587593
acp_args_hint: '以空格分隔各参数',
588594
acp_session_mode: '会话模式',
589595
acp_env: '环境变量',

packages/admin/src/views/PromptsView.vue

Lines changed: 72 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,37 @@ function flattenTree(nodes: TreeNode[], depth = 0): { node: TreeNode; depth: num
2424
return result
2525
}
2626
27-
const flatTree = computed(() => flattenTree(tree.value))
27+
const categoryOrder = ['system', 'agent', 'memory', 'wiki', 'skills', 'tools']
28+
29+
const categories = computed(() => {
30+
const map = new Map<string, TreeNode>()
31+
for (const node of tree.value) {
32+
if (node.type === 'dir') map.set(node.name, node)
33+
}
34+
const order = [...categoryOrder]
35+
for (const node of tree.value) {
36+
if (node.type === 'dir' && !order.includes(node.name)) order.push(node.name)
37+
}
38+
return order
39+
.filter(name => map.has(name))
40+
.map(name => ({
41+
key: name,
42+
label: t(`prompts.cat_${name}`, name),
43+
node: map.get(name)!,
44+
}))
45+
})
46+
47+
const collapsedCats = ref(new Set<string>())
48+
49+
function toggleCat(name: string) {
50+
if (collapsedCats.value.has(name)) collapsedCats.value.delete(name)
51+
else collapsedCats.value.add(name)
52+
collapsedCats.value = new Set(collapsedCats.value)
53+
}
54+
55+
function flattenChildren(parent: TreeNode) {
56+
return flattenTree(parent.children || [], 0)
57+
}
2858
2959
async function loadTree() {
3060
try {
@@ -132,22 +162,31 @@ onMounted(loadTree)
132162
<!-- Left: file tree -->
133163
<div class="prompts-tree">
134164
<div class="prompts-tree-header">{{ t('prompts.header') }}</div>
135-
<div
136-
v-for="{ node, depth } in flatTree"
137-
:key="node.path"
138-
class="tree-item"
139-
:class="{
140-
'tree-dir': node.type === 'dir',
141-
'tree-file': node.type === 'file',
142-
'tree-selected': selectedPath === node.path,
143-
}"
144-
:style="{ paddingLeft: `${10 + depth * 14}px` }"
145-
@click="node.type === 'dir' ? toggleDir(node.path) : selectFile(node.path)"
146-
>
147-
<span class="tree-icon">{{ node.type === 'dir' ? (collapsed.has(node.path) ? '▶' : '▼') : '·' }}</span>
148-
<span class="tree-name">{{ node.name }}</span>
149-
<span v-if="node.isOverride" class="tree-custom-dot" :title="node.type === 'dir' ? t('prompts.contains_custom') : t('prompts.custom_title')"></span>
150-
</div>
165+
<template v-for="cat in categories" :key="cat.key">
166+
<div class="tree-category" @click="toggleCat(cat.key)">
167+
<span class="tree-icon">{{ collapsedCats.has(cat.key) ? '▶' : '▼' }}</span>
168+
<span class="tree-cat-label">{{ cat.label }}</span>
169+
<span v-if="cat.node.isOverride" class="tree-custom-dot" :title="t('prompts.contains_custom')"></span>
170+
</div>
171+
<template v-if="!collapsedCats.has(cat.key)">
172+
<div
173+
v-for="{ node, depth } in flattenChildren(cat.node)"
174+
:key="node.path"
175+
class="tree-item"
176+
:class="{
177+
'tree-dir': node.type === 'dir',
178+
'tree-file': node.type === 'file',
179+
'tree-selected': selectedPath === node.path,
180+
}"
181+
:style="{ paddingLeft: `${14 + depth * 14}px` }"
182+
@click="node.type === 'dir' ? toggleDir(node.path) : selectFile(node.path)"
183+
>
184+
<span class="tree-icon">{{ node.type === 'dir' ? (collapsed.has(node.path) ? '▶' : '▼') : '·' }}</span>
185+
<span class="tree-name">{{ node.name }}</span>
186+
<span v-if="node.isOverride" class="tree-custom-dot" :title="node.type === 'dir' ? t('prompts.contains_custom') : t('prompts.custom_title')"></span>
187+
</div>
188+
</template>
189+
</template>
151190
</div>
152191

153192
<!-- Right: editor -->
@@ -208,6 +247,22 @@ onMounted(loadTree)
208247
letter-spacing: 0.06em;
209248
border-bottom: 1px solid #e8e6e3;
210249
}
250+
.tree-category {
251+
display: flex;
252+
align-items: center;
253+
gap: 5px;
254+
padding: 7px 10px 5px;
255+
font-size: 12px;
256+
font-weight: 700;
257+
color: #4a4a4a;
258+
cursor: pointer;
259+
user-select: none;
260+
border-bottom: 1px solid #ece8e4;
261+
margin-top: 2px;
262+
}
263+
.tree-category:first-child { margin-top: 0; }
264+
.tree-category:hover { background: #f0ece8; }
265+
.tree-cat-label { flex: 1; }
211266
.tree-item {
212267
display: flex;
213268
align-items: center;
0 Bytes
Binary file not shown.

packages/sbot/prompts/agent/react_system.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
vars:
3+
agents: 可调度的子智能体列表 (XML 格式,含 ID 和描述)
4+
---
15
You are a ReAct orchestration expert. Break down the user's request and dispatch sub-tasks to specialized agents using the `task` tool.
26

37
<agents>

packages/sbot/prompts/memory/compressor.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
vars:
3+
memories: 待合并的记忆列表 (每条用 <memory> 标签包裹,含索引和时间戳)
4+
---
15
You are a memory consolidation expert. Merge the following memories into a single concise but complete memory.
26

37
Strategy: consolidate by theme — group related information together.

packages/sbot/prompts/memory/system.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
vars:
3+
items: 格式化的记忆条目列表
4+
---
15
<user-memories>
26
{items}
37
</user-memories>

packages/sbot/prompts/skills/system.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
vars:
3+
skills: 已注册的技能列表 (XML 格式,含名称、描述和触发条件)
4+
---
15
<skill-instructions>
26
<skills>
37
{skills}

packages/sbot/prompts/wiki/system.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
---
2+
vars:
3+
items: 相关知识库条目列表
4+
---
15
<wiki-knowledge>
26
{items}
37
</wiki-knowledge>

packages/sbot/src/Channel/ChannelManager.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,8 +154,8 @@ export class ChannelManager {
154154
}
155155
logger.warn(`Channel ${label} init returned nothing, skipped`);
156156
return false;
157-
} catch (e) {
158-
logger.error(`Channel ${label} failed to start: ${e}`);
157+
} catch (e: any) {
158+
logger.error(`Channel ${label} failed to start: ${e.message}\n${e.stack}`);
159159
return false;
160160
}
161161
}

0 commit comments

Comments
 (0)