Files
smartmate/backend/agent2/prompt/taskquery.go
Losita e06284d0b0 Version: 0.7.6.dev.260325
后端:
- ♻️ 将 `taskquery` 模块迁移至 `agent2`,并完成与 `agent2` 业务链路及整体结构的正式接入

前端:
- 🧱 已完成基础框架搭建,并完成了登录、注册、主页等页面并对接了对应接口;但整体功能实现仍在完善中
2026-03-25 00:49:16 +08:00

80 lines
3.0 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package agentprompt
import (
"fmt"
"strings"
)
const TaskQueryPlanPrompt = `你是 SmartFlow 的任务查询规划器。请根据用户原话,输出结构化查询计划 JSON供后端直接执行。
只允许输出 JSON不要输出解释、代码块或多余文字。
输出字段:
{
"user_goal": "一句话总结用户诉求",
"quadrants": [1,2,3,4],
"sort_by": "deadline|priority|id",
"order": "asc|desc",
"limit": 1-20,
"include_completed": false,
"keyword": "可选关键词,或空字符串",
"deadline_before": "yyyy-MM-dd HH:mm 或空字符串",
"deadline_after": "yyyy-MM-dd HH:mm 或空字符串"
}
规则:
1. quadrants 为空数组表示“全部象限”。
2. 用户未提排序时,默认 sort_by=deadline 且 order=asc。
3. 用户未提数量时limit 默认 5。
4. 时间字段必须输出绝对时间或空字符串,不要输出“明天”“下周一”这类相对时间。
5. 如果用户语义更偏向“我还有什么要做”“看看待办”,优先考虑 1、2 象限;如果 1、2 象限为空,再考虑 3、4 象限。
6. 如果用户语义更偏向“来点事做做”“给我点轻松的任务”,优先考虑 3、4 象限。
7. 允许多选象限。`
const TaskQueryReflectPrompt = `你是 SmartFlow 的任务查询结果审阅器。你会看到:用户原话、当前查询计划、查询结果摘要、当前重试次数。
请只输出 JSON不要输出解释、代码块或多余文字。
输出字段:
{
"satisfied": true,
"need_retry": false,
"reason": "一句话原因",
"reply": "可直接给用户看的中文回复",
"retry_patch": {
"quadrants": [1,2,3,4],
"sort_by": "deadline|priority|id",
"order": "asc|desc",
"limit": 1-20,
"include_completed": true,
"keyword": "可选关键词,或空字符串",
"deadline_before": "yyyy-MM-dd HH:mm 或空字符串",
"deadline_after": "yyyy-MM-dd HH:mm 或空字符串"
}
}
规则:
1. 如果当前结果已经满足用户诉求,返回 satisfied=true 且 need_retry=false。
2. 如果当前结果不满足,但仍值得再查一次,返回 need_retry=true并尽量只给最小必要 patch。
3. 如果不建议再试,返回 need_retry=false并在 reply 里说明当前最接近的结果。
4. reply 应该是自然中文,不要输出表格。`
func BuildTaskQueryPlanUserPrompt(nowText, userInput string) string {
return fmt.Sprintf(
"当前时间(北京时间,精确到分钟):%s\n用户输入%s\n\n请输出任务查询计划 JSON。",
strings.TrimSpace(nowText),
strings.TrimSpace(userInput),
)
}
func BuildTaskQueryReflectUserPrompt(nowText, userInput, userGoal, planSummary string, retryCount, maxRetry int, resultSummary string) string {
return fmt.Sprintf(
"当前时间:%s\n用户原话%s\n用户目标%s\n当前查询计划%s\n当前重试%d/%d\n查询结果摘要\n%s",
strings.TrimSpace(nowText),
strings.TrimSpace(userInput),
strings.TrimSpace(userGoal),
strings.TrimSpace(planSummary),
retryCount,
maxRetry,
strings.TrimSpace(resultSummary),
)
}