Files
Atlas/internal/domain/invoke.go
T
renjue 5301557ad2
CI / docker (push) Has been cancelled
实现 Atlas AI 平台一期能力并完成品牌化改造。
引入用户端对话/生图与管理端 Provider 配置,统一 invoke 编排、Gateway、请求日志与模型管理;前端按设计规范拆分布局,Go module 更名为 github.com/rose_cat707/Atlas;生图长任务 SSE 推送;管理端登录防爆破;协议与服务类型联动;Replicate 模型同步修复;用户端创作台 UI 重构;管理端创作历史替代请求日志。

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-06-29 22:11:05 +08:00

53 lines
1.3 KiB
Go

package domain
import "encoding/json"
type ServiceType string
const (
ServiceChat ServiceType = "chat"
ServiceTextToImage ServiceType = "text_to_image"
ServiceImageToImage ServiceType = "image_to_image"
)
type InvokeMode string
const (
ModeStream InvokeMode = "stream"
ModeSync InvokeMode = "sync"
ModeAsync InvokeMode = "async"
)
type InvokeContext struct {
ConversationID int64 `json:"conversation_id,omitempty"`
Messages []ChatMessage `json:"messages,omitempty"`
}
type ChatMessage struct {
Role string `json:"role"`
Content string `json:"content"`
}
type InvokeRequest struct {
SessionID string `json:"session_id"`
ServiceType ServiceType `json:"service_type"`
ProviderID int64 `json:"provider_id,omitempty"`
Model string `json:"model"`
Params json.RawMessage `json:"params"`
Mode InvokeMode `json:"mode"`
Context *InvokeContext `json:"context,omitempty"`
}
type StreamChunk struct {
Delta string `json:"delta"`
Done bool `json:"done"`
Error string `json:"error,omitempty"`
}
type InvokeResult struct {
GenerationID int64 `json:"generation_id,omitempty"`
TaskID *int64 `json:"task_id,omitempty"`
Output json.RawMessage `json:"output,omitempty"`
Stream <-chan StreamChunk `json:"-"`
}