mirror of
https://github.com/hansjone/oclaw.git
synced 2026-10-17 06:11:01 +08:00
重构主控编排与运行时预热链路,统一工作区提示词/专家调度协议并补齐 wiki 记忆注入与写回闭环。
同时收敛启动与运维脚本默认行为(含 wiki worker)、更新 Admin 可观测性与相关测试,降低首轮时延并提高运行稳定性。 Made-with: Cursor
This commit is contained in:
parent
4a23b715a2
commit
dbbe3add6a
14438 changed files with 2693620 additions and 2546 deletions
83
openclaw/extensions/fireworks/index.ts
Normal file
83
openclaw/extensions/fireworks/index.ts
Normal file
|
|
@ -0,0 +1,83 @@
|
|||
import type { ProviderResolveDynamicModelContext } from "openclaw/plugin-sdk/plugin-entry";
|
||||
import { defineSingleProviderPluginEntry } from "openclaw/plugin-sdk/provider-entry";
|
||||
import {
|
||||
cloneFirstTemplateModel,
|
||||
DEFAULT_CONTEXT_TOKENS,
|
||||
normalizeModelCompat,
|
||||
OPENAI_COMPATIBLE_REPLAY_HOOKS,
|
||||
} from "openclaw/plugin-sdk/provider-model-shared";
|
||||
import { isFireworksKimiModelId } from "./model-id.js";
|
||||
import { applyFireworksConfig, FIREWORKS_DEFAULT_MODEL_REF } from "./onboard.js";
|
||||
import {
|
||||
buildFireworksProvider,
|
||||
FIREWORKS_BASE_URL,
|
||||
FIREWORKS_DEFAULT_CONTEXT_WINDOW,
|
||||
FIREWORKS_DEFAULT_MAX_TOKENS,
|
||||
FIREWORKS_DEFAULT_MODEL_ID,
|
||||
} from "./provider-catalog.js";
|
||||
import { wrapFireworksProviderStream } from "./stream.js";
|
||||
|
||||
const PROVIDER_ID = "fireworks";
|
||||
function resolveFireworksDynamicModel(ctx: ProviderResolveDynamicModelContext) {
|
||||
const modelId = ctx.modelId.trim();
|
||||
if (!modelId) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
return (
|
||||
cloneFirstTemplateModel({
|
||||
providerId: PROVIDER_ID,
|
||||
modelId,
|
||||
templateIds: [FIREWORKS_DEFAULT_MODEL_ID],
|
||||
ctx,
|
||||
patch: {
|
||||
provider: PROVIDER_ID,
|
||||
reasoning: !isFireworksKimiModelId(modelId),
|
||||
},
|
||||
}) ??
|
||||
normalizeModelCompat({
|
||||
id: modelId,
|
||||
name: modelId,
|
||||
provider: PROVIDER_ID,
|
||||
api: "openai-completions",
|
||||
baseUrl: FIREWORKS_BASE_URL,
|
||||
reasoning: !isFireworksKimiModelId(modelId),
|
||||
input: ["text", "image"],
|
||||
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
|
||||
contextWindow: FIREWORKS_DEFAULT_CONTEXT_WINDOW,
|
||||
maxTokens: FIREWORKS_DEFAULT_MAX_TOKENS || DEFAULT_CONTEXT_TOKENS,
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
export default defineSingleProviderPluginEntry({
|
||||
id: PROVIDER_ID,
|
||||
name: "Fireworks Provider",
|
||||
description: "Bundled Fireworks AI provider plugin",
|
||||
provider: {
|
||||
label: "Fireworks",
|
||||
aliases: ["fireworks-ai"],
|
||||
docsPath: "/providers/fireworks",
|
||||
auth: [
|
||||
{
|
||||
methodId: "api-key",
|
||||
label: "Fireworks API key",
|
||||
hint: "API key",
|
||||
optionKey: "fireworksApiKey",
|
||||
flagName: "--fireworks-api-key",
|
||||
envVar: "FIREWORKS_API_KEY",
|
||||
promptMessage: "Enter Fireworks API key",
|
||||
defaultModel: FIREWORKS_DEFAULT_MODEL_REF,
|
||||
applyConfig: (cfg) => applyFireworksConfig(cfg),
|
||||
},
|
||||
],
|
||||
catalog: {
|
||||
buildProvider: buildFireworksProvider,
|
||||
allowExplicitBaseUrl: true,
|
||||
},
|
||||
...OPENAI_COMPATIBLE_REPLAY_HOOKS,
|
||||
wrapStreamFn: wrapFireworksProviderStream,
|
||||
resolveDynamicModel: (ctx) => resolveFireworksDynamicModel(ctx),
|
||||
isModernModelRef: () => true,
|
||||
},
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue