fix(backend): rendering issue
This commit is contained in:
600
article.html
Normal file
600
article.html
Normal file
File diff suppressed because one or more lines are too long
13
compose.yml
Normal file
13
compose.yml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
services:
|
||||||
|
app:
|
||||||
|
build:
|
||||||
|
context: .
|
||||||
|
dockerfile: Dockerfile
|
||||||
|
volumes:
|
||||||
|
- .:/app # Mount the local directory to /app in the container
|
||||||
|
working_dir: /app # Set the working directory inside the container to /app
|
||||||
|
command: run --env-file -A --watch=static/,routes/ dev.ts # Custom start command
|
||||||
|
ports:
|
||||||
|
- "8000:8000" # Expose the container port
|
||||||
|
environment:
|
||||||
|
- DATA_DIR=/app/data # Set the environment variable inside the container
|
@ -77,7 +77,7 @@ export const menus: Record<string, Menu> = {
|
|||||||
createNewSeries,
|
createNewSeries,
|
||||||
createNewRecipe,
|
createNewRecipe,
|
||||||
addMovieInfos,
|
addMovieInfos,
|
||||||
updateAllRecommendations,
|
// updateAllRecommendations,
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
@ -46,7 +46,10 @@ export const unitsOfMeasure = {
|
|||||||
export function parseIngredients(
|
export function parseIngredients(
|
||||||
text: string,
|
text: string,
|
||||||
): (Ingredient | IngredientGroup)[] {
|
): (Ingredient | IngredientGroup)[] {
|
||||||
const cleanText = removeMarkdownFormatting(text);
|
const cleanText = removeMarkdownFormatting(text)
|
||||||
|
.split("\n")
|
||||||
|
.map((line) => line.trim().replace(/^-/, ""))
|
||||||
|
.join("\n");
|
||||||
|
|
||||||
const ingredients = parseIngredient(cleanText, {
|
const ingredients = parseIngredient(cleanText, {
|
||||||
normalizeUOM: true,
|
normalizeUOM: true,
|
||||||
|
@ -160,6 +160,11 @@ export function renderRecipe(recipe: Recipe) {
|
|||||||
item.unit?.trim() || ""
|
item.unit?.trim() || ""
|
||||||
}** ${item.name}`;
|
}** ${item.name}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (item.quantity) {
|
||||||
|
return `- **${item.quantity}** ${item.name}`;
|
||||||
|
}
|
||||||
|
|
||||||
return `- ${item.name}`;
|
return `- ${item.name}`;
|
||||||
})
|
})
|
||||||
.join("\n");
|
.join("\n");
|
||||||
|
@ -93,10 +93,13 @@ async function extractUsingAI(
|
|||||||
|
|
||||||
const recipe = await openai.extractRecipe(markdown);
|
const recipe = await openai.extractRecipe(markdown);
|
||||||
|
|
||||||
if (isValidRecipe(recipe)) {
|
if (recipe) {
|
||||||
return recipe;
|
if ("errorMessages" in recipe) {
|
||||||
|
throw new Error("Failed to extract recipe: " + recipe.errorMessages[0]);
|
||||||
|
} else {
|
||||||
|
return recipe;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function processCreateRecipeFromUrl(
|
async function processCreateRecipeFromUrl(
|
||||||
@ -172,13 +175,6 @@ async function processCreateRecipeFromUrl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!recipe) {
|
|
||||||
console.error("Failed to parse recipe");
|
|
||||||
streamResponse.enqueue("failed to parse recipe");
|
|
||||||
streamResponse.cancel();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const newRecipe: Recipe = {
|
const newRecipe: Recipe = {
|
||||||
type: "recipe",
|
type: "recipe",
|
||||||
id,
|
id,
|
||||||
|
@ -51,10 +51,12 @@ export default async function Greet(
|
|||||||
</PageHero.Subline>
|
</PageHero.Subline>
|
||||||
</PageHero.Footer>
|
</PageHero.Footer>
|
||||||
</PageHero>
|
</PageHero>
|
||||||
<Recommendations
|
{false && (
|
||||||
id={movie.id}
|
<Recommendations
|
||||||
type="movie"
|
id={movie.id}
|
||||||
/>
|
type="movie"
|
||||||
|
/>
|
||||||
|
)}
|
||||||
{movie.tags.length > 0 && (
|
{movie.tags.length > 0 && (
|
||||||
<>
|
<>
|
||||||
<br />
|
<br />
|
||||||
|
Reference in New Issue
Block a user