fix: config improvements
This commit is contained in:
parent
a6422c51aa
commit
e91a8a20a1
1 changed files with 8 additions and 2 deletions
|
|
@ -24,9 +24,15 @@ export async function initConfig(old: AppConfig | null): Promise<AppConfig> {
|
||||||
const models = await getModels(baseURL);
|
const models = await getModels(baseURL);
|
||||||
const model = await autocomplete({
|
const model = await autocomplete({
|
||||||
message: "Choose a default model:",
|
message: "Choose a default model:",
|
||||||
initialValue: old?.model,
|
initialValue: old?.model ?? models[0]?.value,
|
||||||
placeholder: old?.model,
|
placeholder: old?.model ?? models[0]?.value,
|
||||||
options: models,
|
options: models,
|
||||||
|
validate: (value) =>
|
||||||
|
models
|
||||||
|
.map((model) => model.value)
|
||||||
|
.includes(typeof value === "string" ? value : "")
|
||||||
|
? undefined
|
||||||
|
: `Unable to find model "${value}"`,
|
||||||
});
|
});
|
||||||
if (isCancel(model)) process.exit(1);
|
if (isCancel(model)) process.exit(1);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue