Documentation
¶
Index ¶
- func CheckQMDAvailable(ctx context.Context, qmdPath string, timeout time.Duration) (bool, error)
- func CleanOldExports(exportDir string, retentionDays int) error
- func CreateCollection(ctx context.Context, qmdPath, name, path, pattern string, ...) error
- func EmbedCollection(ctx context.Context, qmdPath, name string, timeout time.Duration) ([]byte, error)
- func ExportAllSessions(sessionDir, exportDir string, retentionDays int) error
- func ExportSessionToFile(session *SessionFile, exportDir string, retentionDays int) error
- func FindSessionDir(workspace string) (string, error)
- func GetQMDVersion(ctx context.Context, qmdPath string, timeout time.Duration) (string, error)
- func ListCollections(ctx context.Context, qmdPath string, timeout time.Duration) ([]string, error)
- func RunQMDCommand(ctx context.Context, cmd *exec.Cmd, timeout time.Duration) ([]byte, error)
- func UpdateCollection(ctx context.Context, qmdPath, name string, timeout time.Duration) ([]byte, error)
- type CollectionStats
- type Message
- type QMDCollection
- type QMDConfig
- type QMDLimitsConfig
- type QMDManager
- func (m *QMDManager) Close() error
- func (m *QMDManager) Embed(ctx context.Context) error
- func (m *QMDManager) GetStatus() *QMDStatus
- func (m *QMDManager) Initialize(ctx context.Context) error
- func (m *QMDManager) Query(ctx context.Context, query string) ([]QMDQueryResult, error)
- func (m *QMDManager) Update(ctx context.Context) error
- type QMDPathConfig
- type QMDQueryResult
- type QMDSessionsConfig
- type QMDStatus
- type QMDUpdateConfig
- type SessionFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckQMDAvailable ¶
CheckQMDAvailable 检查 QMD 是否可用
func CleanOldExports ¶
CleanOldExports 清理过期的导出文件
func CreateCollection ¶
func CreateCollection(ctx context.Context, qmdPath, name, path, pattern string, timeout time.Duration) error
CreateCollection 创建 QMD 集合
func EmbedCollection ¶
func EmbedCollection(ctx context.Context, qmdPath, name string, timeout time.Duration) ([]byte, error)
EmbedCollection 为集合生成嵌入向量
func ExportAllSessions ¶
ExportAllSessions 导出所有会话
func ExportSessionToFile ¶
func ExportSessionToFile(session *SessionFile, exportDir string, retentionDays int) error
ExportSessionToFile 导出单个会话到 Markdown
func GetQMDVersion ¶
GetQMDVersion 获取 QMD 版本
func ListCollections ¶
ListCollections 列出所有集合
func RunQMDCommand ¶
RunQMDCommand 执行 QMD 命令
Types ¶
type CollectionStats ¶
type CollectionStats struct {
Name string `json:"name"`
DocumentCount int `json:"document_count"`
EmbeddingCount int `json:"embedding_count"`
LastUpdate string `json:"last_update"`
}
GetCollectionStats 获取集合统计信息
func GetCollectionStats ¶
type Message ¶
type Message struct {
Role string `json:"role"` // "user" | "assistant" | "system"
Content string `json:"content"`
}
Message 消息格式
type QMDCollection ¶
type QMDCollection struct {
Name string `json:"name"`
Path string `json:"path"`
Pattern string `json:"pattern"`
CreatedAt time.Time `json:"created_at"`
LastUpdate time.Time `json:"last_updated"`
DocumentCount int `json:"document_count"`
}
QMDCollection QMD 集合配置
type QMDConfig ¶
type QMDConfig struct {
Command string
Enabled bool
IncludeDefault bool
Paths []QMDPathConfig
Sessions QMDSessionsConfig
Update QMDUpdateConfig
Limits QMDLimitsConfig
}
QMDConfig QMD 配置(从 config.MemoryConfig.QMD 映射)
type QMDLimitsConfig ¶
QMDLimitsConfig QMD 搜索限制配置
type QMDManager ¶
type QMDManager struct {
// contains filtered or unexported fields
}
QMDManager 管理 QMD 进程和集合
func NewQMDManager ¶
func NewQMDManager(config QMDConfig, workspace, agentID string) *QMDManager
NewQMDManager 创建 QMD 管理器
func (*QMDManager) Initialize ¶
func (m *QMDManager) Initialize(ctx context.Context) error
Initialize 初始化 QMD(创建集合)
func (*QMDManager) Query ¶
func (m *QMDManager) Query(ctx context.Context, query string) ([]QMDQueryResult, error)
Query 执行语义搜索
type QMDPathConfig ¶
QMDPathConfig QMD 路径配置
type QMDQueryResult ¶
type QMDQueryResult struct {
Path string `json:"path"`
Line int `json:"line"`
Snippet string `json:"snippet"`
Score float64 `json:"score"`
Collection string `json:"collection"`
}
QMDQueryResult QMD 查询结果
type QMDSessionsConfig ¶
QMDSessionsConfig QMD 会话配置
type QMDStatus ¶
type QMDStatus struct {
Available bool `json:"available"`
Version string `json:"version,omitempty"`
Collections []string `json:"collections,omitempty"`
LastUpdated time.Time `json:"last_updated,omitempty"`
LastEmbed time.Time `json:"last_embed,omitempty"`
IndexedFiles int `json:"indexed_files,omitempty"`
TotalDocuments int `json:"total_documents,omitempty"`
TotalEmbeddings int `json:"total_embeddings,omitempty"`
Error string `json:"error,omitempty"`
FallbackEnabled bool `json:"fallback_enabled"`
}
QMDStatus QMD 状态信息
Click to show internal directories.
Click to hide internal directories.