This commit is contained in:
seb
2026-10-08 12:44:53 +02:00
parent 79a1b72292
commit e2e7f8d566
11 changed files with 172 additions and 21 deletions

View File

@@ -343,9 +343,17 @@ export async function executeCompanyImport({
jtlArtIdToSku.set(jtlArtId, sku);
let name = '';
let desc = '';
let seo = '';
try {
const desc = JSON.parse(a.descriptions || '[]');
name = desc[0]?.cName || '';
const descriptions = JSON.parse(a.descriptions || '[]');
const descItem = Array.isArray(descriptions) ? descriptions[0] : descriptions;
if (descItem) {
name = String(descItem.cName || '').trim();
desc = String(descItem.cBeschreibung || '').trim();
seo = String(descItem.cKurzBeschreibung || '').trim();
}
} catch {}
if (!name) name = `Artikel ${sku}`;
@@ -388,6 +396,8 @@ export async function executeCompanyImport({
await store.article.updateBySku(googleAuthId, sku, {
name: name.trim(),
track_stock: trackStock,
desc: desc || undefined,
seo: seo || undefined,
});
// Update prices
@@ -432,6 +442,8 @@ export async function executeCompanyImport({
name: name.trim(),
sku,
track_stock: trackStock,
desc: desc || undefined,
seo: seo || undefined,
});
// Set price

View File

@@ -28,6 +28,7 @@ import { createPdfReadTool } from '../tools/pdf-read.js';
import { createSearchArticlesTool } from '../tools/search-articles.js';
import { createEanChecksumTool } from '../tools/ean-checksum.js';
import { createNetGrossCalcTool } from '../tools/net-gross-calc.js';
import { createSetUserRouteTool } from '../tools/set-user-route.js';
import { resolveOpenRouterKey, resolveDefaultModel, resolveModelReasoning, RETIRED_MODELS, hasConfiguredOpenRouterKey } from '../tools/llm-key.js';
const KEEP_ALIVE_MS = 20_000;
@@ -132,6 +133,7 @@ async function buildSystemPrompt(vfsRoot, googleAuthId) {
'16. edit_image: Generate or edit images using the configured company image model (modelslugimage). Supports attachments (low/high quality), size tiers (1K/2K/4K), and aspect ratios (1:1/4:3/3:4). Writes output to VFS (always AVIF format).',
'17. ean_checksum: Validate EAN/GTIN/UPC barcode check digits or calculate missing check digit for barcodes (EAN-13, EAN-8, UPC-A, GTIN-14).',
'18. net_gross_calc: Convert between net and gross prices with tax/VAT rate (default 19%). Provides 2-decimal display values and high-precision net prices for API article creation.',
'19. set-user-route: Navigate the user to a frontend route (e.g. when the user says "show me the article", "open quote 1001", or asks to view a page/entity).',
'',
'VIRTUAL FILESYSTEM:',
'- Persistent per-company VFS. Paths are root-relative forward-slash (e.g. "labels/sheet1.png").',
@@ -157,7 +159,37 @@ async function buildSystemPrompt(vfsRoot, googleAuthId) {
'- GROSS vs NET PRICES: User prices are almost always GROSS (incl. VAT); API requires NET. Use net_gross_calc to compute high-precision (4–6 decimals) NET prices for API requests: `net = gross / (1 + taxRate / 100)`.',
'- DISPLAYING GENERATED IMAGES: Inline markdown images supported. Embed written VFS image paths: `![descriptive alt](artifacts/example.png)`. Other files (PDF, JSON, CSV) do not render inline; provide download links.',
'- LABEL TEMPLATES (/labeltemplate): Must use Dashback JSON schema `{ "objects": [ ... ] }`. Do NOT use ZPL.',
'- USER NAVIGATION: When the user says "show me the article", "open this order", or asks to navigate to a screen/entity, call set-user-route with the appropriate path from the Route Construction Matrix.',
'- Always Format output with markdown and emoji.',
'',
'USER PERSPECTIVE ROUTE CONSTRUCTION MATRIX:',
'| Destination | Path Pattern | Parameters / Construction | Example |',
'|:---|:---|:---|:---|',
'| **Article Search / Index** | `/artikel` | Query params: `?target={query}&filter={filter}&offset={n}` | `/artikel?target=kabel` |',
'| **Article Detail** | `/artikel/:sku` | Encode SKU: `/artikel/${encodeURIComponent(sku)}` | `/artikel/ART-10042` |',
'| **Warehouse / Stock** | `/artikel/lager` | Static | `/artikel/lager` |',
'| **Brands** | `/artikel/marken` | Static | `/artikel/marken` |',
'| **Label Templates** | `/artikel/vorlagen` | Static | `/artikel/vorlagen` |',
'| **Attributes & Features** | `/artikel/merkmale` | Static | `/artikel/merkmale` |',
'| **Category Tree Root** | `/kategorien` | Static | `/kategorien` |',
'| **Category Subtree** | `/kategorien/*` | Join encoded slugs: `/kategorien/${slug1}/${slug2}` | `/kategorien/elektronik/kabel` |',
'| **Delivery List** | `/lieferung` | Static | `/lieferung` |',
'| **New Delivery Draft** | `/lieferung/neu` | Static (receipt & draft line editor) | `/lieferung/neu` |',
'| **Delivery Detail** | `/lieferung/:deliveryId` | Delivery document ID: `/lieferung/${deliveryId}` | `/lieferung/42` |',
'| **Suppliers Directory** | `/lieferung/lieferanten` | Static | `/lieferung/lieferanten` |',
'| **Quote List (Angebote)** | `/auftrag` | Static | `/auftrag` |',
'| **New Quote** | `/auftrag/neu` | Static draft form | `/auftrag/neu` |',
'| **Quote Detail** | `/auftrag/:quoteId` | Quote document ID: `/auftrag/${quoteId}` | `/auftrag/1001` |',
'| **Order List (Bestellungen)**| `/auftrag/bestellung` | Static | `/auftrag/bestellung` |',
'| **New Order** | `/auftrag/bestellung/neu` | Static draft form | `/auftrag/bestellung/neu` |',
'| **Order Detail** | `/auftrag/bestellung/:orderId` | Order document ID: `/auftrag/bestellung/${orderId}` | `/auftrag/bestellung/2005` |',
'| **Customer List** | `/kunde` | Static | `/kunde` |',
'| **New Customer** | `/kunde/neu` | Static form | `/kunde/neu` |',
'| **Customer Detail** | `/kunde/:entityId` | Customer entity ID: `/kunde/${entityId}` | `/kunde/312` |',
'| **Customer Groups** | `/kunde/gruppen` | Static (pricing & customer tiers) | `/kunde/gruppen` |',
'| **Article History** | `/infos` or `/infos/articlehistory` | Static | `/infos/articlehistory` |',
'| **Global History** | `/infos/globalhistory` | Static audit log | `/infos/globalhistory` |',
'| **Statistics** | `/infos/statistics` | Static KPIs & charts | `/infos/statistics` |',
...(routesDoc ? [
'',
'DASHBACK API ROUTES:',
@@ -874,6 +906,11 @@ export class ConversationManager {
createSearchArticlesTool({ googleAuthId, companyId: this.companyId }),
createEanChecksumTool(),
createNetGrossCalcTool(),
createSetUserRouteTool({
onRoute: (route) => {
this.broadcast('route', { route });
},
}),
],
});