vantuz 3.2.5 β 3.2.6
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 +387 -57
- package/core/ai-provider.js +7 -6
- package/core/channels.js +107 -12
- package/core/database.js +24 -25
- package/core/engine.js +123 -133
- package/core/gateway.js +340 -0
- package/onboard.js +57 -66
- package/package.json +2 -2
- package/plugins/vantuz/index.js +1 -1
- package/plugins/vantuz/platforms/_template.js +118 -0
- package/plugins/vantuz/platforms/trendyol.js +23 -5
- package/plugins/vantuz/services/scheduler.js +1 -1
package/cli.js
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* π VANTUZ CLI v3.2
|
|
5
|
+
* Vantuz Gateway entegrasyonlu komut satΔ±rΔ± arayΓΌzΓΌ
|
|
6
|
+
*/
|
|
7
|
+
|
|
2
8
|
import path from 'path';
|
|
3
9
|
import os from 'os';
|
|
4
10
|
import fs from 'fs';
|
|
5
11
|
import readline from 'readline';
|
|
6
12
|
import { log, getLogs, clearLogs } from './core/ai-provider.js';
|
|
7
13
|
import { getEngine } from './core/engine.js';
|
|
8
|
-
import {
|
|
14
|
+
import { getGateway } from './core/gateway.js';
|
|
9
15
|
|
|
16
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
10
17
|
// CONFIG
|
|
18
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
19
|
+
|
|
11
20
|
const VANTUZ_HOME = path.join(os.homedir(), '.vantuz');
|
|
12
21
|
const CONFIG_PATH = path.join(VANTUZ_HOME, '.env');
|
|
13
22
|
const CONFIG_JSON = path.join(VANTUZ_HOME, 'config.json');
|
|
@@ -16,22 +25,17 @@ if (!fs.existsSync(VANTUZ_HOME)) {
|
|
|
16
25
|
fs.mkdirSync(VANTUZ_HOME, { recursive: true });
|
|
17
26
|
}
|
|
18
27
|
|
|
19
|
-
//
|
|
28
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
29
|
+
// HELPERS
|
|
30
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
31
|
+
|
|
20
32
|
const colors = {
|
|
21
33
|
reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',
|
|
22
|
-
red: '\x1b[31m', green: '\x1b[32m', yellow: '\x1b[33m',
|
|
34
|
+
red: '\x1b[31m', green: '\x1b[32m', yellow: '\x1b[33m',
|
|
35
|
+
cyan: '\x1b[36m', blue: '\x1b[34m', magenta: '\x1b[35m'
|
|
23
36
|
};
|
|
24
37
|
const c = (color, text) => `${colors[color]}${text}${colors.reset}`;
|
|
25
38
|
|
|
26
|
-
function clearScreen() { console.clear(); }
|
|
27
|
-
|
|
28
|
-
function printHeader() {
|
|
29
|
-
console.log(c('cyan', `
|
|
30
|
-
VANTUZ AI v3.2.2 - Enterprise E-Ticaret
|
|
31
|
-
---------------------------------------
|
|
32
|
-
`));
|
|
33
|
-
}
|
|
34
|
-
|
|
35
39
|
function loadEnv() {
|
|
36
40
|
const env = {};
|
|
37
41
|
try {
|
|
@@ -46,94 +50,420 @@ function loadEnv() {
|
|
|
46
50
|
return env;
|
|
47
51
|
}
|
|
48
52
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
function loadConfigJson() {
|
|
54
|
+
try {
|
|
55
|
+
if (fs.existsSync(CONFIG_JSON)) {
|
|
56
|
+
return JSON.parse(fs.readFileSync(CONFIG_JSON, 'utf-8'));
|
|
57
|
+
}
|
|
58
|
+
} catch (e) {
|
|
59
|
+
console.log(c('red', `Config okunamadΔ±: ${e.message}`));
|
|
60
|
+
}
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
53
63
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
64
|
+
function saveConfigJson(config) {
|
|
65
|
+
try {
|
|
66
|
+
fs.writeFileSync(CONFIG_JSON, JSON.stringify(config, null, 2));
|
|
67
|
+
return true;
|
|
68
|
+
} catch (e) {
|
|
69
|
+
console.log(c('red', `Config yazΔ±lamadΔ±: ${e.message}`));
|
|
70
|
+
return false;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function clearScreen() {
|
|
75
|
+
process.stdout.write('\x1Bc');
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
function printHeader() {
|
|
79
|
+
const version = JSON.parse(fs.readFileSync(new URL('./package.json', import.meta.url))).version;
|
|
80
|
+
console.log(c('cyan', `
|
|
81
|
+
βββ βββ ββββββ ββββ βββββββββββββββ βββββββββββ
|
|
82
|
+
βββ ββββββββββββββββ βββββββββββββββ βββββββββββ
|
|
83
|
+
βββ βββββββββββββββββ βββ βββ βββ βββ βββββ
|
|
84
|
+
ββββ ββββββββββββββββββββββ βββ βββ βββ βββββ
|
|
85
|
+
βββββββ βββ ββββββ ββββββ βββ βββββββββββββββββ
|
|
86
|
+
βββββ βββ ββββββ βββββ βββ βββββββ ββββββββ
|
|
87
|
+
`));
|
|
88
|
+
console.log(c('magenta', ` Enterprise E-Commerce Management System v${version}`));
|
|
89
|
+
console.log(c('dim', ' Powered by Vantuz AI Gateway'));
|
|
90
|
+
console.log(c('dim', ' ----------------------------------------------------------\n'));
|
|
57
91
|
}
|
|
58
92
|
|
|
59
|
-
|
|
93
|
+
async function showSpinner(text, duration = 1000) {
|
|
94
|
+
const frames = ['β ', 'β ', 'β Ή', 'β Έ', 'β Ό', 'β ΄', 'β ¦', 'β §', 'β ', 'β '];
|
|
95
|
+
let i = 0;
|
|
96
|
+
const interval = setInterval(() => {
|
|
97
|
+
process.stdout.write(`\r${c('cyan', frames[i])} ${text}...`);
|
|
98
|
+
i = (i + 1) % frames.length;
|
|
99
|
+
}, 80);
|
|
100
|
+
await new Promise(r => setTimeout(r, duration));
|
|
101
|
+
clearInterval(interval);
|
|
102
|
+
process.stdout.write(`\r${c('green', 'β')} ${text} TamamlandΔ±\n`);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
106
|
+
// COMMANDS
|
|
107
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
108
|
+
|
|
60
109
|
async function runTUI() {
|
|
61
110
|
clearScreen();
|
|
62
111
|
printHeader();
|
|
63
112
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
// console.log(c('red', '[HATA] GeΓ§erli lisans bulunamadΔ±.'));
|
|
68
|
-
// console.log('LΓΌtfen ΓΆnce kurulumu tamamlayΔ±n:\n');
|
|
69
|
-
// console.log(' vantuz-onboard\n');
|
|
70
|
-
// process.exit(1);
|
|
71
|
-
// }
|
|
72
|
-
|
|
73
|
-
console.log('Sistem baΕlatΔ±lΔ±yor...\n');
|
|
74
|
-
// ... (TUI init simplified for brevity, engine logic assumes valid license)
|
|
113
|
+
await showSpinner('Sistem Γ§ekirdeΔi yΓΌkleniyor', 500);
|
|
114
|
+
await showSpinner('Vantuz Gateway kontrol ediliyor', 400);
|
|
115
|
+
await showSpinner('Pazaryeri baΔlantΔ±larΔ± kontrol ediliyor', 800);
|
|
75
116
|
|
|
76
117
|
const engine = await getEngine();
|
|
77
|
-
|
|
78
|
-
|
|
118
|
+
const status = engine.getStatus();
|
|
119
|
+
|
|
120
|
+
// Gateway durumu
|
|
121
|
+
if (status.gateway?.connected) {
|
|
122
|
+
console.log(`${c('green', 'β')} Vantuz Gateway ${c('green', 'BaΔlΔ±')} ${c('dim', `(${status.gateway.url})`)}`);
|
|
123
|
+
} else {
|
|
124
|
+
console.log(`${c('yellow', 'β')} Vantuz Gateway ${c('yellow', 'BaΔlΔ± DeΔil')} ${c('dim', '(direkt mod)')}`);
|
|
125
|
+
}
|
|
79
126
|
|
|
80
|
-
|
|
81
|
-
|
|
127
|
+
console.log(`${c('green', 'β')} Sistem Aktif ${c('dim', `(${status.connectedCount}/${status.totalPlatforms} Platform BaΔlΔ±)`)}`);
|
|
128
|
+
console.log(`${c('blue', 'βΉ')} AI SaΔlayΔ±cΔ±: ${c('bold', status.aiProvider || 'Gemini')}`);
|
|
129
|
+
console.log(`${c('yellow', 'β‘')} Komutlar: ${c('cyan', '/stok, /siparis, /rapor, /analiz, /durum, /temizle, /exit')}\n`);
|
|
130
|
+
|
|
131
|
+
const rl = readline.createInterface({
|
|
132
|
+
input: process.stdin,
|
|
133
|
+
output: process.stdout,
|
|
134
|
+
prompt: c('magenta', 'Vantuz> ')
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
rl.prompt();
|
|
138
|
+
|
|
139
|
+
rl.on('line', async (line) => {
|
|
82
140
|
const input = line.trim();
|
|
83
141
|
if (input === '/exit') process.exit(0);
|
|
142
|
+
if (input === '/temizle') {
|
|
143
|
+
clearScreen();
|
|
144
|
+
printHeader();
|
|
145
|
+
rl.prompt();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
84
148
|
|
|
85
149
|
if (input) {
|
|
86
150
|
try {
|
|
87
151
|
if (input.startsWith('/')) {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
152
|
+
const [cmd, ...cmdArgs] = input.split(' ');
|
|
153
|
+
switch (cmd) {
|
|
154
|
+
case '/help':
|
|
155
|
+
console.log(c('yellow', '\nKullanΔ±labilir Komutlar:'));
|
|
156
|
+
console.log(` ${c('cyan', '/stok')} - TΓΌm pazaryerlerindeki stok durumunu gΓΆsterir`);
|
|
157
|
+
console.log(` ${c('cyan', '/siparis')} - Son sipariΕleri listeler`);
|
|
158
|
+
console.log(` ${c('cyan', '/durum')} - Sistem durumunu gΓΆsterir`);
|
|
159
|
+
console.log(` ${c('cyan', '/temizle')} - EkranΔ± temizler`);
|
|
160
|
+
console.log(` ${c('cyan', '/exit')} - ΓΔ±kΔ±Ε\n`);
|
|
161
|
+
break;
|
|
162
|
+
case '/stok':
|
|
163
|
+
console.log(c('dim', 'Stok verileri Γ§ekiliyor...'));
|
|
164
|
+
const stocks = await engine.getStock();
|
|
165
|
+
if (stocks.length === 0) console.log(c('yellow', 'BaΔlΔ± platform bulunamadΔ±.'));
|
|
166
|
+
stocks.forEach(s => {
|
|
167
|
+
console.log(`\n${s.icon} ${c('bold', s.platform.toUpperCase())}`);
|
|
168
|
+
s.products.slice(0, 5).forEach(p => {
|
|
169
|
+
console.log(` - ${p.title}: ${c('green', p.stock)} Adet | ${c('yellow', p.price)} TL`);
|
|
170
|
+
});
|
|
171
|
+
});
|
|
172
|
+
break;
|
|
173
|
+
case '/siparis':
|
|
174
|
+
console.log(c('dim', 'SipariΕler Γ§ekiliyor...'));
|
|
175
|
+
const orders = await engine.getOrders({ size: 5 });
|
|
176
|
+
if (orders.length === 0) console.log(c('yellow', 'Son sipariΕ bulunamadΔ±.'));
|
|
177
|
+
orders.forEach(o => {
|
|
178
|
+
console.log(`${o._icon} [#${o.orderNumber || o.id}] ${c('bold', o.customerName || 'MΓΌΕteri')}: ${c('green', o.totalPrice || o.total)} TL (${o._platform})`);
|
|
179
|
+
});
|
|
180
|
+
break;
|
|
181
|
+
case '/durum':
|
|
182
|
+
const s = engine.getStatus();
|
|
183
|
+
console.log(c('yellow', '\nββ Sistem Durumu ββ'));
|
|
184
|
+
console.log(` Engine: ${s.engine === 'active' ? c('green', 'β Aktif') : c('red', 'β Pasif')}`);
|
|
185
|
+
console.log(` Gateway: ${s.gateway?.connected ? c('green', 'β BaΔlΔ±') : c('yellow', 'β BaΔlΔ± DeΔil')}`);
|
|
186
|
+
console.log(` AI: ${c('cyan', s.aiProvider || 'gemini')}`);
|
|
187
|
+
console.log(` Platformlar: ${c('bold', `${s.connectedCount}/${s.totalPlatforms}`)}`);
|
|
188
|
+
console.log('');
|
|
189
|
+
break;
|
|
190
|
+
default:
|
|
191
|
+
console.log(c('red', `[HATA] Bilinmeyen komut: ${cmd}. /help yazΔ±n.`));
|
|
192
|
+
}
|
|
92
193
|
} else {
|
|
194
|
+
process.stdout.write(c('dim', 'DΓΌΕΓΌnΓΌyor... '));
|
|
93
195
|
const response = await engine.chat(input);
|
|
94
|
-
|
|
196
|
+
process.stdout.write('\r' + ' '.repeat(20) + '\r');
|
|
197
|
+
console.log(`\n${c('cyan', 'π Vantuz:')}\n${response}\n`);
|
|
95
198
|
}
|
|
96
199
|
} catch (e) {
|
|
97
|
-
console.log(c('red',
|
|
200
|
+
console.log(c('red', `\n[HATA] ${e.message}`));
|
|
98
201
|
}
|
|
99
202
|
}
|
|
100
|
-
prompt();
|
|
203
|
+
rl.prompt();
|
|
101
204
|
});
|
|
102
|
-
prompt();
|
|
103
205
|
}
|
|
104
206
|
|
|
105
|
-
|
|
207
|
+
async function runConfig(args) {
|
|
208
|
+
const sub = args[1]?.toLowerCase();
|
|
209
|
+
const config = loadConfigJson();
|
|
210
|
+
|
|
211
|
+
if (!sub || sub === 'get') {
|
|
212
|
+
printHeader();
|
|
213
|
+
if (sub === 'get' && args[2]) {
|
|
214
|
+
const key = args[2];
|
|
215
|
+
const value = config?.[key];
|
|
216
|
+
console.log(value === undefined ? '' : String(value));
|
|
217
|
+
return;
|
|
218
|
+
}
|
|
219
|
+
console.log(JSON.stringify(config, null, 2));
|
|
220
|
+
return;
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
if (sub === 'set') {
|
|
224
|
+
const key = args[2];
|
|
225
|
+
const value = args.slice(3).join(' ');
|
|
226
|
+
if (!key) {
|
|
227
|
+
console.log(c('red', 'KullanΔ±m: vantuz config set <key> <value>'));
|
|
228
|
+
process.exitCode = 2;
|
|
229
|
+
return;
|
|
230
|
+
}
|
|
231
|
+
config[key] = value;
|
|
232
|
+
const ok = saveConfigJson(config);
|
|
233
|
+
if (ok) {
|
|
234
|
+
console.log(c('green', '[OK] Config gΓΌncellendi'));
|
|
235
|
+
} else {
|
|
236
|
+
process.exitCode = 1;
|
|
237
|
+
}
|
|
238
|
+
return;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
console.log(c('red', 'GeΓ§ersiz config komutu. KullanΔ±m: vantuz config [get [key] | set <key> <value>]'));
|
|
242
|
+
process.exitCode = 2;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async function runLogs(args) {
|
|
246
|
+
const sub = args[1]?.toLowerCase();
|
|
247
|
+
if (sub === 'clear' || sub === 'temizle') {
|
|
248
|
+
const ok = clearLogs();
|
|
249
|
+
if (ok) console.log(c('green', '[OK] Loglar temizlendi'));
|
|
250
|
+
else {
|
|
251
|
+
console.log(c('red', '[HATA] Loglar temizlenemedi'));
|
|
252
|
+
process.exitCode = 1;
|
|
253
|
+
}
|
|
254
|
+
return;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
const nRaw = args[1];
|
|
258
|
+
const n = nRaw && /^\d+$/.test(nRaw) ? Number(nRaw) : 50;
|
|
259
|
+
printHeader();
|
|
260
|
+
console.log(getLogs(n));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
async function runGateway(args) {
|
|
264
|
+
const sub = args[1]?.toLowerCase();
|
|
265
|
+
const gw = await getGateway();
|
|
266
|
+
const info = gw.getInfo();
|
|
267
|
+
|
|
268
|
+
if (!sub || sub === 'status') {
|
|
269
|
+
printHeader();
|
|
270
|
+
console.log(c('yellow', 'ββ Vantuz Gateway ββ\n'));
|
|
271
|
+
console.log(` URL: ${c('cyan', info.url)}`);
|
|
272
|
+
console.log(` Durum: ${info.connected ? c('green', 'β BaΔlΔ±') : c('red', 'β BaΔlΔ± DeΔil')}`);
|
|
273
|
+
console.log(` Token: ${info.hasToken ? c('green', 'β YapΔ±landΔ±rΔ±lmΔ±Ε') : c('yellow', 'β Eksik')}`);
|
|
274
|
+
console.log(` Config: ${info.configFound ? c('green', 'β Bulundu') : c('yellow', 'β BulunamadΔ±')}`);
|
|
275
|
+
if (info.version) console.log(` SΓΌrΓΌm: ${c('dim', info.version)}`);
|
|
276
|
+
console.log('');
|
|
277
|
+
|
|
278
|
+
if (!info.connected) {
|
|
279
|
+
console.log(c('dim', ' Gateway baΕlatmak iΓ§in: vantuz gateway run'));
|
|
280
|
+
console.log(c('dim', ' Veya: start.bat\n'));
|
|
281
|
+
}
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
if (sub === 'health') {
|
|
286
|
+
const result = await gw.health();
|
|
287
|
+
if (result.success) {
|
|
288
|
+
console.log(c('green', 'β Gateway saΔlΔ±klΔ±'));
|
|
289
|
+
if (result.data) console.log(JSON.stringify(result.data, null, 2));
|
|
290
|
+
} else {
|
|
291
|
+
console.log(c('red', `β Gateway eriΕilemez: ${result.error}`));
|
|
292
|
+
}
|
|
293
|
+
return;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (sub === 'models') {
|
|
297
|
+
const result = await gw.getModels();
|
|
298
|
+
if (result.success) {
|
|
299
|
+
console.log(c('yellow', 'ββ AI Modelleri ββ\n'));
|
|
300
|
+
const models = result.data?.data || result.data || [];
|
|
301
|
+
if (Array.isArray(models)) {
|
|
302
|
+
models.forEach(m => {
|
|
303
|
+
console.log(` ${c('cyan', m.id || m.name)} ${c('dim', m.description || '')}`);
|
|
304
|
+
});
|
|
305
|
+
} else {
|
|
306
|
+
console.log(JSON.stringify(models, null, 2));
|
|
307
|
+
}
|
|
308
|
+
} else {
|
|
309
|
+
console.log(c('red', `Modeller alΔ±namadΔ±: ${result.error}`));
|
|
310
|
+
}
|
|
311
|
+
return;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
if (sub === 'run' || sub === 'start') {
|
|
315
|
+
console.log(c('cyan', 'Gateway baΕlatΔ±lΔ±yor...'));
|
|
316
|
+
const gatewayCmd = path.join(process.cwd(), '.openclaw', 'gateway.cmd');
|
|
317
|
+
|
|
318
|
+
if (fs.existsSync(gatewayCmd)) {
|
|
319
|
+
try {
|
|
320
|
+
const { spawn } = await import('child_process');
|
|
321
|
+
const child = spawn(gatewayCmd, [], {
|
|
322
|
+
detached: true,
|
|
323
|
+
stdio: 'ignore', // Arka planda sessizce Γ§alΔ±ΕsΔ±n
|
|
324
|
+
shell: true // Windows iΓ§in gerekli
|
|
325
|
+
});
|
|
326
|
+
child.unref(); // Parent process'ten ayΔ±r
|
|
327
|
+
|
|
328
|
+
console.log(c('green', 'β Gateway arka planda baΕlatΔ±ldΔ±.'));
|
|
329
|
+
console.log(c('dim', 'BirkaΓ§ saniye iΓ§inde hazΔ±r olacak.'));
|
|
330
|
+
console.log(c('dim', 'Kontrol iΓ§in: vantuz gateway status'));
|
|
331
|
+
} catch (e) {
|
|
332
|
+
console.log(c('red', `BaΕlatma hatasΔ±: ${e.message}`));
|
|
333
|
+
}
|
|
334
|
+
} else {
|
|
335
|
+
console.log(c('red', 'Gateway baΕlatma dosyasΔ± bulunamadΔ±: .openclaw/gateway.cmd'));
|
|
336
|
+
}
|
|
337
|
+
return;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
console.log(c('red', 'KullanΔ±m: vantuz gateway [status|health|models|run]'));
|
|
341
|
+
}
|
|
342
|
+
|
|
343
|
+
async function runDoctor() {
|
|
344
|
+
printHeader();
|
|
345
|
+
console.log(c('yellow', 'ββ Sistem SaΔlΔ±k KontrolΓΌ ββ\n'));
|
|
346
|
+
|
|
347
|
+
await showSpinner('Kontroller yapΔ±lΔ±yor', 800);
|
|
348
|
+
|
|
349
|
+
const engine = await getEngine();
|
|
350
|
+
const report = await engine.doctor();
|
|
351
|
+
|
|
352
|
+
// Engine
|
|
353
|
+
console.log(` Engine: ${report.engine ? c('green', 'β Aktif') : c('red', 'β Pasif')}`);
|
|
354
|
+
|
|
355
|
+
// Gateway
|
|
356
|
+
const gw = report.gateway;
|
|
357
|
+
const gwIcon = gw.status === 'healthy' ? c('green', 'β') :
|
|
358
|
+
gw.status === 'not_configured' ? c('yellow', 'β') : c('red', 'β');
|
|
359
|
+
console.log(` Gateway: ${gwIcon} ${gw.status === 'healthy' ? 'SaΔlΔ±klΔ±' : gw.status === 'not_configured' ? 'YapΔ±landΔ±rΔ±lmamΔ±Ε' : 'EriΕilemez'}`);
|
|
360
|
+
|
|
361
|
+
// AI
|
|
362
|
+
const ai = report.ai;
|
|
363
|
+
console.log(` AI: ${c('cyan', ai.provider)} ${ai.keyConfigured ? c('green', 'β Key OK') : c('red', 'β Key Eksik')} ${ai.gatewayFallback ? c('dim', '(gateway fallback var)') : ''}`);
|
|
364
|
+
|
|
365
|
+
// Platformlar
|
|
366
|
+
const platformEntries = Object.entries(report.platforms).filter(([k]) => k !== 'openclaw-gateway');
|
|
367
|
+
if (platformEntries.length > 0) {
|
|
368
|
+
console.log(`\n ${c('bold', 'Platformlar:')}`);
|
|
369
|
+
platformEntries.forEach(([name, connected]) => {
|
|
370
|
+
console.log(` ${connected ? c('green', 'β') : c('red', 'β')} ${name}`);
|
|
371
|
+
});
|
|
372
|
+
} else {
|
|
373
|
+
console.log(` Platformlar: ${c('yellow', 'HiΓ§biri baΔlΔ± deΔil')}`);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
// Kanallar
|
|
377
|
+
const ch = report.channels;
|
|
378
|
+
if (ch) {
|
|
379
|
+
console.log(`\n ${c('bold', 'Kanallar:')}`);
|
|
380
|
+
for (const [name, data] of Object.entries(ch)) {
|
|
381
|
+
console.log(` ${data.connected ? c('green', 'β') : c('yellow', 'β')} ${name}: ${data.info || ''}`);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
console.log('');
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
async function runChannels(args) {
|
|
389
|
+
printHeader();
|
|
390
|
+
console.log(c('yellow', 'ββ Δ°letiΕim KanallarΔ± ββ\n'));
|
|
391
|
+
|
|
392
|
+
const engine = await getEngine();
|
|
393
|
+
const status = engine.getStatus();
|
|
394
|
+
const channels = status.channels || {};
|
|
395
|
+
|
|
396
|
+
for (const [name, data] of Object.entries(channels)) {
|
|
397
|
+
const icon = data.connected ? c('green', 'β') : c('yellow', 'β');
|
|
398
|
+
const mode = data.mode === 'gateway' ? c('dim', '[gateway]') : c('dim', '[local]');
|
|
399
|
+
console.log(` ${icon} ${c('bold', name.toUpperCase())} ${mode}`);
|
|
400
|
+
if (data.info) console.log(` ${c('dim', data.info)}`);
|
|
401
|
+
console.log('');
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
if (!status.gateway?.connected) {
|
|
405
|
+
console.log(c('dim', ' WhatsApp baΔlantΔ±sΔ± iΓ§in gateway gereklidir.'));
|
|
406
|
+
console.log(c('dim', ' Gateway baΕlatmak iΓ§in: start.bat\n'));
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
411
|
+
// MAIN
|
|
412
|
+
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
413
|
+
|
|
106
414
|
const args = process.argv.slice(2);
|
|
107
415
|
const command = args[0]?.toLowerCase();
|
|
108
416
|
|
|
109
417
|
async function main() {
|
|
110
|
-
const env = loadEnv();
|
|
111
|
-
|
|
112
|
-
// Auto-redirect removed
|
|
113
|
-
// if (!env.VANTUZ_LICENSE_KEY && command !== 'onboard') {
|
|
114
|
-
// console.log(c('yellow', 'Lisans bulunamadΔ±. Kurulum sihirbazΔ± baΕlatΔ±lΔ±yor...\n'));
|
|
115
|
-
// import('./onboard.js');
|
|
116
|
-
// return;
|
|
117
|
-
// }
|
|
118
|
-
|
|
119
418
|
switch (command) {
|
|
120
419
|
case 'tui':
|
|
121
420
|
case 'chat':
|
|
122
421
|
await runTUI();
|
|
123
422
|
break;
|
|
124
423
|
|
|
424
|
+
case 'config':
|
|
425
|
+
await runConfig(args);
|
|
426
|
+
break;
|
|
427
|
+
|
|
428
|
+
case 'logs':
|
|
429
|
+
await runLogs(args);
|
|
430
|
+
break;
|
|
431
|
+
|
|
432
|
+
case 'gateway':
|
|
433
|
+
case 'gw':
|
|
434
|
+
await runGateway(args);
|
|
435
|
+
break;
|
|
436
|
+
|
|
437
|
+
case 'doctor':
|
|
438
|
+
case 'check':
|
|
439
|
+
await runDoctor();
|
|
440
|
+
break;
|
|
441
|
+
|
|
442
|
+
case 'channels':
|
|
443
|
+
case 'ch':
|
|
444
|
+
await runChannels(args);
|
|
445
|
+
break;
|
|
446
|
+
|
|
125
447
|
case 'status':
|
|
126
448
|
printHeader();
|
|
127
|
-
// const valid = await checkLicense();
|
|
128
449
|
console.log(`Lisans Durumu: ${c('green', 'Aktif (Dev Mode)')}`);
|
|
450
|
+
const gw = await getGateway();
|
|
451
|
+
const gwInfo = gw.getInfo();
|
|
452
|
+
console.log(`Vantuz Gateway: ${gwInfo.connected ? c('green', 'β BaΔlΔ±') : c('yellow', 'β BaΔlΔ± DeΔil')}`);
|
|
129
453
|
break;
|
|
130
454
|
|
|
131
455
|
default:
|
|
132
456
|
printHeader();
|
|
133
457
|
console.log('KullanΔ±m:\n');
|
|
134
|
-
console.log('
|
|
135
|
-
console.log('
|
|
136
|
-
console.log('
|
|
458
|
+
console.log(` ${c('cyan', 'vantuz tui')} - Sohbet arayΓΌzΓΌ`);
|
|
459
|
+
console.log(` ${c('cyan', 'vantuz status')} - Durum kontrolΓΌ`);
|
|
460
|
+
console.log(` ${c('cyan', 'vantuz gateway')} - Gateway yΓΆnetimi`);
|
|
461
|
+
console.log(` ${c('cyan', 'vantuz doctor')} - Sistem saΔlΔ±k kontrolΓΌ`);
|
|
462
|
+
console.log(` ${c('cyan', 'vantuz channels')} - Δ°letiΕim kanallarΔ±`);
|
|
463
|
+
console.log(` ${c('cyan', 'vantuz config')} - AyarlarΔ± gΓΆster/gΓΌncelle`);
|
|
464
|
+
console.log(` ${c('cyan', 'vantuz logs')} - LoglarΔ± gΓΆster`);
|
|
465
|
+
console.log(`\nKurulum iΓ§in: ${c('cyan', 'vantuz-onboard')}`);
|
|
466
|
+
process.exitCode = command ? 2 : 0;
|
|
137
467
|
}
|
|
138
468
|
}
|
|
139
469
|
|
package/core/ai-provider.js
CHANGED
|
@@ -74,17 +74,18 @@ const VANTUZ_SYSTEM_PROMPT = `Sen Vantuz AI, e-ticaret operasyonlarΔ±nΔ± yΓΆnete
|
|
|
74
74
|
- SatΔ±Ε raporlarΔ±
|
|
75
75
|
|
|
76
76
|
## Γnemli Kurallar
|
|
77
|
-
1.
|
|
78
|
-
2.
|
|
79
|
-
3.
|
|
80
|
-
4.
|
|
81
|
-
5.
|
|
77
|
+
1. **ASLA VE ASLA** elindeki "MEVCUT SΔ°STEM DURUMU" verisinde olmayan bir sayΔ±yΔ± uydurma.
|
|
78
|
+
2. EΔer baΔlamda sipariΕ sayΔ±sΔ± 0 gΓΆrΓΌnΓΌyorsa veya hiΓ§ veri yoksa, "Εu an sipariΕ verisine ulaΕamΔ±yorum" de.
|
|
79
|
+
3. "25 sipariΕ var" gibi rastgele sayΔ±lar verme.
|
|
80
|
+
4. Kar marjΔ±nΔ±n altΔ±na fiyat dΓΌΕΓΌrme ΓΆnerme.
|
|
81
|
+
5. Stokta olmayan ΓΌrΓΌnΓΌ satΔ±Εa aΓ§ma.
|
|
82
|
+
6. Kritik iΕlemlerden ΓΆnce onay iste.
|
|
82
83
|
|
|
83
84
|
## YanΔ±t FormatΔ±
|
|
84
85
|
- KΔ±sa ve ΓΆz ol
|
|
85
86
|
- Emoji kullan ama abartma
|
|
86
87
|
- SayΔ±sal verileri tablo formatΔ±nda gΓΆster
|
|
87
|
-
- Hata durumunda Γ§ΓΆzΓΌm ΓΆner`;
|
|
88
|
+
- Hata durumunda Γ§ΓΆzΓΌm ΓΆner ve hata kodunu analiz et`;
|
|
88
89
|
|
|
89
90
|
// βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
90
91
|
// AI CHAT
|