mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-20 21:51:28 +00:00
Merge branch 'main' into val/plugin-runtime-dist-symlink-and-config-ui
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import type { OpenAICompletionsCompat } from "@mariozechner/pi-ai";
|
||||
import type { SecretInput } from "./types.secrets.js";
|
||||
|
||||
export const MODEL_APIS = [
|
||||
@@ -13,21 +14,25 @@ export const MODEL_APIS = [
|
||||
|
||||
export type ModelApi = (typeof MODEL_APIS)[number];
|
||||
|
||||
export type ModelCompatConfig = {
|
||||
supportsStore?: boolean;
|
||||
supportsDeveloperRole?: boolean;
|
||||
supportsReasoningEffort?: boolean;
|
||||
supportsUsageInStreaming?: boolean;
|
||||
type SupportedOpenAICompatFields = Pick<
|
||||
OpenAICompletionsCompat,
|
||||
| "supportsStore"
|
||||
| "supportsDeveloperRole"
|
||||
| "supportsReasoningEffort"
|
||||
| "supportsUsageInStreaming"
|
||||
| "supportsStrictMode"
|
||||
| "maxTokensField"
|
||||
| "thinkingFormat"
|
||||
| "requiresToolResultName"
|
||||
| "requiresAssistantAfterToolResult"
|
||||
| "requiresThinkingAsText"
|
||||
>;
|
||||
|
||||
export type ModelCompatConfig = SupportedOpenAICompatFields & {
|
||||
supportsTools?: boolean;
|
||||
supportsStrictMode?: boolean;
|
||||
toolSchemaProfile?: "xai";
|
||||
nativeWebSearchTool?: boolean;
|
||||
toolCallArgumentsEncoding?: "html-entities";
|
||||
maxTokensField?: "max_completion_tokens" | "max_tokens";
|
||||
thinkingFormat?: "openai" | "zai" | "qwen";
|
||||
requiresToolResultName?: boolean;
|
||||
requiresAssistantAfterToolResult?: boolean;
|
||||
requiresThinkingAsText?: boolean;
|
||||
requiresMistralToolIds?: boolean;
|
||||
requiresOpenAiAnthropicToolPayload?: boolean;
|
||||
};
|
||||
|
||||
@@ -6,6 +6,7 @@ import {
|
||||
isValidExecSecretRefId,
|
||||
isValidFileSecretRefId,
|
||||
} from "../secrets/ref-contract.js";
|
||||
import type { ModelCompatConfig } from "./types.models.js";
|
||||
import { MODEL_APIS } from "./types.models.js";
|
||||
import { createAllowDenyChannelRulesSchema } from "./zod-schema.allowdeny.js";
|
||||
import { sensitive } from "./zod-schema.sensitive.js";
|
||||
@@ -191,16 +192,36 @@ export const ModelCompatSchema = z
|
||||
maxTokensField: z
|
||||
.union([z.literal("max_completion_tokens"), z.literal("max_tokens")])
|
||||
.optional(),
|
||||
thinkingFormat: z.union([z.literal("openai"), z.literal("zai"), z.literal("qwen")]).optional(),
|
||||
thinkingFormat: z
|
||||
.union([
|
||||
z.literal("openai"),
|
||||
z.literal("zai"),
|
||||
z.literal("qwen"),
|
||||
z.literal("qwen-chat-template"),
|
||||
])
|
||||
.optional(),
|
||||
requiresToolResultName: z.boolean().optional(),
|
||||
requiresAssistantAfterToolResult: z.boolean().optional(),
|
||||
requiresThinkingAsText: z.boolean().optional(),
|
||||
toolSchemaProfile: z.literal("xai").optional(),
|
||||
nativeWebSearchTool: z.boolean().optional(),
|
||||
toolCallArgumentsEncoding: z.literal("html-entities").optional(),
|
||||
requiresMistralToolIds: z.boolean().optional(),
|
||||
requiresOpenAiAnthropicToolPayload: z.boolean().optional(),
|
||||
})
|
||||
.strict()
|
||||
.optional();
|
||||
|
||||
type AssertAssignable<_T extends U, U> = true;
|
||||
type _ModelCompatSchemaAssignableToType = AssertAssignable<
|
||||
z.infer<typeof ModelCompatSchema>,
|
||||
ModelCompatConfig | undefined
|
||||
>;
|
||||
type _ModelCompatTypeAssignableToSchema = AssertAssignable<
|
||||
ModelCompatConfig | undefined,
|
||||
z.infer<typeof ModelCompatSchema>
|
||||
>;
|
||||
|
||||
export const ModelDefinitionSchema = z
|
||||
.object({
|
||||
id: z.string().min(1),
|
||||
|
||||
Reference in New Issue
Block a user