Documentation
¶
Index ¶
- Constants
- func BuildNotePrompt(ctx context.Context) string
- func FormatTime(t time.Time) string
- func GetDefaultPromptTemplate(model string) string
- func GetPromptPath(model string, global bool) (string, error)
- func GetPromptTemplate(model string) string
- func GetSystemPrompt(ctx context.Context) string
- func SaveMessages(ctx context.Context, msgs ...Message) error
- func SaveNote(ctx context.Context, content string) error
- func ToolCallsID(tcs []ToolCall) string
- type Message
- type Note
- type ToolCall
- type ToolCallFunction
Constants ¶
View Source
const MaxNoteContentLen = 40
MaxNoteContentLen 笔记内容最大长度(rune),供 tool handler 参考
Variables ¶
This section is empty.
Functions ¶
func BuildNotePrompt ¶ added in v0.7.6
BuildNotePrompt 从近期笔记构建记忆线索提示词
func GetDefaultPromptTemplate ¶
GetDefaultPromptTemplate 获取内嵌的默认提示词模板
func GetPromptPath ¶
GetPromptPath 获取提示词文件路径 global: true表示全局配置,false表示项目配置
func GetPromptTemplate ¶
GetPromptTemplate 获取当前生效的提示词模板 优先级:项目配置 > 全局配置 > 内嵌默认模板
func SaveMessages ¶ added in v0.7.6
SaveMessages 保存消息(事务)
func SaveNote ¶ added in v0.7.6
SaveNote 保存一条对话笔记(限制 MaxNoteContentLen 字以内)
Types ¶
type Message ¶ added in v0.7.6
type Message struct {
ID int64 `json:"-"`
SessionID int64 `json:"-"`
ModelID int64 `json:"-"`
Role string `json:"role"`
ReasoningContent string `json:"reasoning_content"`
Content string `json:"content"` // 始终输出,即使为空字符串
ToolCalls []ToolCall `json:"tool_calls,omitempty"` // 仅当有工具调用时输出
ToolCallID string `json:"tool_call_id,omitempty"` // 仅当 role="tool" 时输出
CreatedAt time.Time `json:"-"`
OK bool `json:"-"`
// contains filtered or unexported fields
}
Message 扩展,支持工具调用(注意:Content 字段不再使用 omitempty)
func LoadPrompts ¶ added in v0.7.6
LoadPrompts loads the system prompt combined with skill prompts.
type Note ¶ added in v0.7.6
Note 对话笔记,用于跨对话记忆
type ToolCall ¶ added in v0.7.6
type ToolCall struct {
ID string `json:"id"`
Type string `json:"type"`
Function ToolCallFunction `json:"function"`
}
Source Files
¶
- doc.go
- message.go
- note.go
- prompt.go
Click to show internal directories.
Click to hide internal directories.