3c9b65d982
- Nuxt 4 + Nuxt UI 4 + AI SDK 7 + Drizzle/SQLite - 主编规划大纲与章节简报、选派作家;作家流式写入章节文件并实时推送前端 - 逐章确认模式(默认)与自动模式;摘要与故事记忆 - 酒馆角色卡(PNG/JSON,V1-V3)与世界书导入 - 自定义最高优先级系统提示词、审稿/修改/多版本、任务日志与提示词检视 - 模拟 LLM 服务与端到端测试脚本 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
14 lines
630 B
TypeScript
14 lines
630 B
TypeScript
import { existsSync, readFileSync } from 'node:fs'
|
|
import { join } from 'node:path'
|
|
|
|
export default defineEventHandler((event) => {
|
|
const projectId = param(event, 'projectId')
|
|
const file = param(event, 'file')
|
|
if (!/^[\w-]+\.png$/.test(file) || !/^[\w-]+$/.test(projectId)) throw createError({ statusCode: 400, message: '非法文件名' })
|
|
const p = join(projectDir(projectId), 'avatars', file)
|
|
if (!existsSync(p)) throw createError({ statusCode: 404, message: '头像不存在' })
|
|
setHeader(event, 'Content-Type', 'image/png')
|
|
setHeader(event, 'Cache-Control', 'public, max-age=86400')
|
|
return readFileSync(p)
|
|
})
|