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:
Till JS 2026-03-28 16:28:14 +01:00
parent 1aeb987cb6
commit 0181d3f546
2 changed files with 4 additions and 7 deletions

View file

@ -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' }) });
}

View file

@ -10,10 +10,6 @@ import { cors } from 'hono/cors';
import { authMiddleware, healthRoute, errorHandler, notFoundHandler } from '@manacore/shared-hono';
const PORT = parseInt(process.env.PORT || '3010', 10);
const S3_ENDPOINT = process.env.S3_ENDPOINT || 'http://localhost:9000';
const S3_BUCKET = process.env.S3_BUCKET || 'mukke-storage';
const S3_ACCESS_KEY = process.env.S3_ACCESS_KEY || 'minioadmin';
const S3_SECRET_KEY = process.env.S3_SECRET_KEY || 'minioadmin';
const CORS_ORIGINS = (process.env.CORS_ORIGINS || 'http://localhost:5180').split(',');
const app = new Hono();
@ -37,7 +33,7 @@ app.post('/api/v1/songs/upload', async (c) => {
// Generate presigned upload URL
try {
const { createMukkeStorage, generateUserFileKey } = await import('@manacore/shared-storage');
const { createMukkeStorage } = await import('@manacore/shared-storage');
const storage = createMukkeStorage();
const uploadUrl = await storage.getUploadUrl(key, { expiresIn: 3600 });