Files
Agent-System-Backend/internal/app/tavily_keys.go
T
agent-exec-transport 2182a51aa1
governance / governance (pull_request) Successful in 18s
ci / vet-and-test (pull_request) Successful in 1m15s
agent-exec transport ed457bf5f823c43a1d72b50b1f3cfeef/8e408ea19f4b
2026-10-19 09:24:43 +00:00

24 lines
715 B
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package app
import (
"agent-system-backend/internal/settings"
"agent-system-backend/internal/store"
)
const tavilySecretService = "tools.tavily"
type activeSecretSource interface {
ActiveSecret(owner, service string) (string, bool)
}
// tavilyKeyPool 解析 Tavily 密钥池:默认属主受管密钥 → 系统行受管密钥
// (owner=settings.OwnerSystemRow)→ 设置明文 tools.tavily.apiKeys。
func tavilyKeyPool(secrets activeSecretSource, plaintext string) []string {
for _, owner := range []string{store.OwnerDefault, settings.OwnerSystemRow} {
if active, ok := secrets.ActiveSecret(owner, tavilySecretService); ok {
return splitKeyPool(active)
}
}
return splitKeyPool(plaintext)
}