mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-21 21:46:42 +02:00
feat(apps): create Hono compute servers for Chat, Mukke, Picture
Chat (3002): LLM completions (sync + SSE streaming), model list Mukke (3010): S3 upload/download/cover URLs via shared-storage Picture (3006): Replicate/local image gen, S3 upload Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1aeb987cb6
commit
0181d3f546
2 changed files with 4 additions and 7 deletions
|
|
@ -13,7 +13,6 @@ import { consumeCredits, validateCredits } from '@manacore/shared-hono/credits';
|
|||
|
||||
const PORT = parseInt(process.env.PORT || '3002', 10);
|
||||
const LLM_URL = process.env.MANA_LLM_URL || 'http://localhost:3025';
|
||||
const OPENROUTER_KEY = process.env.OPENROUTER_API_KEY || '';
|
||||
const CORS_ORIGINS = (process.env.CORS_ORIGINS || 'http://localhost:5173').split(',');
|
||||
|
||||
const app = new Hono();
|
||||
|
|
@ -114,7 +113,9 @@ app.post('/api/v1/chat/completions/stream', async (c) => {
|
|||
}
|
||||
|
||||
await stream.writeSSE({ data: '[DONE]' });
|
||||
consumeCredits(userId, 'AI_CHAT', cost, `Chat stream: ${model || 'gemma3:4b'}`).catch(() => {});
|
||||
consumeCredits(userId, 'AI_CHAT', cost, `Chat stream: ${model || 'gemma3:4b'}`).catch(
|
||||
() => {}
|
||||
);
|
||||
} catch (_err) {
|
||||
await stream.writeSSE({ data: JSON.stringify({ error: 'Stream failed' }) });
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue