vantuz 3.2.4 → 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 +385 -61
- 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 +59 -67
- package/package.json +6 -3
- 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/license.js +15 -259
- package/plugins/vantuz/services/scheduler.js +1 -1
package/cli.js
CHANGED
|
@@ -1,19 +1,22 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
|
|
2
3
|
/**
|
|
3
|
-
* VANTUZ CLI v3.2
|
|
4
|
-
*
|
|
5
|
-
* Emojisiz, Kurumsal Arayüz
|
|
4
|
+
* 🐙 VANTUZ CLI v3.2
|
|
5
|
+
* Vantuz Gateway entegrasyonlu komut satırı arayüzü
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
|
-
import fs from 'fs';
|
|
9
8
|
import path from 'path';
|
|
10
9
|
import os from 'os';
|
|
10
|
+
import fs from 'fs';
|
|
11
11
|
import readline from 'readline';
|
|
12
|
-
import { getEngine } from './core/engine.js';
|
|
13
12
|
import { log, getLogs, clearLogs } from './core/ai-provider.js';
|
|
14
|
-
import {
|
|
13
|
+
import { getEngine } from './core/engine.js';
|
|
14
|
+
import { getGateway } from './core/gateway.js';
|
|
15
15
|
|
|
16
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
16
17
|
// CONFIG
|
|
18
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
19
|
+
|
|
17
20
|
const VANTUZ_HOME = path.join(os.homedir(), '.vantuz');
|
|
18
21
|
const CONFIG_PATH = path.join(VANTUZ_HOME, '.env');
|
|
19
22
|
const CONFIG_JSON = path.join(VANTUZ_HOME, 'config.json');
|
|
@@ -22,22 +25,17 @@ if (!fs.existsSync(VANTUZ_HOME)) {
|
|
|
22
25
|
fs.mkdirSync(VANTUZ_HOME, { recursive: true });
|
|
23
26
|
}
|
|
24
27
|
|
|
25
|
-
//
|
|
28
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
29
|
+
// HELPERS
|
|
30
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
31
|
+
|
|
26
32
|
const colors = {
|
|
27
33
|
reset: '\x1b[0m', bold: '\x1b[1m', dim: '\x1b[2m',
|
|
28
|
-
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'
|
|
29
36
|
};
|
|
30
37
|
const c = (color, text) => `${colors[color]}${text}${colors.reset}`;
|
|
31
38
|
|
|
32
|
-
function clearScreen() { console.clear(); }
|
|
33
|
-
|
|
34
|
-
function printHeader() {
|
|
35
|
-
console.log(c('cyan', `
|
|
36
|
-
VANTUZ AI v3.2.2 - Enterprise E-Ticaret
|
|
37
|
-
---------------------------------------
|
|
38
|
-
`));
|
|
39
|
-
}
|
|
40
|
-
|
|
41
39
|
function loadEnv() {
|
|
42
40
|
const env = {};
|
|
43
41
|
try {
|
|
@@ -52,94 +50,420 @@ function loadEnv() {
|
|
|
52
50
|
return env;
|
|
53
51
|
}
|
|
54
52
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
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
|
+
}
|
|
63
|
+
|
|
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
|
+
}
|
|
59
73
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return result.success;
|
|
74
|
+
function clearScreen() {
|
|
75
|
+
process.stdout.write('\x1Bc');
|
|
63
76
|
}
|
|
64
77
|
|
|
65
|
-
|
|
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'));
|
|
91
|
+
}
|
|
92
|
+
|
|
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
|
+
|
|
66
109
|
async function runTUI() {
|
|
67
110
|
clearScreen();
|
|
68
111
|
printHeader();
|
|
69
112
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
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);
|
|
116
|
+
|
|
117
|
+
const engine = await getEngine();
|
|
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)')}`);
|
|
77
125
|
}
|
|
78
126
|
|
|
79
|
-
console.log('Sistem
|
|
80
|
-
|
|
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`);
|
|
81
130
|
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
131
|
+
const rl = readline.createInterface({
|
|
132
|
+
input: process.stdin,
|
|
133
|
+
output: process.stdout,
|
|
134
|
+
prompt: c('magenta', 'Vantuz> ')
|
|
135
|
+
});
|
|
85
136
|
|
|
86
|
-
|
|
87
|
-
|
|
137
|
+
rl.prompt();
|
|
138
|
+
|
|
139
|
+
rl.on('line', async (line) => {
|
|
88
140
|
const input = line.trim();
|
|
89
141
|
if (input === '/exit') process.exit(0);
|
|
142
|
+
if (input === '/temizle') {
|
|
143
|
+
clearScreen();
|
|
144
|
+
printHeader();
|
|
145
|
+
rl.prompt();
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
90
148
|
|
|
91
149
|
if (input) {
|
|
92
150
|
try {
|
|
93
151
|
if (input.startsWith('/')) {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
+
}
|
|
98
193
|
} else {
|
|
194
|
+
process.stdout.write(c('dim', 'Düşünüyor... '));
|
|
99
195
|
const response = await engine.chat(input);
|
|
100
|
-
|
|
196
|
+
process.stdout.write('\r' + ' '.repeat(20) + '\r');
|
|
197
|
+
console.log(`\n${c('cyan', '🐙 Vantuz:')}\n${response}\n`);
|
|
101
198
|
}
|
|
102
199
|
} catch (e) {
|
|
103
|
-
console.log(c('red',
|
|
200
|
+
console.log(c('red', `\n[HATA] ${e.message}`));
|
|
104
201
|
}
|
|
105
202
|
}
|
|
106
|
-
prompt();
|
|
203
|
+
rl.prompt();
|
|
107
204
|
});
|
|
108
|
-
prompt();
|
|
109
205
|
}
|
|
110
206
|
|
|
111
|
-
|
|
112
|
-
const
|
|
113
|
-
const
|
|
207
|
+
async function runConfig(args) {
|
|
208
|
+
const sub = args[1]?.toLowerCase();
|
|
209
|
+
const config = loadConfigJson();
|
|
114
210
|
|
|
115
|
-
|
|
116
|
-
|
|
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
|
+
}
|
|
117
222
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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
|
+
}
|
|
122
238
|
return;
|
|
123
239
|
}
|
|
124
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
|
+
|
|
414
|
+
const args = process.argv.slice(2);
|
|
415
|
+
const command = args[0]?.toLowerCase();
|
|
416
|
+
|
|
417
|
+
async function main() {
|
|
125
418
|
switch (command) {
|
|
126
419
|
case 'tui':
|
|
127
420
|
case 'chat':
|
|
128
421
|
await runTUI();
|
|
129
422
|
break;
|
|
130
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
|
+
|
|
131
447
|
case 'status':
|
|
132
448
|
printHeader();
|
|
133
|
-
|
|
134
|
-
|
|
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')}`);
|
|
135
453
|
break;
|
|
136
454
|
|
|
137
455
|
default:
|
|
138
456
|
printHeader();
|
|
139
457
|
console.log('Kullanım:\n');
|
|
140
|
-
console.log('
|
|
141
|
-
console.log('
|
|
142
|
-
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;
|
|
143
467
|
}
|
|
144
468
|
}
|
|
145
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
|