71f0a1abdb
- 所有Go模块路径从 github.com/yourname/cyrene-ai 迁移到 git.yeij.top/AskaEth/Cyrene - 5个Go Dockerfile添加 GOPROXY=https://goproxy.cn,direct 解决国内构建问题 - ai-core go.mod 添加 pkg/plugins replace 指令 - Caddyfile 简化为 http:// 通配 + handle 保留 /api 前缀 - ethend Dockerfile 适配 (npm install + 仅 COPY package.json) - ethend 新增 RUNNING_IN_DOCKER 环境变量,健康检查改用Docker服务名 - ethend 数据库状态检查支持Docker hostname (postgres/redis/qdrant/minio) - process-manager 新增 CONTAINER_SVC_MAP + Docker模式自动检测 - 统一 docker-compose.dev.db.yml 卷名 (pg_data/redis_data/qdrant_data/minio_data) - docker-compose.yml ethend服务挂载docker.sock + 端口变量化 - 清理 .env 统一后的残留文件与提示信息 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
52 lines
1.6 KiB
Go
52 lines
1.6 KiB
Go
package subsession
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.yeij.top/AskaEth/Cyrene/ai-core/internal/llm"
|
|
"git.yeij.top/AskaEth/Cyrene/ai-core/internal/model"
|
|
"git.yeij.top/AskaEth/Cyrene/ai-core/internal/persona"
|
|
)
|
|
|
|
// Provider 子会话提供者接口
|
|
// 每种子会话类型实现此接口
|
|
type Provider interface {
|
|
// Type 返回子会话类型标识
|
|
Type() model.SubSessionType
|
|
|
|
// CanHandle 判断是否需要为此消息创建子会话
|
|
CanHandle(ctx context.Context, intent *model.IntentResult, userMessage string) bool
|
|
|
|
// Priority 返回优先级 (数字越小优先级越高)
|
|
Priority() int
|
|
|
|
// CreateContext 创建子会话的 LLM 上下文
|
|
// 不包含对话历史(历史由 Orchestrator 统一管理)
|
|
CreateContext(ctx context.Context, params CreateContextParams) ([]model.LLMMessage, error)
|
|
|
|
// Timeout 返回此子会话的超时时间
|
|
Timeout() time.Duration
|
|
|
|
// Execute 执行子会话逻辑,返回结果
|
|
// 子会话可以调用 LLM、执行工具调用等
|
|
Execute(ctx context.Context, subCtx []model.LLMMessage) (*model.SubSessionResult, error)
|
|
}
|
|
|
|
// CreateContextParams 创建上下文参数
|
|
type CreateContextParams struct {
|
|
UserID string
|
|
SessionID string
|
|
UserMessage string
|
|
PersonaConfig *persona.PersonaConfig
|
|
DeviceContext string // IoT 设备状态文本
|
|
Intent *model.IntentResult
|
|
Nickname string // 用户昵称
|
|
}
|
|
|
|
// LLMClient LLM 调用接口(避免循环依赖)
|
|
type LLMClient interface {
|
|
Chat(ctx context.Context, messages []model.LLMMessage) (*model.LLMResponse, error)
|
|
ChatWithTools(ctx context.Context, messages []model.LLMMessage, tools []llm.OpenAITool) (*model.LLMResponse, error)
|
|
}
|