mirror of
https://git.boos.lat/aibo/BossChat.git
synced 2026-10-30 23:26:09 +00:00
0f40930a41
- Rename Go module: cs-agent → bosschat - Rename all import paths across 200+ Go files - Rename SDK: cs-ai-agent-sdk → bosschat-sdk - Rename message protocol: cs-agent:* → bosschat:* - Rename JS globals: CSAgentConfig → BossChatConfig - Rename CSS classes: cs-agent-* → bosschat-* - Update Makefile APP_NAME and ARCHIVE_NAME - Update logo assets - Fix display name: BoosChat → BossChat
54 lines
1.7 KiB
Go
54 lines
1.7 KiB
Go
package services
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"strings"
|
|
|
|
"bosschat/internal/pkg/dto/request"
|
|
"bosschat/internal/pkg/dto/response"
|
|
"bosschat/internal/pkg/errorsx"
|
|
)
|
|
|
|
var SkillRuntimeService = newSkillRuntimeService()
|
|
var SkillDebugRunHook func(ctx context.Context, req request.SkillDebugRunRequest) (*response.SkillDebugRunResponse, error)
|
|
var SkillDebugResumeHook func(ctx context.Context, req request.SkillDebugResumeRequest) (*response.SkillDebugRunResponse, error)
|
|
|
|
func newSkillRuntimeService() *skillRuntimeService {
|
|
return &skillRuntimeService{}
|
|
}
|
|
|
|
type skillRuntimeService struct{}
|
|
|
|
func (s *skillRuntimeService) DebugRun(ctx context.Context, req request.SkillDebugRunRequest) (*response.SkillDebugRunResponse, error) {
|
|
if req.AIAgentID <= 0 {
|
|
return nil, errorsx.InvalidParam("aiAgentId不能为空")
|
|
}
|
|
if strings.TrimSpace(req.SkillCode) == "" {
|
|
return nil, errorsx.InvalidParam("skillCode不能为空")
|
|
}
|
|
if strings.TrimSpace(req.UserMessage) == "" {
|
|
return nil, errorsx.InvalidParam("userMessage不能为空")
|
|
}
|
|
if SkillDebugRunHook == nil {
|
|
return nil, fmt.Errorf("skill debug runner is not initialized")
|
|
}
|
|
return SkillDebugRunHook(ctx, req)
|
|
}
|
|
|
|
func (s *skillRuntimeService) DebugResume(ctx context.Context, req request.SkillDebugResumeRequest) (*response.SkillDebugRunResponse, error) {
|
|
if req.AIAgentID <= 0 {
|
|
return nil, errorsx.InvalidParam("aiAgentId不能为空")
|
|
}
|
|
if strings.TrimSpace(req.CheckPointID) == "" {
|
|
return nil, errorsx.InvalidParam("checkPointId不能为空")
|
|
}
|
|
if strings.TrimSpace(req.UserMessage) == "" {
|
|
return nil, errorsx.InvalidParam("userMessage不能为空")
|
|
}
|
|
if SkillDebugResumeHook == nil {
|
|
return nil, fmt.Errorf("skill debug resume runner is not initialized")
|
|
}
|
|
return SkillDebugResumeHook(ctx, req)
|
|
}
|