This commit is contained in:
Ivelin Ivanov 2026-01-30 11:24:42 -05:00 committed by GitHub
commit 69d9e93e7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 9 additions and 0 deletions

View File

@ -208,7 +208,9 @@ const FIELD_LABELS: Record<string, string> = {
"gateway.nodes.browser.mode": "Gateway Node Browser Mode",
"gateway.nodes.browser.node": "Gateway Node Browser Pin",
"gateway.nodes.allowCommands": "Gateway Node Allowlist (Extra Commands)",
"gateway.xaiTools": "Configurable allowlist of Clawdbot tools enabled for xAI/Grok requests in OpenAI gateway (empty enables all).",
"gateway.nodes.denyCommands": "Gateway Node Denylist",
"gateway.xaiTools": "xAI Tools",
"nodeHost.browserProxy.enabled": "Node Browser Proxy Enabled",
"nodeHost.browserProxy.allowProfiles": "Node Browser Proxy Allowed Profiles",
"skills.load.watch": "Watch Skills",

View File

@ -443,6 +443,7 @@ export const OpenClawSchema = z
})
.strict()
.optional(),
xaiTools: z.array(z.string()).optional(),
})
.strict()
.optional(),

View File

@ -16,6 +16,7 @@ import {
writeDone,
} from "./http-common.js";
import { getBearerToken, resolveAgentIdForRequest, resolveSessionKey } from "./http-utils.js";
import { loadConfig } from "../../config/config.js";
type OpenAiHttpOptions = {
auth: ResolvedGatewayAuth;
@ -184,6 +185,9 @@ export async function handleOpenAiHttpRequest(
const model = typeof payload.model === "string" ? payload.model : "openclaw";
const user = typeof payload.user === "string" ? payload.user : undefined;
const cfg = loadConfig();
const isXaiModel = typeof model === "string" && model.startsWith("grok-");
const agentId = resolveAgentIdForRequest({ req, model });
const sessionKey = resolveOpenAiSessionKey({ req, agentId, user });
const prompt = buildAgentPrompt(payload.messages);
@ -211,6 +215,7 @@ export async function handleOpenAiHttpRequest(
deliver: false,
messageChannel: "webchat",
bestEffortDeliver: false,
clientTools: isXaiModel ? cfg.gateway?.xaiTools ?? [] : undefined,
},
defaultRuntime,
deps,
@ -318,6 +323,7 @@ export async function handleOpenAiHttpRequest(
deliver: false,
messageChannel: "webchat",
bestEffortDeliver: false,
clientTools: isXaiModel ? cfg.gateway?.xaiTools ?? [] : undefined,
},
defaultRuntime,
deps,