diff --git a/Dockerfile b/Dockerfile index e45ad49fc882..1c8012b6e286 100644 --- a/Dockerfile +++ b/Dockerfile @@ -106,7 +106,7 @@ COPY --from=builder-base $POETRY_HOME $POETRY_HOME COPY --from=builder-base $PYSETUP_PATH $PYSETUP_PATH # copy CRF++ Binary from crfpp -ENV CRF_MODEL_URL=https://github.com/hay-kot/mealie-nlp-model/releases/download/v1.0.0/model.crfmodel +ENV CRF_MODEL_URL=https://github.com/mealie-recipes/nlp-model/releases/download/v1.0.0/model.crfmodel ENV LD_LIBRARY_PATH=/usr/local/lib COPY --from=crfpp /usr/local/lib/ /usr/local/lib diff --git a/frontend/api/class-interfaces/recipes.ts b/frontend/api/class-interfaces/recipes.ts index 9e2926b65ef4..b9f58bfe1500 100644 --- a/frontend/api/class-interfaces/recipes.ts +++ b/frontend/api/class-interfaces/recipes.ts @@ -22,6 +22,43 @@ const routes = { recipesSlugCommentsId: (slug: string, id: number) => `${prefix}/recipes/${slug}/comments/${id}`, }; +export type Parser = "nlp" | "brute"; + +export interface Confidence { + average?: number; + comment?: number; + name?: number; + unit?: number; + quantity?: number; + food?: number; +} + +export interface Unit { + name: string; + description: string; + fraction: boolean; + abbreviation: string; +} + +export interface Food { + name: string; + description: string; +} + +export interface Ingredient { + title: string; + note: string; + unit: Unit; + food: Food; + disableAmount: boolean; + quantity: number; +} + +export interface ParsedIngredient { + confidence: Confidence; + ingredient: Ingredient; +} + export class RecipeAPI extends BaseCRUDAPI { baseRoute: string = routes.recipesBase; itemRoute = routes.recipesRecipeSlug; @@ -84,11 +121,13 @@ export class RecipeAPI extends BaseCRUDAPI { return await this.requests.delete(routes.recipesSlugCommentsId(slug, id)); } - async parseIngredients(ingredients: Array) { - return await this.requests.post(routes.recipesParseIngredients, { ingredients }); + async parseIngredients(parser: Parser, ingredients: Array) { + parser = parser || "nlp"; + return await this.requests.post(routes.recipesParseIngredients, { parser, ingredients }); } - async parseIngredient(ingredient: string) { - return await this.requests.post(routes.recipesParseIngredient, { ingredient }); + async parseIngredient(parser: Parser, ingredient: string) { + parser = parser || "nlp"; + return await this.requests.post(routes.recipesParseIngredient, { parser, ingredient }); } } diff --git a/frontend/components/global/BaseOverflowButton.vue b/frontend/components/global/BaseOverflowButton.vue new file mode 100644 index 000000000000..c288cd4c568b --- /dev/null +++ b/frontend/components/global/BaseOverflowButton.vue @@ -0,0 +1,82 @@ + + + + + + \ No newline at end of file diff --git a/frontend/pages/admin/parser.vue b/frontend/pages/admin/parser.vue index f2fd4c1d5bff..8a4c7bd20f79 100644 --- a/frontend/pages/admin/parser.vue +++ b/frontend/pages/admin/parser.vue @@ -1,18 +1,28 @@ - \ No newline at end of file diff --git a/frontend/pages/recipe/create.vue b/frontend/pages/recipe/create.vue index dfd0ce876871..a74f76547315 100644 --- a/frontend/pages/recipe/create.vue +++ b/frontend/pages/recipe/create.vue @@ -7,11 +7,8 @@ Select one of the various ways to create a recipe - - From URL - Create - Import Zip - + +
@@ -127,7 +124,7 @@