feat(bom): add Get Prompt modal for LLM and fix product name resolution (#11)

### Summary of Changes
- Added 'Get Prompt' button and ProductBomPromptModal dialog on /products/:id/bom.
- Formats product ID, variants, and raw material inventory into a structured prompt for LLMs.
- Fixed backend bug in GET /products/:id?lang=all that wiped product.name when no translations existed.
- Added multi-level fallback in frontend to ensure product name never shows 'Unknown Product'.

---------

Co-authored-by: Your Name <you@example.com>
Reviewed-on: #11
Co-authored-by: antigravity-bot <bot@kittisak.com>
This commit was merged in pull request #11.
This commit is contained in:
antigravity-bot BotandYour Name authored and admin committed 2026-10-18 03:55:15 +00:00
1 parent a647c9682d
commit d8f6d8139f
3 files changed
+366 -7

No files matched your search

+3 -3
View File
@@ -471,9 +471,9 @@ export const productsRoute = new Elysia({ prefix: "/products" })
if (!product || (!includeDeleted && product.isDeleted)) return status(404, { message: "Product not found" });
if (lang === 'all') {
const nameObj: any = {};
const descObj: any = {};
const detailsObj: any = {};
const nameObj: any = product.name ? { th: product.name } : {};
const descObj: any = product.description ? { th: product.description } : {};
const detailsObj: any = product.details ? { th: product.details } : {};
product.translations.forEach((t: any) => {
nameObj[t.langCode] = t.name;
descObj[t.langCode] = t.description;