TUI: filter model picker to allowlisted models
This commit is contained in:
@@ -1,3 +1,6 @@
|
||||
import { DEFAULT_PROVIDER } from "../../agents/defaults.js";
|
||||
import { buildAllowedModelSet } from "../../agents/model-selection.js";
|
||||
import { loadConfig } from "../../config/config.js";
|
||||
import {
|
||||
ErrorCodes,
|
||||
errorShape,
|
||||
@@ -20,7 +23,14 @@ export const modelsHandlers: GatewayRequestHandlers = {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const models = await context.loadGatewayModelCatalog();
|
||||
const catalog = await context.loadGatewayModelCatalog();
|
||||
const cfg = loadConfig();
|
||||
const { allowedCatalog } = buildAllowedModelSet({
|
||||
cfg,
|
||||
catalog,
|
||||
defaultProvider: DEFAULT_PROVIDER,
|
||||
});
|
||||
const models = allowedCatalog.length > 0 ? allowedCatalog : catalog;
|
||||
respond(true, { models }, undefined);
|
||||
} catch (err) {
|
||||
respond(false, undefined, errorShape(ErrorCodes.UNAVAILABLE, String(err)));
|
||||
|
||||
Reference in New Issue
Block a user