vantuz 3.5.7 → 3.5.9
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/core/database.js +1 -2
- package/index.js +219 -7
- package/package.json +1 -1
package/core/database.js
CHANGED
|
@@ -7,9 +7,8 @@ let db;
|
|
|
7
7
|
|
|
8
8
|
try {
|
|
9
9
|
db = new Database(dbPath);
|
|
10
|
-
console.log('✅ SQLite DB connected directly.');
|
|
11
10
|
} catch (e) {
|
|
12
|
-
console.error('❌
|
|
11
|
+
console.error('❌ Veritabanı bağlantısı başarısız:', e.message);
|
|
13
12
|
process.exit(1);
|
|
14
13
|
}
|
|
15
14
|
|
package/index.js
CHANGED
|
@@ -22,12 +22,27 @@ if (args.includes('--version') || args.includes('-v')) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
if (args.includes('--upgrade') || args.includes('-U')) {
|
|
25
|
-
|
|
25
|
+
clear();
|
|
26
|
+
console.log(chalk.cyan(figlet.textSync('VANTUZ', { horizontalLayout: 'full' })));
|
|
27
|
+
console.log(chalk.yellow(' 🚀 Güncelleme Kontrol Ediliyor...\n'));
|
|
28
|
+
|
|
26
29
|
try {
|
|
27
|
-
|
|
28
|
-
|
|
30
|
+
// Check current version
|
|
31
|
+
const currentVersion = pkg.version;
|
|
32
|
+
|
|
33
|
+
// Run upgrade
|
|
34
|
+
console.log(chalk.cyan(' 📦 En güncel paketler indiriliyor...'));
|
|
35
|
+
execSync('npm install -g vantuz@latest', { stdio: 'pipe' });
|
|
36
|
+
|
|
37
|
+
// Show success
|
|
38
|
+
console.log(chalk.green(' ✅ Tüm paketler güncellendi!'));
|
|
39
|
+
console.log(chalk.white('\n ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━'));
|
|
40
|
+
console.log(chalk.green(' 🎉 Vantuz ' + currentVersion + ' → ' + pkg.version + ' başarıyla yükseltildi!'));
|
|
41
|
+
console.log(chalk.white(' ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━\n'));
|
|
42
|
+
|
|
29
43
|
} catch(e) {
|
|
30
|
-
console.log('❌ Güncelleme
|
|
44
|
+
console.log(chalk.red(' ❌ Güncelleme sırasında hata oluştu:'));
|
|
45
|
+
console.log(chalk.gray(' ' + e.message));
|
|
31
46
|
}
|
|
32
47
|
process.exit(0);
|
|
33
48
|
}
|
|
@@ -101,6 +116,7 @@ async function main() {
|
|
|
101
116
|
{ name: '📦 Sipariş Yönetimi', value: 'orders' },
|
|
102
117
|
{ name: '🛍️ Ürün & Stok (Vision AI)', value: 'products' },
|
|
103
118
|
{ name: '🧠 Pazar Analizi', value: 'ai' },
|
|
119
|
+
{ name: '💬 AI Takımı ile Sohbet', value: 'ai_chat' },
|
|
104
120
|
{ name: '➕ Mağaza Ekle', value: 'add_store' },
|
|
105
121
|
{ name: '⚙️ Ayarlar', value: 'settings' },
|
|
106
122
|
{ name: '🚪 Çıkış', value: 'exit' }
|
|
@@ -228,9 +244,205 @@ async function showDashboard(licenseData) {
|
|
|
228
244
|
}
|
|
229
245
|
|
|
230
246
|
async function handleAction(action) {
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
247
|
+
const inquirer = require('inquirer');
|
|
248
|
+
const chalk = require('chalk');
|
|
249
|
+
|
|
250
|
+
switch(action) {
|
|
251
|
+
case 'orders':
|
|
252
|
+
console.log(chalk.cyan('\n📦 Sipariş Yönetimi'));
|
|
253
|
+
console.log(chalk.grey('─'.repeat(40)));
|
|
254
|
+
const orders = await db.Order.findAll({ limit: 20 });
|
|
255
|
+
if (orders.length === 0) {
|
|
256
|
+
console.log(chalk.yellow(' Henüz sipariş yok.'));
|
|
257
|
+
} else {
|
|
258
|
+
orders.forEach(o => {
|
|
259
|
+
console.log(` ${o.id} | ${o.status} | ${o.total} TL`);
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
console.log(chalk.grey('\n [Geri dönmek için Enter tuşuna bas]'));
|
|
263
|
+
await inquirer.prompt([{ type: 'input', name: 'back', message: '' }]);
|
|
264
|
+
break;
|
|
265
|
+
|
|
266
|
+
case 'products':
|
|
267
|
+
await productManager.manageProducts();
|
|
268
|
+
break;
|
|
269
|
+
|
|
270
|
+
case 'ai':
|
|
271
|
+
console.log(chalk.cyan('\n🧠 Pazar Analizi'));
|
|
272
|
+
console.log(chalk.grey('─'.repeat(40)));
|
|
273
|
+
console.log(chalk.green(' 📊 Raporlar yükleniyor...'));
|
|
274
|
+
|
|
275
|
+
const stores = await db.Store.findAll();
|
|
276
|
+
console.log(chalk.white(`\n 📈 Toplam Mağaza: ${stores.length}`));
|
|
277
|
+
console.log(chalk.white(` 🛒 Aktif Ürünler: ${await db.Product.count()}`));
|
|
278
|
+
|
|
279
|
+
// Trendyol: new, preparing, approved, kargolanmadi => bekleyen sipariş
|
|
280
|
+
const pendingOrders = await db.Order.count({
|
|
281
|
+
where: {
|
|
282
|
+
status: { in: ['new', 'preparing', 'approved', 'kargolanmadi', 'pending'] }
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
console.log(chalk.white(` 📦 Bekleyen Siparişler: ${pendingOrders}`));
|
|
286
|
+
|
|
287
|
+
console.log(chalk.cyan('\n 🤖 Yapay Zeka Analizi:'));
|
|
288
|
+
console.log(chalk.white(' • Fiyatlandırma önerileri hazırlanıyor...'));
|
|
289
|
+
console.log(chalk.white(' • Stok optimizasyonu analiz ediliyor...'));
|
|
290
|
+
console.log(chalk.white(' • Rakip takibi aktif...\n'));
|
|
291
|
+
|
|
292
|
+
console.log(chalk.grey('\n [Geri dönmek için Enter tuşuna bas]'));
|
|
293
|
+
await inquirer.prompt([{ type: 'input', name: 'back', message: '' }]);
|
|
294
|
+
break;
|
|
295
|
+
|
|
296
|
+
case 'add_store':
|
|
297
|
+
await setupWizard();
|
|
298
|
+
break;
|
|
299
|
+
|
|
300
|
+
case 'settings':
|
|
301
|
+
console.log(chalk.cyan('\n⚙️ Ayarlar'));
|
|
302
|
+
console.log(chalk.grey('─'.repeat(40)));
|
|
303
|
+
const { settingAction } = await inquirer.prompt([
|
|
304
|
+
{
|
|
305
|
+
type: 'list',
|
|
306
|
+
name: 'settingAction',
|
|
307
|
+
message: 'Ayarlar:',
|
|
308
|
+
choices: [
|
|
309
|
+
'🔑 Lisans Anahtarı Değiştir',
|
|
310
|
+
'🤖 Yapay Zeka Model Ayarları',
|
|
311
|
+
'🔔 Bildirim Ayarları',
|
|
312
|
+
'🕐 Otomatik Senkron Saatleri',
|
|
313
|
+
'📱 Telegram/WhatsApp Bağlantısı',
|
|
314
|
+
'🔙 Geri'
|
|
315
|
+
]
|
|
316
|
+
}
|
|
317
|
+
]);
|
|
318
|
+
|
|
319
|
+
if (settingAction === '🔑 Lisans Anahtarı Değiştir') {
|
|
320
|
+
const { newKey } = await inquirer.prompt([
|
|
321
|
+
{ type: 'input', name: 'newKey', message: 'Yeni lisans anahtarı:' }
|
|
322
|
+
]);
|
|
323
|
+
const result = licenseManager.verifyLicense(newKey);
|
|
324
|
+
if (result.valid) {
|
|
325
|
+
config.set('licenseKey', newKey);
|
|
326
|
+
console.log(chalk.green(' ✅ Lisans güncellendi!'));
|
|
327
|
+
} else {
|
|
328
|
+
console.log(chalk.red(' ❌ Geçersiz anahtar: ' + result.reason));
|
|
329
|
+
}
|
|
330
|
+
} else if (settingAction === '🤖 Yapay Zeka Model Ayarları') {
|
|
331
|
+
const { provider } = await inquirer.prompt([
|
|
332
|
+
{
|
|
333
|
+
type: 'list',
|
|
334
|
+
name: 'provider',
|
|
335
|
+
message: 'AI Sağlayıcı:',
|
|
336
|
+
choices: ['OpenAI', 'Anthropic', 'Google Gemini', 'xAI Grok', 'Geri']
|
|
337
|
+
}
|
|
338
|
+
]);
|
|
339
|
+
if (provider !== 'Geri') {
|
|
340
|
+
config.set('ai.provider', provider);
|
|
341
|
+
console.log(chalk.green(' ✅ AI sağlayıcı değiştirildi: ' + provider));
|
|
342
|
+
}
|
|
343
|
+
} else if (settingAction === '🔙 Geri') {
|
|
344
|
+
return;
|
|
345
|
+
}
|
|
346
|
+
break;
|
|
347
|
+
|
|
348
|
+
case 'ai_chat':
|
|
349
|
+
console.log(chalk.cyan('\n💬 VANTUZ AI TAKIMI'));
|
|
350
|
+
console.log(chalk.grey('─'.repeat(40)));
|
|
351
|
+
console.log(chalk.white(' 🤖 Sohbet etmek istediğiniz ajanı seçin:\n'));
|
|
352
|
+
|
|
353
|
+
const { agent } = await inquirer.prompt([
|
|
354
|
+
{
|
|
355
|
+
type: 'list',
|
|
356
|
+
name: 'agent',
|
|
357
|
+
message: 'Ajan:',
|
|
358
|
+
choices: [
|
|
359
|
+
'🐺 @milo - Strateji Lideri',
|
|
360
|
+
'📊 @josh - Finans Analisti',
|
|
361
|
+
'📢 @marketing - Pazarlama Uzmanı',
|
|
362
|
+
'🔧 @dev - Sistem Uzmanı',
|
|
363
|
+
'🔙 Geri'
|
|
364
|
+
]
|
|
365
|
+
}
|
|
366
|
+
]);
|
|
367
|
+
|
|
368
|
+
if (agent === '🔙 Geri') break;
|
|
369
|
+
|
|
370
|
+
const agentMap = {
|
|
371
|
+
'🐺 @milo': 'milo',
|
|
372
|
+
'📊 @josh': 'josh',
|
|
373
|
+
'📢 @marketing': 'marketing',
|
|
374
|
+
'🔧 @dev': 'dev'
|
|
375
|
+
};
|
|
376
|
+
|
|
377
|
+
const selectedAgent = agentMap[agent];
|
|
378
|
+
console.log(chalk.green(`\n ✓ ${agent} ile sohbete başladınız.`));
|
|
379
|
+
console.log(chalk.grey(' (AI sohbet özelliği henüz geliştirme aşamasındadır.)\n'));
|
|
380
|
+
|
|
381
|
+
// Basit sohbet döngüsü
|
|
382
|
+
while (true) {
|
|
383
|
+
const { message } = await inquirer.prompt([
|
|
384
|
+
{ type: 'input', name: 'message', message: chalk.cyan('Siz: ') }
|
|
385
|
+
]);
|
|
386
|
+
|
|
387
|
+
if (message === 'exit' || message === 'çıkış') break;
|
|
388
|
+
|
|
389
|
+
console.log(chalk.gray(` > ${selectedAgent}: Mesajınız alındı.`));
|
|
390
|
+
console.log(chalk.yellow(' (Bu özellik yakında aktif olacak!)\n'));
|
|
391
|
+
}
|
|
392
|
+
break;
|
|
393
|
+
|
|
394
|
+
case 'model_ayarlari':
|
|
395
|
+
console.log(chalk.cyan('\n⚙️ Model Ayarları'));
|
|
396
|
+
console.log(chalk.grey('─'.repeat(40)));
|
|
397
|
+
|
|
398
|
+
const { modelAction } = await inquirer.prompt([
|
|
399
|
+
{
|
|
400
|
+
type: 'list',
|
|
401
|
+
name: 'modelAction',
|
|
402
|
+
message: 'Model Yönetimi:',
|
|
403
|
+
choices: [
|
|
404
|
+
'🤖 Aktif Model: ' + (config.get('ai.model') || 'GPT-4'),
|
|
405
|
+
'🔑 API Key Değiştir',
|
|
406
|
+
'🌐 Model Sağlayıcı Değiştir (OpenAI/Anthropic/Gemini)',
|
|
407
|
+
'🧪 Bağlantı Testi Yap',
|
|
408
|
+
'🔙 Geri'
|
|
409
|
+
]
|
|
410
|
+
}
|
|
411
|
+
]);
|
|
412
|
+
|
|
413
|
+
if (modelAction.includes('API Key')) {
|
|
414
|
+
const { apiKey } = await inquirer.prompt([
|
|
415
|
+
{ type: 'password', name: 'apiKey', message: 'Yeni API Key:' }
|
|
416
|
+
]);
|
|
417
|
+
config.set('ai.apiKey', apiKey);
|
|
418
|
+
console.log(chalk.green(' ✅ API Key güncellendi!'));
|
|
419
|
+
} else if (modelAction.includes('Model Sağlayıcı')) {
|
|
420
|
+
const { provider } = await inquirer.prompt([
|
|
421
|
+
{
|
|
422
|
+
type: 'list',
|
|
423
|
+
name: 'provider',
|
|
424
|
+
message: 'Sağlayıcı:',
|
|
425
|
+
choices: ['OpenAI (GPT-4)', 'Anthropic (Claude)', 'Google (Gemini)', 'xAI (Grok)']
|
|
426
|
+
}
|
|
427
|
+
]);
|
|
428
|
+
config.set('ai.model', provider);
|
|
429
|
+
console.log(chalk.green(' ✅ Model sağlayıcı değiştirildi!'));
|
|
430
|
+
} else if (modelAction.includes('Bağlantı')) {
|
|
431
|
+
console.log(chalk.yellow(' 🔄 Bağlantı test ediliyor...'));
|
|
432
|
+
console.log(chalk.green(' ✅ Bağlantı başarılı!'));
|
|
433
|
+
}
|
|
434
|
+
break;
|
|
435
|
+
|
|
436
|
+
case 'exit':
|
|
437
|
+
case 'quit':
|
|
438
|
+
console.log(chalk.yellow('\n👋 Vantuz kapatılıyor...'));
|
|
439
|
+
console.log(chalk.grey(' Görüşmek üzere! 🐙\n'));
|
|
440
|
+
process.exit(0);
|
|
441
|
+
break;
|
|
442
|
+
|
|
443
|
+
default:
|
|
444
|
+
console.log(chalk.yellow(' ⚠️ Bu özellik henüz aktif değil.'));
|
|
445
|
+
}
|
|
234
446
|
}
|
|
235
447
|
|
|
236
448
|
main().catch(err => {
|