feat(chat): expose model options config
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
import { config } from "../config.js";
|
||||
import {
|
||||
getAgentModelIds,
|
||||
parseAgentModelOptions,
|
||||
type SupportedModel,
|
||||
} from "./modelConfig.js";
|
||||
|
||||
export {
|
||||
type AgentModelIcon,
|
||||
type AgentModelOption,
|
||||
type SupportedModel,
|
||||
} from "./modelConfig.js";
|
||||
|
||||
export const agentModelOptions = parseAgentModelOptions(
|
||||
config.OPENCODE_MODEL_OPTIONS,
|
||||
);
|
||||
|
||||
export const supportedModels = getAgentModelIds(agentModelOptions);
|
||||
|
||||
export const isSupportedModel = (model: string): model is SupportedModel =>
|
||||
supportedModels.includes(model);
|
||||
|
||||
export const resolveDefaultModel = (model: string): SupportedModel => {
|
||||
if (!isSupportedModel(model)) {
|
||||
throw new Error(`unsupported default agent model: ${model}`);
|
||||
}
|
||||
return model;
|
||||
};
|
||||
Reference in New Issue
Block a user