chore: final stabilization fixes for security_shield after rebase
This commit is contained in:
parent
fbeb8121fb
commit
24e746028b
5 changed files with 12 additions and 5 deletions
|
|
@ -34,12 +34,12 @@ func (c *HTTPChannel) Stop(ctx context.Context) error {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *HTTPChannel) Send(ctx context.Context, msg bus.OutboundMessage) error {
|
func (c *HTTPChannel) Send(ctx context.Context, msg bus.OutboundMessage) ([]string, error) {
|
||||||
logger.InfoCF("channels", "HTTP channel received outbound message", map[string]any{
|
logger.InfoCF("channels", "HTTP channel received outbound message", map[string]any{
|
||||||
"chat_id": msg.ChatID,
|
"chat_id": msg.ChatID,
|
||||||
"content": msg.Content,
|
"content": msg.Content,
|
||||||
})
|
})
|
||||||
// For synchronous HTTP, the response is usually handled by the caller of ProcessDirectWithChannel.
|
// For synchronous HTTP, the response is usually handled by the caller of ProcessDirectWithChannel.
|
||||||
// Asynchronous messages (e.g. from subagents) will just be logged here for now.
|
// Asynchronous messages (e.g. from subagents) will just be logged here for now.
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -539,7 +539,7 @@ func mergeAPIKeys(apiKey string, apiKeys []string) []string {
|
||||||
seen := make(map[string]struct{})
|
seen := make(map[string]struct{})
|
||||||
var all []string
|
var all []string
|
||||||
|
|
||||||
if k := strings.TrimSpace(apiKey); k != "" {
|
if k := strings.TrimSpace(apiKey); k != "" && k != "[NOT_HERE]" {
|
||||||
if _, exists := seen[k]; !exists {
|
if _, exists := seen[k]; !exists {
|
||||||
seen[k] = struct{}{}
|
seen[k] = struct{}{}
|
||||||
all = append(all, k)
|
all = append(all, k)
|
||||||
|
|
@ -547,7 +547,7 @@ func mergeAPIKeys(apiKey string, apiKeys []string) []string {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, k := range apiKeys {
|
for _, k := range apiKeys {
|
||||||
if trimmed := strings.TrimSpace(k); trimmed != "" {
|
if trimmed := strings.TrimSpace(k); trimmed != "" && trimmed != "[NOT_HERE]" {
|
||||||
if _, exists := seen[trimmed]; !exists {
|
if _, exists := seen[trimmed]; !exists {
|
||||||
seen[trimmed] = struct{}{}
|
seen[trimmed] = struct{}{}
|
||||||
all = append(all, trimmed)
|
all = append(all, trimmed)
|
||||||
|
|
|
||||||
|
|
@ -272,9 +272,14 @@ func (s *Server) readyHandler(w http.ResponseWriter, r *http.Request) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// HandlerMux defines the interface for an HTTP request multiplexer.
|
||||||
|
type HandlerMux interface {
|
||||||
|
HandleFunc(pattern string, handler func(http.ResponseWriter, *http.Request))
|
||||||
|
}
|
||||||
|
|
||||||
// RegisterOnMux registers /health, /ready, /reload and /chat handlers onto the
|
// RegisterOnMux registers /health, /ready, /reload and /chat handlers onto the
|
||||||
// given mux. This allows the health endpoints to be served by a shared HTTP server.
|
// given mux. This allows the health endpoints to be served by a shared HTTP server.
|
||||||
func (s *Server) RegisterOnMux(mux Mux) {
|
func (s *Server) RegisterOnMux(mux HandlerMux) {
|
||||||
mux.HandleFunc("/health", s.healthHandler)
|
mux.HandleFunc("/health", s.healthHandler)
|
||||||
mux.HandleFunc("/ready", s.readyHandler)
|
mux.HandleFunc("/ready", s.readyHandler)
|
||||||
mux.HandleFunc("/reload", s.reloadHandler)
|
mux.HandleFunc("/reload", s.reloadHandler)
|
||||||
|
|
|
||||||
|
|
@ -222,6 +222,7 @@ func CreateProviderFromConfig(cfg *config.ModelConfig) (LLMProvider, string, err
|
||||||
"vivgrid", "volcengine", "vllm", "qwen", "qwen-intl", "qwen-international", "dashscope-intl",
|
"vivgrid", "volcengine", "vllm", "qwen", "qwen-intl", "qwen-international", "dashscope-intl",
|
||||||
"qwen-us", "dashscope-us", "mistral", "avian", "longcat", "modelscope", "novita",
|
"qwen-us", "dashscope-us", "mistral", "avian", "longcat", "modelscope", "novita",
|
||||||
"coding-plan", "alibaba-coding", "qwen-coding", "mimo":
|
"coding-plan", "alibaba-coding", "qwen-coding", "mimo":
|
||||||
|
|
||||||
// All other OpenAI-compatible HTTP providers
|
// All other OpenAI-compatible HTTP providers
|
||||||
if cfg.APIKey() == "" && cfg.APIBase == "" && !isEmptyAPIKeyAllowed(protocol) {
|
if cfg.APIKey() == "" && cfg.APIBase == "" && !isEmptyAPIKeyAllowed(protocol) {
|
||||||
return nil, "", fmt.Errorf("api_key or api_base is required for HTTP-based protocol %q", protocol)
|
return nil, "", fmt.Errorf("api_key or api_base is required for HTTP-based protocol %q", protocol)
|
||||||
|
|
|
||||||
|
|
@ -610,6 +610,7 @@ func findWorkspaceSkillByDirectory(cfg *config.Config, directory string) *skillS
|
||||||
|
|
||||||
func findWorkspaceSkillInfoByDirectory(workspace, directory string) *skills.SkillInfo {
|
func findWorkspaceSkillInfoByDirectory(workspace, directory string) *skills.SkillInfo {
|
||||||
loader := skills.NewSkillsLoader(workspace, "", "", "", nil, false)
|
loader := skills.NewSkillsLoader(workspace, "", "", "", nil, false)
|
||||||
|
|
||||||
for _, skill := range loader.ListSkills() {
|
for _, skill := range loader.ListSkills() {
|
||||||
if skill.Source != "workspace" {
|
if skill.Source != "workspace" {
|
||||||
continue
|
continue
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue