|
|
@@ -395,7 +395,7 @@ export const appRouter = router({
|
|
|
// 5. Stock / inventory
|
|
|
if (!erpContext && /\b(in stock|available|inventory|stock|availability)\b/.test(msgLower)) {
|
|
|
// Match model numbers: letter-first (B1234-1) or digit-first (2259W-5, 1436W-6)
|
|
|
- const modelMatch = msg.match(/\b(\d{3,}(?:-\d+)+|[A-Z]{1,4}\d{2,}[-\w]*|\d{2,}[A-Z]\d*[-\w]*)\b/i);
|
|
|
+ const modelMatch = msg.match(/\b(\d{3,}(?:-\d+[*]?)+|[A-Z]{1,4}\d{2,}[-\w*]*|\d{2,}[A-Z]\d*[-\w*]*)/i);
|
|
|
if (modelMatch) {
|
|
|
erpContext = await lookupStock({ model: modelMatch[1] }, userCtx);
|
|
|
}
|
|
|
@@ -418,7 +418,7 @@ export const appRouter = router({
|
|
|
|
|
|
// 7. Product images — "show image/photo/picture of [model]" or "image for 1436W-6"
|
|
|
if (!erpContext && /\b(image|images|photo|photos|picture|pictures|what does .* look like|show me)\b/.test(msgLower)) {
|
|
|
- const modelMatch = msg.match(/\b(\d{3,}(?:-\d+)+|[A-Z]{1,4}\d{2,}[-\w]*|\d{2,}[A-Z]\d*[-\w]*)\b/i);
|
|
|
+ const modelMatch = msg.match(/\b(\d{3,}(?:-\d+[*]?)+|[A-Z]{1,4}\d{2,}[-\w*]*|\d{2,}[A-Z]\d*[-\w*]*)/i);
|
|
|
if (modelMatch) {
|
|
|
erpContext = await lookupProductImages(modelMatch[1], userCtx);
|
|
|
}
|