Skip to content

Commit 2833087

Browse files
意图识别:提示词模板,区分语言。
1 parent 3fdb5a7 commit 2833087

4 files changed

Lines changed: 76 additions & 27 deletions

File tree

ui/src/locales/lang/en-US/workflow.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ export default {
188188
result: 'Search Results',
189189
searchParam: 'Search Parameters',
190190
select_variable: 'Select Variable',
191-
valueMessage: `Value or name `,
191+
valueMessage: 'Value or name',
192192

193193
searchQuestion: {
194194
label: 'Search Question',
@@ -451,6 +451,30 @@ You are a master of problem optimization, adept at accurately inferring user int
451451
input: {
452452
label: 'Input',
453453
},
454+
default_prompt_template: `# Role
455+
You are an intention classification expert, good at being able to judge which classification the user's input belongs to.
456+
457+
## Skills
458+
Skill 1: Clearly determine which of the following intention classifications the user's input belongs to.
459+
Intention classification list:
460+
{classification_list}
461+
462+
Note:
463+
- Please determine the match between the user's input content and the Intention classification list content, without judging or categorizing the match with the classification ID.
464+
- **When classifying, you must give higher weight to the context and intent continuity shown in the historical conversation. Do not rely solely on the literal meaning of the current input; instead, prioritize the most consistent classification with the previous dialogue flow.**
465+
466+
## User Input
467+
{user_input}
468+
469+
## Reply requirements
470+
- The answer must be returned in JSON format.
471+
- Strictly ensure that the output is in a valid JSON format.
472+
- Do not add prefix \`\`\`json or suffix \`\`\`
473+
- The answer needs to include the following fields such as:
474+
{output_json}
475+
476+
## Limit
477+
- Please do not reply in text.`,
454478
},
455479
applicationNode: {
456480
label: 'Agent Node',

ui/src/locales/lang/zh-CN/workflow.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,30 @@ export default {
443443
input: {
444444
label: '输入',
445445
},
446+
default_prompt_template: `# 角色
447+
你是一位意图分类专家,擅长判断用户输入属于哪个分类。
448+
449+
## 技能
450+
技能1:明确判断用户输入属于以下哪种意图分类。
451+
意图分类列表:
452+
{classification_list}
453+
454+
注:
455+
- 请判断用户输入内容与意图分类列表内容之间的匹配度,注意不要以分类ID作为评判或归类的依据。
456+
- **在分类时,必须更加重视历史对话中表现的上下文和意图连贯性。不要仅依赖当前输入的字面意思;相反,应优先考虑与先前对话流程最匹配的分类。**
457+
458+
## 用户输入
459+
{user_input}
460+
461+
## 回复要求
462+
- 回复内容必须以JSON格式返回。
463+
- 严格确保输出为有效的JSON格式。
464+
- 不要添加前缀 \`\`\`json 或 后缀 \`\`\`
465+
- 回复内容需要包含以下字段:
466+
{output_json}
467+
468+
## 限制
469+
- 请勿以文本形式回复。`,
446470
},
447471
applicationNode: {
448472
label: '智能体节点',

ui/src/locales/lang/zh-Hant/workflow.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,30 @@ export default {
443443
input: {
444444
label: '輸入',
445445
},
446+
default_prompt_template: `# 角色
447+
你是一位意圖分類專家,擅長判斷用戶輸入屬於哪個分類。
448+
449+
## 技能
450+
技能1:明確判斷用戶輸入屬於以下哪種意圖分類。
451+
意圖分類列表:
452+
{classification_list}
453+
454+
注:
455+
- 請判斷用戶輸入內容與意圖分類列表內容之間的匹配度,注意不要以分類ID作爲評判或歸類的依據。
456+
- **在分類時,必須更加重視歷史對話中表現的上下文和意圖連貫性。不要僅依賴當前輸入的字面意思;相反,應優先考慮與先前對話流程最匹配的分類。**
457+
458+
## 用戶輸入
459+
{user_input}
460+
461+
## 回覆要求
462+
- 回覆內容必須以JSON格式返回。
463+
- 嚴格確保輸出爲有效的JSON格式。
464+
- 不要添加前綴 \`\`\`json 或 後綴 \`\`\`
465+
- 回覆內容需要包含以下字段:
466+
{output_json}
467+
468+
## 限制
469+
- 請勿以文本形式回覆。`,
446470
},
447471
applicationNode: {
448472
label: '智能體節點',

ui/src/workflow/nodes/intent-classify-node/index.vue

Lines changed: 3 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -324,34 +324,11 @@ const model_change = (model_id?: string) => {
324324
}
325325
}
326326
327-
const defaultPromptTemplate = `# Role
328-
You are an intention classification expert, good at being able to judge which classification the user's input belongs to.
329-
330-
## Skills
331-
Skill 1: Clearly determine which of the following intention classifications the user's input belongs to.
332-
Intention classification list:
333-
{classification_list}
334-
335-
Note:
336-
- Please determine the match between the user's input content and the Intention classification list content, without judging or categorizing the match with the classification ID.
337-
- **When classifying, you must give higher weight to the context and intent continuity shown in the historical conversation. Do not rely solely on the literal meaning of the current input; instead, prioritize the most consistent classification with the previous dialogue flow.**
338-
339-
## User Input
340-
{user_input}
341-
342-
## Reply requirements
343-
- The answer must be returned in JSON format.
344-
- Strictly ensure that the output is in a valid JSON format.
345-
- Do not add prefix \`\`\`json or suffix \`\`\`
346-
- The answer needs to include the following fields such as:
347-
{output_json}
348-
349-
## Limit
350-
- Please do not reply in text.`
327+
const default_prompt_template = t('workflow.nodes.intentNode.other')
351328
352329
const form = {
353330
model_id: '',
354-
prompt_template: defaultPromptTemplate,
331+
prompt_template: default_prompt_template,
355332
branch: [
356333
{
357334
id: randomId(),
@@ -386,7 +363,7 @@ const form_data = computed({
386363
get: () => {
387364
if (props.nodeModel.properties.node_data) {
388365
if (!props.nodeModel.properties.node_data.prompt_template) {
389-
set(props.nodeModel.properties.node_data, 'prompt_template', defaultPromptTemplate)
366+
set(props.nodeModel.properties.node_data, 'prompt_template', default_prompt_template)
390367
}
391368
return props.nodeModel.properties.node_data
392369
} else {

0 commit comments

Comments
 (0)