21 lines
924 B
Go
21 lines
924 B
Go
package llm_service
|
||
|
||
import (
|
||
"ai_scheduler/internal/data/model"
|
||
"context"
|
||
"time"
|
||
)
|
||
|
||
type LlmService interface {
|
||
IntentRecognize(ctx context.Context, sysInfo model.AiSy, history []model.AiChatHi, userInput string, tasks []model.AiTask) (string, error)
|
||
}
|
||
|
||
// buildSystemPrompt 构建系统提示词
|
||
func buildSystemPrompt(prompt string) string {
|
||
if len(prompt) == 0 {
|
||
prompt = "[system] 你是一个智能路由系统,核心职责是 **精准解析用户意图并路由至对应任务模块**\n[rule]\n1.返回以下格式的JSON:{ \"index\": \"工具索引index\", \"confidence\": 0.0-1.0,\"reasoning\": \"判断理由\"}\n2.严格返回字符串格式,禁用markdown格式返回\n3.只返回json字符串,不包含任何其他解释性文字\n4.当用户意图非常不清晰时使用,尝试进行追问具体希望查询内容,\n当前时间是:" + time.Now().Format(time.DateTime)
|
||
}
|
||
|
||
return prompt
|
||
}
|