Merge 66fb1c899c into 09be5d45d5
This commit is contained in:
commit
69d9e93e7a
@ -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",
|
||||
|
||||
@ -443,6 +443,7 @@ export const OpenClawSchema = z
|
||||
})
|
||||
.strict()
|
||||
.optional(),
|
||||
xaiTools: z.array(z.string()).optional(),
|
||||
})
|
||||
.strict()
|
||||
.optional(),
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user