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:
@@ -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 = {
|
||||
|
||||
30
src/routes/api/llm-health/+server.ts
Normal file
30
src/routes/api/llm-health/+server.ts
Normal 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 });
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user