From a8a4eb488ffeccbe8adb44bc4f7881e20e0a744c Mon Sep 17 00:00:00 2001 From: Nicholas Ward Date: Wed, 7 Oct 2026 08:53:06 -0500 Subject: [PATCH] Remove bulk ingredient parsing feature and Ollama leftovers --- README.md | 6 - docs/agent-handoff.md | 5 +- .../api/app/recipes/parse-ingredients.ts | 20 -- src/components/RecipeStructureEditor.tsx | 32 --- .../BulkIngredientImportModal.tsx | 87 ------ .../recipe-editor/BulkPrepStepsModal.tsx | 4 +- src/components/recipe-editor/index.ts | 1 - .../recipe-editor/useRecipeStructure.ts | 223 +-------------- src/lib/database.ts | 2 +- src/lib/ingredient-parser.test.ts | 80 ------ src/lib/ingredient-parser.ts | 270 ------------------ src/styles/components/recipe-edit.css | 30 +- src/styles/responsive.css | 12 +- 13 files changed, 26 insertions(+), 746 deletions(-) delete mode 100644 src/application/pages/api/app/recipes/parse-ingredients.ts delete mode 100644 src/components/recipe-editor/BulkIngredientImportModal.tsx delete mode 100644 src/lib/ingredient-parser.test.ts delete mode 100644 src/lib/ingredient-parser.ts diff --git a/README.md b/README.md index 3da5738..461762d 100644 --- a/README.md +++ b/README.md @@ -105,12 +105,6 @@ Run the editor: npm run dev:app ``` -Ingredient bulk entry uses the local Ollama service through -`http://10.0.10.211:11434/api/chat` and the purpose-built -`qwen3:4b-instruct` parsing prompt. Override these defaults with -`FORMULATION_OLLAMA_URL` and `FORMULATION_INGREDIENT_PARSER_MODEL`. The parser -endpoint is disabled whenever `FORMULATION_READ_ONLY=true`. - Open . To stop any process listening on the application port and start a fresh Astro diff --git a/docs/agent-handoff.md b/docs/agent-handoff.md index 9054c81..cafe859 100644 --- a/docs/agent-handoff.md +++ b/docs/agent-handoff.md @@ -52,6 +52,5 @@ git diff --check ``` The application supports a read-only deployment with -`FORMULATION_READ_ONLY=true`. Ingredient bulk parsing additionally accepts -`FORMULATION_OLLAMA_URL` and `FORMULATION_INGREDIENT_PARSER_MODEL`; USDA imports -read `USDA_FDC_API_KEY` from the environment. +`FORMULATION_READ_ONLY=true`. USDA imports read `USDA_FDC_API_KEY` from the +environment. diff --git a/src/application/pages/api/app/recipes/parse-ingredients.ts b/src/application/pages/api/app/recipes/parse-ingredients.ts deleted file mode 100644 index 5aa1596..0000000 --- a/src/application/pages/api/app/recipes/parse-ingredients.ts +++ /dev/null @@ -1,20 +0,0 @@ -import type { APIRoute } from "astro"; -import { parseIngredientsDeterministic } from "../../../../../lib/ingredient-parser"; -import { readOnlyMode } from "../../../../../lib/runtime"; - -export const prerender = false; - -export const POST: APIRoute = async ({ request }) => { - if (readOnlyMode) return Response.json({ error: "Ingredient parsing is unavailable in read-only mode." }, { status: 403 }); - try { - const body = await request.json() as { text?: unknown }; - if (typeof body.text !== "string") return Response.json({ error: "Ingredient text is required." }, { status: 400 }); - if (body.text.length > 20_000) return Response.json({ error: "Ingredient text is too long." }, { status: 413 }); - return Response.json(parseIngredientsDeterministic(body.text)); - } catch (error) { - const message = error instanceof Error && error.name === "TimeoutError" - ? "Ingredient parser timed out. Try again." - : error instanceof Error ? error.message : "Unable to parse ingredients."; - return Response.json({ error: message }, { status: 502 }); - } -}; diff --git a/src/components/RecipeStructureEditor.tsx b/src/components/RecipeStructureEditor.tsx index c937fe4..147dd6f 100644 --- a/src/components/RecipeStructureEditor.tsx +++ b/src/components/RecipeStructureEditor.tsx @@ -1,6 +1,5 @@ import { useState } from "preact/hooks"; import { - BulkIngredientImportModal, BulkPrepStepsModal, RecipeItemRow, RecipeMethodEditor, @@ -31,13 +30,6 @@ export default function RecipeStructureEditor(props: RecipeEditorProps) { setFocusedItem, draftNotes, setDraftNotes, - bulkOpen, - setBulkOpen, - bulkText, - setBulkText, - bulkError, - setBulkError, - bulkParsing, prepOpen, setPrepOpen, prepText, @@ -65,7 +57,6 @@ export default function RecipeStructureEditor(props: RecipeEditorProps) { createPendingRowIngredient, createPendingIngredient, createPendingRecipe, - addBulkIngredients, addBulkPrepSteps, unconvertedYieldItems, } = useRecipeStructure(props); @@ -662,32 +653,9 @@ export default function RecipeStructureEditor(props: RecipeEditorProps) { Add Note - - { - setBulkText(val); - setBulkError(""); - }} - onClose={() => setBulkOpen(false)} - onSubmit={addBulkIngredients} - /> - void; - onClose: () => void; - onSubmit: () => void; -}; - -export default function BulkIngredientImportModal({ - open, - text, - error, - parsing, - onTextChange, - onClose, - onSubmit, -}: Props) { - if (!open) return null; - - return ( -