tmpa-cli 1.0.2 → 1.0.3
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/bin/index.js +11 -1
- package/package.json +1 -1
package/bin/index.js
CHANGED
|
@@ -11,7 +11,12 @@ const CONFIG_FILE = path.join(os.homedir(), '.tmpa_config.json');
|
|
|
11
11
|
function loadConfig() {
|
|
12
12
|
if (fs.existsSync(CONFIG_FILE)) {
|
|
13
13
|
try {
|
|
14
|
-
|
|
14
|
+
const data = JSON.parse(fs.readFileSync(CONFIG_FILE, 'utf8'));
|
|
15
|
+
// Pastikan endpoint selalu ada nilainya agar tidak undefined
|
|
16
|
+
if (!data.endpoint) {
|
|
17
|
+
data.endpoint = 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent';
|
|
18
|
+
}
|
|
19
|
+
return data;
|
|
15
20
|
} catch (e) {
|
|
16
21
|
return {};
|
|
17
22
|
}
|
|
@@ -63,6 +68,11 @@ async function handleChat(prompt) {
|
|
|
63
68
|
return askConfig(() => startPrompt());
|
|
64
69
|
}
|
|
65
70
|
|
|
71
|
+
// Pastikan endpoint aman dari undefined
|
|
72
|
+
if (!config.endpoint) {
|
|
73
|
+
config.endpoint = 'https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash:generateContent';
|
|
74
|
+
}
|
|
75
|
+
|
|
66
76
|
console.log('\x1b[33mTMPA CLI memproses...\x1b[0m');
|
|
67
77
|
|
|
68
78
|
try {
|