fix: model saving

This commit is contained in:
mitchell 2026-05-03 01:47:10 -04:00
parent 57acb09a18
commit 79fd0a93eb

View file

@ -24,15 +24,17 @@ const { values: args, positionals } = parseArgs({
}); });
async function main() { async function main() {
const config = await loadConfig();
const newConvo = args.new ?? args.n; const newConvo = args.new ?? args.n;
const plainOut = args.plainOut ?? args.plain ?? !process.stdout.isTTY; const plainOut = args.plainOut ?? args.plain ?? !process.stdout.isTTY;
const plainErr = args.plainErr ?? args.plain ?? !process.stderr.isTTY; const plainErr = args.plainErr ?? args.plain ?? !process.stderr.isTTY;
const modelFlag = args.model ?? args.m; const modelFlag = args.model ?? args.m;
const saveConfigFlag = args.save ?? args.s; const saveConfigFlag = args.save ?? args.s;
const config = await loadConfig(); const model = modelFlag ?? config.model;
if (!config.model) { if (!model) {
console.error( console.error(
"Please run 'lmc --model <model> --save' to set a default model.", "Please run 'lmc --model <model> --save' to set a default model.",
); );
@ -54,7 +56,7 @@ async function main() {
includeUsage: true, // Include usage information in streaming responses includeUsage: true, // Include usage information in streaming responses
}); });
const convo = new Conversation(modelFlag ?? config.model); const convo = new Conversation(model);
if (!newConvo) { if (!newConvo) {
await convo.load(); await convo.load();