draftify-cli 1.0.41 → 1.0.45
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/dist/repl.js +34 -29
- package/dist/utils/api.js +6 -1
- package/package.json +1 -1
package/dist/repl.js
CHANGED
|
@@ -809,6 +809,11 @@ async function startRepl(initialUsername) {
|
|
|
809
809
|
else if (errStr.length > 50) {
|
|
810
810
|
errStr = errStr.substring(0, 50) + "...";
|
|
811
811
|
}
|
|
812
|
+
if (errStr === "401") {
|
|
813
|
+
ui_1.ui.error("API Error: 401 (Nincs jogosultság).");
|
|
814
|
+
ui_1.ui.info("Kérlek, jelentkezz be újra a 'draftify login' parancs futtatásával!");
|
|
815
|
+
throw new Error("Generálás leállt: Bejelentkezés szükséges (401)");
|
|
816
|
+
}
|
|
812
817
|
// Only print error code / concise message
|
|
813
818
|
ui_1.ui.error(`API Error: ${errStr}. (Attempt ${retryCount + 1}/3)`);
|
|
814
819
|
retryCount++;
|
|
@@ -865,35 +870,6 @@ async function startRepl(initialUsername) {
|
|
|
865
870
|
// Save session locally
|
|
866
871
|
const firstUserMsg = conversationHistory.find(h => h.role === "user")?.content || inputLine;
|
|
867
872
|
(0, chats_1.updateChatSession)(currentSessionId, firstUserMsg, currentModel, conversationHistory);
|
|
868
|
-
if (finalDisplayResult) {
|
|
869
|
-
ui_1.ui.box("Draftify AI", finalDisplayResult.split("\n"));
|
|
870
|
-
}
|
|
871
|
-
// --- INTERACTIVE MENU FOR QUESTIONS ---
|
|
872
|
-
if (questions.length > 0) {
|
|
873
|
-
const { Select, Input } = require('enquirer');
|
|
874
|
-
let answers = [];
|
|
875
|
-
for (const q of questions) {
|
|
876
|
-
console.log("");
|
|
877
|
-
const prompt = new Select({
|
|
878
|
-
name: 'answer',
|
|
879
|
-
message: q.question,
|
|
880
|
-
choices: [...q.options, "Provide a custom answer..."]
|
|
881
|
-
});
|
|
882
|
-
let answer = await prompt.run();
|
|
883
|
-
if (answer === "Provide a custom answer...") {
|
|
884
|
-
const customPrompt = new Input({
|
|
885
|
-
message: 'Type your answer:'
|
|
886
|
-
});
|
|
887
|
-
answer = await customPrompt.run();
|
|
888
|
-
}
|
|
889
|
-
answers.push(`- Question: ${q.question}\n Answer: ${answer}`);
|
|
890
|
-
}
|
|
891
|
-
let promptAdditions = [];
|
|
892
|
-
if (autoPrompt)
|
|
893
|
-
promptAdditions.push(autoPrompt);
|
|
894
|
-
promptAdditions.push("My answers to the questions:\n" + answers.join("\n"));
|
|
895
|
-
autoPrompt = promptAdditions.join("\n\n");
|
|
896
|
-
}
|
|
897
873
|
// --- AUTONOMOUS FILE SYSTEM EXPLORATION ---
|
|
898
874
|
let autoExplorationOutputs = [];
|
|
899
875
|
const isSafePathLocal = (targetPath) => {
|
|
@@ -948,6 +924,35 @@ async function startRepl(initialUsername) {
|
|
|
948
924
|
promptAdditions.push(`I executed your file system requests. Here are the results:\n${autoExplorationOutputs.join('\n\n')}`);
|
|
949
925
|
autoPrompt = promptAdditions.join("\n\n");
|
|
950
926
|
}
|
|
927
|
+
if (finalDisplayResult) {
|
|
928
|
+
ui_1.ui.box("Draftify AI", finalDisplayResult.split("\n"));
|
|
929
|
+
}
|
|
930
|
+
// --- INTERACTIVE MENU FOR QUESTIONS ---
|
|
931
|
+
if (questions.length > 0) {
|
|
932
|
+
const { Select, Input } = require('enquirer');
|
|
933
|
+
let answers = [];
|
|
934
|
+
for (const q of questions) {
|
|
935
|
+
console.log("");
|
|
936
|
+
const prompt = new Select({
|
|
937
|
+
name: 'answer',
|
|
938
|
+
message: q.question,
|
|
939
|
+
choices: [...q.options, "Provide a custom answer..."]
|
|
940
|
+
});
|
|
941
|
+
let answer = await prompt.run();
|
|
942
|
+
if (answer === "Provide a custom answer...") {
|
|
943
|
+
const customPrompt = new Input({
|
|
944
|
+
message: 'Type your answer:'
|
|
945
|
+
});
|
|
946
|
+
answer = await customPrompt.run();
|
|
947
|
+
}
|
|
948
|
+
answers.push(`- Question: ${q.question}\n Answer: ${answer}`);
|
|
949
|
+
}
|
|
950
|
+
let promptAdditions = [];
|
|
951
|
+
if (autoPrompt)
|
|
952
|
+
promptAdditions.push(autoPrompt);
|
|
953
|
+
promptAdditions.push("My answers to the questions:\n" + answers.join("\n"));
|
|
954
|
+
autoPrompt = promptAdditions.join("\n\n");
|
|
955
|
+
}
|
|
951
956
|
// --- EXECUTE COMMANDS ---
|
|
952
957
|
if (commandsToRun.length > 0) {
|
|
953
958
|
let commandOutputs = [];
|
package/dist/utils/api.js
CHANGED
|
@@ -182,7 +182,12 @@ Throughout, balance deep technical proficiency with an accessible, friendly, wel
|
|
|
182
182
|
resolve(tempResult);
|
|
183
183
|
}
|
|
184
184
|
catch (err) {
|
|
185
|
-
|
|
185
|
+
if (err.message && err.message.includes("401")) {
|
|
186
|
+
reject(new Error("401 (Invalid API Key): A megadott helyi GEMINI_API_KEY érvénytelen vagy lejárt. Kérlek, töröld az .env fájlból, vagy frissítsd!"));
|
|
187
|
+
}
|
|
188
|
+
else {
|
|
189
|
+
reject(err);
|
|
190
|
+
}
|
|
186
191
|
}
|
|
187
192
|
finally {
|
|
188
193
|
if (abortSignal) {
|