fix: stabilize venice model discovery
This commit is contained in:
@@ -12,12 +12,7 @@ import {
|
|||||||
SYNTHETIC_BASE_URL,
|
SYNTHETIC_BASE_URL,
|
||||||
SYNTHETIC_MODEL_CATALOG,
|
SYNTHETIC_MODEL_CATALOG,
|
||||||
} from "./synthetic-models.js";
|
} from "./synthetic-models.js";
|
||||||
import {
|
import { discoverVeniceModels, VENICE_BASE_URL } from "./venice-models.js";
|
||||||
buildVeniceModelDefinition,
|
|
||||||
discoverVeniceModels,
|
|
||||||
VENICE_BASE_URL,
|
|
||||||
VENICE_MODEL_CATALOG,
|
|
||||||
} from "./venice-models.js";
|
|
||||||
|
|
||||||
type ModelsConfig = NonNullable<ClawdbotConfig["models"]>;
|
type ModelsConfig = NonNullable<ClawdbotConfig["models"]>;
|
||||||
export type ProviderConfig = NonNullable<ModelsConfig["providers"]>[string];
|
export type ProviderConfig = NonNullable<ModelsConfig["providers"]>[string];
|
||||||
|
|||||||
@@ -340,7 +340,9 @@ export async function discoverVeniceModels(): Promise<ModelDefinitionConfig[]> {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
console.warn(`[venice-models] Failed to discover models: HTTP ${response.status}, using static catalog`);
|
console.warn(
|
||||||
|
`[venice-models] Failed to discover models: HTTP ${response.status}, using static catalog`,
|
||||||
|
);
|
||||||
return VENICE_MODEL_CATALOG.map(buildVeniceModelDefinition);
|
return VENICE_MODEL_CATALOG.map(buildVeniceModelDefinition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -351,7 +353,9 @@ export async function discoverVeniceModels(): Promise<ModelDefinitionConfig[]> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Merge discovered models with catalog metadata
|
// Merge discovered models with catalog metadata
|
||||||
const catalogById = new Map(VENICE_MODEL_CATALOG.map((m) => [m.id, m]));
|
const catalogById = new Map<string, VeniceCatalogEntry>(
|
||||||
|
VENICE_MODEL_CATALOG.map((m) => [m.id, m]),
|
||||||
|
);
|
||||||
const models: ModelDefinitionConfig[] = [];
|
const models: ModelDefinitionConfig[] = [];
|
||||||
|
|
||||||
for (const apiModel of data.data) {
|
for (const apiModel of data.data) {
|
||||||
|
|||||||
@@ -353,9 +353,7 @@ export function applyVeniceProviderConfig(cfg: ClawdbotConfig): ClawdbotConfig {
|
|||||||
const veniceModels = VENICE_MODEL_CATALOG.map(buildVeniceModelDefinition);
|
const veniceModels = VENICE_MODEL_CATALOG.map(buildVeniceModelDefinition);
|
||||||
const mergedModels = [
|
const mergedModels = [
|
||||||
...existingModels,
|
...existingModels,
|
||||||
...veniceModels.filter(
|
...veniceModels.filter((model) => !existingModels.some((existing) => existing.id === model.id)),
|
||||||
(model) => !existingModels.some((existing) => existing.id === model.id),
|
|
||||||
),
|
|
||||||
];
|
];
|
||||||
const { apiKey: existingApiKey, ...existingProviderRest } = (existingProvider ?? {}) as Record<
|
const { apiKey: existingApiKey, ...existingProviderRest } = (existingProvider ?? {}) as Record<
|
||||||
string,
|
string,
|
||||||
|
|||||||
@@ -2,10 +2,7 @@ export {
|
|||||||
SYNTHETIC_DEFAULT_MODEL_ID,
|
SYNTHETIC_DEFAULT_MODEL_ID,
|
||||||
SYNTHETIC_DEFAULT_MODEL_REF,
|
SYNTHETIC_DEFAULT_MODEL_REF,
|
||||||
} from "../agents/synthetic-models.js";
|
} from "../agents/synthetic-models.js";
|
||||||
export {
|
export { VENICE_DEFAULT_MODEL_ID, VENICE_DEFAULT_MODEL_REF } from "../agents/venice-models.js";
|
||||||
VENICE_DEFAULT_MODEL_ID,
|
|
||||||
VENICE_DEFAULT_MODEL_REF,
|
|
||||||
} from "../agents/venice-models.js";
|
|
||||||
export {
|
export {
|
||||||
applyAuthProfileConfig,
|
applyAuthProfileConfig,
|
||||||
applyKimiCodeConfig,
|
applyKimiCodeConfig,
|
||||||
|
|||||||
Reference in New Issue
Block a user