feat: refactor frontend and fix LLM extraction

- Fix critical await bug in extract-stream endpoint
- Add comprehensive logging to LLM and parser modules
- Implement fallback to standard completion for incompatible models
- Create enhanced v2.0 prompts with social media handling and few-shot examples
- Add LLM health check endpoint
- Decompose share page into 6 focused Svelte 5 snippets

Resolves LM Studio integration issues and improves code maintainability
This commit is contained in:
Giancarmine Salucci
2025-12-21 03:49:33 +01:00
parent 377bdbf6d7
commit da58263aba
9 changed files with 2104 additions and 56 deletions

View File

@@ -40,7 +40,7 @@ export const POST: RequestHandler = async ({ request }) => {
timestamp: new Date().toISOString()
});
const recipe = extractRecipe(extracted.bodyText);
const recipe = await extractRecipe(extracted.bodyText);
// Send final result
const completeEvent: ProgressEvent = {

View File

@@ -0,0 +1,30 @@
import { json } from '@sveltejs/kit';
import { checkLLMHealth } from '$lib/server/llm';
/**
* Health check endpoint for LLM service
* Tests connectivity to LM Studio or OpenAI-compatible endpoint
*/
export async function GET() {
try {
const isHealthy = await checkLLMHealth();
if (isHealthy) {
return json({
status: 'healthy',
message: 'LLM service is accessible'
});
} else {
return json({
status: 'unhealthy',
message: 'LLM service is not accessible'
}, { status: 503 });
}
} catch (error) {
const errorMessage = error instanceof Error ? error.message : 'Unknown error';
return json({
status: 'error',
message: errorMessage
}, { status: 500 });
}
}