fix: CI testing error
This commit is contained in:
parent
48a1e979a4
commit
7cdd86df8b
2 changed files with 61 additions and 16 deletions
|
|
@ -6,7 +6,7 @@ import (
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
)
|
)
|
||||||
|
|
||||||
//go:generate cp -r ../../../../workspace .
|
//go:generate bash -lc "rm -rf workspace && cp -r ../../../../workspace ./workspace"
|
||||||
//go:embed workspace
|
//go:embed workspace
|
||||||
var embeddedFiles embed.FS
|
var embeddedFiles embed.FS
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@ package status
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/sipeed/picoclaw/cmd/picoclaw/internal"
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal"
|
||||||
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/cliui"
|
"github.com/sipeed/picoclaw/cmd/picoclaw/internal/cliui"
|
||||||
|
|
@ -39,19 +40,63 @@ func statusCmd() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if configOK {
|
if configOK {
|
||||||
hasOpenRouter := cfg.Providers.OpenRouter.APIKey != ""
|
// PicoClaw moved to a model-centric configuration (model_list). Status should
|
||||||
hasAnthropic := cfg.Providers.Anthropic.APIKey != ""
|
// not depend on a legacy cfg.Providers field (which may not exist under some
|
||||||
hasOpenAI := cfg.Providers.OpenAI.APIKey != ""
|
// build tags). We infer provider availability from model_list entries.
|
||||||
hasGemini := cfg.Providers.Gemini.APIKey != ""
|
hasProtocolKey := func(protocol string) bool {
|
||||||
hasZhipu := cfg.Providers.Zhipu.APIKey != ""
|
prefix := protocol + "/"
|
||||||
hasQwen := cfg.Providers.Qwen.APIKey != ""
|
for _, m := range cfg.ModelList {
|
||||||
hasGroq := cfg.Providers.Groq.APIKey != ""
|
if m == nil {
|
||||||
hasVLLM := cfg.Providers.VLLM.APIBase != ""
|
continue
|
||||||
hasMoonshot := cfg.Providers.Moonshot.APIKey != ""
|
}
|
||||||
hasDeepSeek := cfg.Providers.DeepSeek.APIKey != ""
|
if strings.HasPrefix(m.Model, prefix) && m.APIKey() != "" {
|
||||||
hasVolcEngine := cfg.Providers.VolcEngine.APIKey != ""
|
return true
|
||||||
hasNvidia := cfg.Providers.Nvidia.APIKey != ""
|
}
|
||||||
hasOllama := cfg.Providers.Ollama.APIBase != ""
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
findLocalModelBase := func(modelName string) (string, bool) {
|
||||||
|
for _, m := range cfg.ModelList {
|
||||||
|
if m == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if m.ModelName == modelName && m.APIBase != "" {
|
||||||
|
return m.APIBase, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "", false
|
||||||
|
}
|
||||||
|
findProtocolBase := func(protocol string) (string, bool) {
|
||||||
|
prefix := protocol + "/"
|
||||||
|
for _, m := range cfg.ModelList {
|
||||||
|
if m == nil {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if strings.HasPrefix(m.Model, prefix) && m.APIBase != "" {
|
||||||
|
return m.APIBase, true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return "", false
|
||||||
|
}
|
||||||
|
|
||||||
|
hasOpenRouter := hasProtocolKey("openrouter")
|
||||||
|
hasAnthropic := hasProtocolKey("anthropic")
|
||||||
|
hasOpenAI := hasProtocolKey("openai")
|
||||||
|
hasGemini := hasProtocolKey("gemini")
|
||||||
|
hasZhipu := hasProtocolKey("zhipu")
|
||||||
|
hasQwen := hasProtocolKey("qwen")
|
||||||
|
hasGroq := hasProtocolKey("groq")
|
||||||
|
hasMoonshot := hasProtocolKey("moonshot")
|
||||||
|
hasDeepSeek := hasProtocolKey("deepseek")
|
||||||
|
hasVolcEngine := hasProtocolKey("volcengine")
|
||||||
|
hasNvidia := hasProtocolKey("nvidia")
|
||||||
|
|
||||||
|
// Local endpoints: allow both the special reserved name and protocol-based entries.
|
||||||
|
vllmBase, hasVLLM := findLocalModelBase("local-model")
|
||||||
|
if !hasVLLM {
|
||||||
|
vllmBase, hasVLLM = findProtocolBase("vllm")
|
||||||
|
}
|
||||||
|
ollamaBase, hasOllama := findProtocolBase("ollama")
|
||||||
|
|
||||||
status := func(enabled bool) string {
|
status := func(enabled bool) string {
|
||||||
if enabled {
|
if enabled {
|
||||||
|
|
@ -89,14 +134,14 @@ func statusCmd() {
|
||||||
|
|
||||||
if hasVLLM {
|
if hasVLLM {
|
||||||
report.ProviderNames = append(report.ProviderNames, "vLLM / local")
|
report.ProviderNames = append(report.ProviderNames, "vLLM / local")
|
||||||
report.ProviderVals = append(report.ProviderVals, "✓ "+cfg.Providers.VLLM.APIBase)
|
report.ProviderVals = append(report.ProviderVals, "✓ "+vllmBase)
|
||||||
} else {
|
} else {
|
||||||
report.ProviderNames = append(report.ProviderNames, "vLLM / local")
|
report.ProviderNames = append(report.ProviderNames, "vLLM / local")
|
||||||
report.ProviderVals = append(report.ProviderVals, "not set")
|
report.ProviderVals = append(report.ProviderVals, "not set")
|
||||||
}
|
}
|
||||||
if hasOllama {
|
if hasOllama {
|
||||||
report.ProviderNames = append(report.ProviderNames, "Ollama")
|
report.ProviderNames = append(report.ProviderNames, "Ollama")
|
||||||
report.ProviderVals = append(report.ProviderVals, "✓ "+cfg.Providers.Ollama.APIBase)
|
report.ProviderVals = append(report.ProviderVals, "✓ "+ollamaBase)
|
||||||
} else {
|
} else {
|
||||||
report.ProviderNames = append(report.ProviderNames, "Ollama")
|
report.ProviderNames = append(report.ProviderNames, "Ollama")
|
||||||
report.ProviderVals = append(report.ProviderVals, "not set")
|
report.ProviderVals = append(report.ProviderVals, "not set")
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue