feat: xAI Grok добавлен в агенты, health timeout 30s
This commit is contained in:
parent
6220e432d4
commit
fdf49b2e79
2 changed files with 7 additions and 5 deletions
|
|
@ -7,13 +7,14 @@ router = APIRouter(prefix="/api/v1/agents", tags=["agents"])
|
|||
|
||||
PROFILES = ["worker-code", "worker-fast", "worker-research", "worker-review"]
|
||||
API_KEY = "sk-a345af809e8a26f0693b9405344edc8adc5b5a96"
|
||||
HEALTH_URL = "http://localhost:20127/v1/chat/completions"
|
||||
PROFILES = ["worker-code", "worker-fast", "worker-research", "worker-review", "grok"]
|
||||
|
||||
MODEL_MAP = {
|
||||
"worker-code": "opencode-go/kimi-k2.7-code",
|
||||
"worker-fast": "opencode-go/kimi-k2.7-code",
|
||||
"worker-research": "opencode-go/kimi-k2.7-code",
|
||||
"worker-review": "opencode-go/kimi-k2.7-code",
|
||||
"grok": "xai/grok-4",
|
||||
}
|
||||
|
||||
def _check_provider(model: str) -> str:
|
||||
|
|
@ -21,7 +22,7 @@ def _check_provider(model: str) -> str:
|
|||
import urllib.request, urllib.error
|
||||
body = json.dumps({"model": model, "messages": [{"role": "user", "content": "Hi"}], "max_tokens": 1, "stream": False}).encode()
|
||||
req = urllib.request.Request(HEALTH_URL, data=body, headers={"Content-Type": "application/json", "Authorization": f"Bearer {API_KEY}"})
|
||||
urllib.request.urlopen(req, timeout=10)
|
||||
urllib.request.urlopen(req, timeout=30)
|
||||
return "ok"
|
||||
except urllib.error.HTTPError as e:
|
||||
return f"http_{e.code}"
|
||||
|
|
|
|||
|
|
@ -26,6 +26,7 @@ export function AgentGrid() {
|
|||
const providerNames: Record<string, string> = {
|
||||
'opencode-go': 'OpenCode Go', 'gemini': 'Google Gemini',
|
||||
'nvidia': 'NVIDIA', 'ollama': 'Ollama', 'cline': 'Cline',
|
||||
'xai': 'xAI Grok',
|
||||
}
|
||||
|
||||
const mapped = Object.entries(raw).map(([id, info]: [string, any], i: number) => {
|
||||
|
|
@ -41,11 +42,11 @@ export function AgentGrid() {
|
|||
runtime: info.model?.split('/')[0] || '?',
|
||||
model: info.model?.split('/').pop() || '?',
|
||||
healthy: info.healthy,
|
||||
cpu: [31, 60, 18, 72][i] || 50,
|
||||
activeRuns: [4, 0, 2, 1][i] || 0,
|
||||
cpu: [31, 60, 18, 72, 45][i] || 50,
|
||||
activeRuns: [4, 0, 2, 1, 3][i] || 0,
|
||||
tokens_used: activeAccs.length > 0 ? 45800 * activeAccs.length : 10000,
|
||||
tokens_limit: 200000,
|
||||
budget_used: [12.4, 42.5, 5.2, 28.0][i] || 20,
|
||||
budget_used: [12.4, 42.5, 5.2, 28.0, 0][i] || 20,
|
||||
budget_limit: 100,
|
||||
provider: providerNames[prov] || prov,
|
||||
account: `${activeAccs.length}/${totalAccs} accounts`,
|
||||
|
|
|
|||
Loading…
Reference in a new issue