feat: implement runtime reply service and refactor related components

This commit is contained in:
mlogclub
2026-04-12 23:37:52 +08:00
parent 6499126f40
commit 93cda6ae82
9 changed files with 502 additions and 382 deletions
@@ -34,6 +34,10 @@ func NewService() *Service {
}
func (s *Service) Run(ctx context.Context, req Request) (*Summary, error) {
return s.ExecuteRun(ctx, req)
}
func (s *Service) ExecuteRun(ctx context.Context, req RunInput) (*RunResult, error) {
summary := &Summary{
RunID: uuid.NewString(),
Status: "started",
@@ -182,6 +186,10 @@ func (s *Service) Run(ctx context.Context, req Request) (*Summary, error) {
}
func (s *Service) Resume(ctx context.Context, req ResumeRequest) (*Summary, error) {
return s.ExecuteResume(ctx, req)
}
func (s *Service) ExecuteResume(ctx context.Context, req ResumeInput) (*RunResult, error) {
summary := &Summary{
RunID: uuid.NewString(),
Status: "started",
+7 -3
View File
@@ -5,7 +5,7 @@ import (
"cs-agent/internal/models"
)
type Request struct {
type RunInput struct {
Conversation *models.Conversation
UserMessage *models.Message
AIAgent *models.AIAgent
@@ -17,7 +17,7 @@ type Request struct {
ToolSet *registry.ToolSet
}
type ResumeRequest struct {
type ResumeInput struct {
Conversation *models.Conversation
AIAgent *models.AIAgent
AIConfig *models.AIConfig
@@ -32,7 +32,7 @@ type InterruptContextSummary struct {
InfoPreview string `json:"infoPreview,omitempty"`
}
type Summary struct {
type RunResult struct {
RunID string
Status string
ReplyText string
@@ -55,3 +55,7 @@ type Summary struct {
TraceData string
ErrorMessage string
}
type Request = RunInput
type ResumeRequest = ResumeInput
type Summary = RunResult