mirror of
https://github.com/foxhui/WebAI2API.git
synced 2026-06-16 21:03:59 +08:00
fix: 修复媒体文件路径缺失目录前缀 & WebUI 请求历史改进 (ref #70)
- 修复媒体文件服务接口未拼接 mediaDir 导致图片无法显示的问题 - 历史模块路径改为绝对路径,与 config 模块保持一致 - Prompt 列支持点击弹窗预览完整内容 - 预览弹窗新增「复制全文」按钮 - 重发失败记录时自动删除旧的失败条目
This commit is contained in:
@@ -43,7 +43,8 @@ import {
|
||||
deleteByDateRange as deleteHistoryByDateRange,
|
||||
retryMediaDownload,
|
||||
getStats as getHistoryStats,
|
||||
getModelList as getHistoryModelList
|
||||
getModelList as getHistoryModelList,
|
||||
getMediaDir
|
||||
} from '../../../utils/history.js';
|
||||
import path from 'path';
|
||||
import fs from 'fs/promises';
|
||||
@@ -519,7 +520,8 @@ export function createAdminRouter(context) {
|
||||
}
|
||||
|
||||
try {
|
||||
const data = await fs.readFile(filepath);
|
||||
const fullPath = path.join(getMediaDir(), filepath);
|
||||
const data = await fs.readFile(fullPath);
|
||||
const ext = path.extname(filepath).toLowerCase();
|
||||
const mimeTypes = {
|
||||
'.png': 'image/png',
|
||||
|
||||
@@ -8,7 +8,7 @@ import fs from 'fs/promises';
|
||||
import path from 'path';
|
||||
import { logger } from './logger.js';
|
||||
|
||||
const DATA_DIR = 'data/history';
|
||||
const DATA_DIR = path.join(process.cwd(), 'data', 'history');
|
||||
const DB_PATH = path.join(DATA_DIR, 'history.db');
|
||||
const MEDIA_DIR = path.join(DATA_DIR, 'media');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user