yuangs 1.3.12 → 1.3.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli.js +27 -9
- package/package.json +1 -1
package/cli.js
CHANGED
|
@@ -83,18 +83,36 @@ async function askOnce(question, model) {
|
|
|
83
83
|
async function handleAICommand() {
|
|
84
84
|
const commandArgs = args.slice(1);
|
|
85
85
|
|
|
86
|
-
// 支持 --model 和 -m 两种写法
|
|
87
|
-
const longIndex = commandArgs.indexOf('--model');
|
|
88
|
-
const shortIndex = commandArgs.indexOf('-m');
|
|
89
|
-
const modelIndex = longIndex !== -1 ? longIndex : shortIndex;
|
|
90
|
-
|
|
91
86
|
let model = null; // Default model will be handled in index.js
|
|
92
87
|
let questionParts = commandArgs;
|
|
93
88
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
89
|
+
// Check for shorthand model flags first
|
|
90
|
+
const proIndex = commandArgs.indexOf('-p');
|
|
91
|
+
const flashIndex = commandArgs.indexOf('-f');
|
|
92
|
+
const liteIndex = commandArgs.indexOf('-l');
|
|
93
|
+
|
|
94
|
+
if (proIndex !== -1) {
|
|
95
|
+
model = 'gemini-pro';
|
|
96
|
+
questionParts = commandArgs.filter((_, index) => index !== proIndex);
|
|
97
|
+
} else if (flashIndex !== -1) {
|
|
98
|
+
model = 'gemini-flash-latest';
|
|
99
|
+
questionParts = commandArgs.filter((_, index) => index !== flashIndex);
|
|
100
|
+
} else if (liteIndex !== -1) {
|
|
101
|
+
model = 'gemini-flash-lite-latest';
|
|
102
|
+
questionParts = commandArgs.filter((_, index) => index !== liteIndex);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// If shorthand flags are not used, check for --model or -m
|
|
106
|
+
if (!model) {
|
|
107
|
+
const longIndex = questionParts.indexOf('--model');
|
|
108
|
+
const shortIndex = questionParts.indexOf('-m');
|
|
109
|
+
const modelIndex = longIndex !== -1 ? longIndex : shortIndex;
|
|
110
|
+
|
|
111
|
+
if (modelIndex !== -1 && questionParts.length > modelIndex + 1) {
|
|
112
|
+
model = questionParts[modelIndex + 1];
|
|
113
|
+
// Filter out --model/-m and its value
|
|
114
|
+
questionParts = questionParts.filter((_, index) => index !== modelIndex && index !== modelIndex + 1);
|
|
115
|
+
}
|
|
98
116
|
}
|
|
99
117
|
|
|
100
118
|
const question = questionParts.join(' ').trim();
|