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,
|
||||
createNewRecipe,
|
||||
addMovieInfos,
|
||||
updateAllRecommendations,
|
||||
// updateAllRecommendations,
|
||||
],
|
||||
},
|
||||
};
|
||||
|
@ -46,7 +46,10 @@ export const unitsOfMeasure = {
|
||||
export function parseIngredients(
|
||||
text: string,
|
||||
): (Ingredient | IngredientGroup)[] {
|
||||
const cleanText = removeMarkdownFormatting(text);
|
||||
const cleanText = removeMarkdownFormatting(text)
|
||||
.split("\n")
|
||||
.map((line) => line.trim().replace(/^-/, ""))
|
||||
.join("\n");
|
||||
|
||||
const ingredients = parseIngredient(cleanText, {
|
||||
normalizeUOM: true,
|
||||
|
@ -160,6 +160,11 @@ export function renderRecipe(recipe: Recipe) {
|
||||
item.unit?.trim() || ""
|
||||
}** ${item.name}`;
|
||||
}
|
||||
|
||||
if (item.quantity) {
|
||||
return `- **${item.quantity}** ${item.name}`;
|
||||
}
|
||||
|
||||
return `- ${item.name}`;
|
||||
})
|
||||
.join("\n");
|
||||
|
@ -93,10 +93,13 @@ async function extractUsingAI(
|
||||
|
||||
const recipe = await openai.extractRecipe(markdown);
|
||||
|
||||
if (isValidRecipe(recipe)) {
|
||||
if (recipe) {
|
||||
if ("errorMessages" in recipe) {
|
||||
throw new Error("Failed to extract recipe: " + recipe.errorMessages[0]);
|
||||
} else {
|
||||
return recipe;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
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 = {
|
||||
type: "recipe",
|
||||
id,
|
||||
|
@ -51,10 +51,12 @@ export default async function Greet(
|
||||
</PageHero.Subline>
|
||||
</PageHero.Footer>
|
||||
</PageHero>
|
||||
{false && (
|
||||
<Recommendations
|
||||
id={movie.id}
|
||||
type="movie"
|
||||
/>
|
||||
)}
|
||||
{movie.tags.length > 0 && (
|
||||
<>
|
||||
<br />
|
||||
|
Reference in New Issue
Block a user