mirror of
https://github.com/Memo-2023/mana-monorepo.git
synced 2026-05-14 20:01:09 +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' }) });
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue