feat: 将 ofcx-go backend 收敛为 dsflash-go
This commit is contained in:
@@ -122,7 +122,7 @@ export async function setProviderProfileConfig(profileValue: string, body: unkno
|
||||
configHashSuffix: shortHash(configToml),
|
||||
updatedAt: objectPath(applied, ["metadata", "annotations", `${credentialAnnotationPrefix}-updated-at`]) ?? new Date().toISOString(),
|
||||
delegatedBy,
|
||||
requiresExternalBridgeUpdate: profile === "deepseek",
|
||||
requiresExternalBridgeUpdate: profile === "deepseek" || profile === "dsflash-go",
|
||||
configTomlPrinted: false,
|
||||
credentialValuesPrinted: false,
|
||||
valuesPrinted: false,
|
||||
@@ -180,7 +180,7 @@ export async function setProviderProfileCredential(profileValue: string, body: u
|
||||
updatedAt: objectPath(applied, ["metadata", "annotations", `${credentialAnnotationPrefix}-updated-at`]) ?? new Date().toISOString(),
|
||||
configSummary: rendered.config.configSummary,
|
||||
delegatedBy,
|
||||
requiresExternalBridgeUpdate: profile === "deepseek",
|
||||
requiresExternalBridgeUpdate: profile === "deepseek" || profile === "dsflash-go",
|
||||
valuesPrinted: false,
|
||||
pollCommands: {
|
||||
show: `./scripts/agentrun provider-profiles show ${profile}`,
|
||||
@@ -297,14 +297,15 @@ function authPayload(apiKey: string): JsonRecord {
|
||||
}
|
||||
|
||||
function renderConfigToml(config: ProfileConfig): string {
|
||||
const { contextWindow, autoCompactTokenLimit } = contextWindowSettings(config.model);
|
||||
return [
|
||||
`model_provider = ${tomlString(config.providerName)}`,
|
||||
`model = ${tomlString(config.model)}`,
|
||||
`review_model = ${tomlString(config.model)}`,
|
||||
"disable_response_storage = true",
|
||||
"network_access = \"enabled\"",
|
||||
"model_context_window = 128000",
|
||||
"model_auto_compact_token_limit = 110000",
|
||||
`model_context_window = ${contextWindow}`,
|
||||
`model_auto_compact_token_limit = ${autoCompactTokenLimit}`,
|
||||
"approvals_reviewer = \"user\"",
|
||||
"",
|
||||
`[model_providers.${config.providerName}]`,
|
||||
@@ -368,8 +369,8 @@ async function existingConfigToml(profile: BackendProfile, options: ProviderProf
|
||||
|
||||
function existingConfigAllowed(profile: BackendProfile, configToml: string): boolean {
|
||||
if (configToml.trim().length === 0) return false;
|
||||
if (profile === "deepseek" && configToml.includes("hyueapi.com")) return false;
|
||||
if (profile === "deepseek" && !configToml.includes("hwlab-deepseek-proxy.hwlab-v02.svc.cluster.local")) return false;
|
||||
if ((profile === "deepseek" || profile === "dsflash-go") && configToml.includes("hyueapi.com")) return false;
|
||||
if ((profile === "deepseek" || profile === "dsflash-go") && !configToml.includes("hwlab-deepseek-proxy.hwlab-v02.svc.cluster.local")) return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -414,7 +415,7 @@ function defaultConfig(profile: BackendProfile): ProfileConfig {
|
||||
displayName: "OpenAI",
|
||||
};
|
||||
}
|
||||
if (profile === "ofcx-go") {
|
||||
if (profile === "dsflash-go") {
|
||||
return {
|
||||
model: "deepseek-v4-flash",
|
||||
providerName: "opencode",
|
||||
@@ -451,14 +452,21 @@ function validateBaseUrl(profile: BackendProfile, value: string): void {
|
||||
} catch {
|
||||
throw new AgentRunError("schema-invalid", "config.baseUrl must be a valid URL", { httpStatus: 400 });
|
||||
}
|
||||
if (profile === "deepseek" && url.hostname === "hyueapi.com") {
|
||||
throw new AgentRunError("tenant-policy-denied", "deepseek profile must use HWLAB Moon Bridge, not hyueapi.com", { httpStatus: 403 });
|
||||
if ((profile === "deepseek" || profile === "dsflash-go") && url.hostname === "hyueapi.com") {
|
||||
throw new AgentRunError("tenant-policy-denied", `${profile} profile must use HWLAB Moon Bridge, not hyueapi.com`, { httpStatus: 403 });
|
||||
}
|
||||
if (profile === "deepseek" && url.hostname !== "hwlab-deepseek-proxy.hwlab-v02.svc.cluster.local") {
|
||||
throw new AgentRunError("tenant-policy-denied", "deepseek profile baseUrl must point to HWLAB v0.2 Moon Bridge", { httpStatus: 403 });
|
||||
if ((profile === "deepseek" || profile === "dsflash-go") && url.hostname !== "hwlab-deepseek-proxy.hwlab-v02.svc.cluster.local") {
|
||||
throw new AgentRunError("tenant-policy-denied", `${profile} profile baseUrl must point to HWLAB v0.2 Moon Bridge`, { httpStatus: 403 });
|
||||
}
|
||||
}
|
||||
|
||||
function contextWindowSettings(model: string): { contextWindow: number; autoCompactTokenLimit: number } {
|
||||
if (model === "deepseek-v4-pro" || model === "deepseek-v4-flash") {
|
||||
return { contextWindow: 1_000_000, autoCompactTokenLimit: 900_000 };
|
||||
}
|
||||
return { contextWindow: 200_000, autoCompactTokenLimit: 180_000 };
|
||||
}
|
||||
|
||||
function validationExecutionPolicy(profile: BackendProfile, namespace: string): ExecutionPolicy {
|
||||
const spec = requiredSpec(profile);
|
||||
return {
|
||||
|
||||
Reference in New Issue
Block a user