feat: add export settings for Word document generation
- Add export configuration (untranslated text color, page orientation) - Add second page header option for multi-page exports - Integrate export settings into main export flow - Separate export settings page with visual preview
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { NextResponse } from "next/server";
|
||||
import { getConfig, saveDBConfig, saveAIConfig, type DBConfig, type AIConfig } from "@/lib/config";
|
||||
import { getConfig, saveDBConfig, saveAIConfig, saveExportConfig, type DBConfig, type AIConfig, type ExportConfig } from "@/lib/config";
|
||||
|
||||
// GET /api/config - 获取完整配置
|
||||
export async function GET() {
|
||||
@@ -18,11 +18,11 @@ export async function GET() {
|
||||
}
|
||||
|
||||
// POST /api/config - 保存配置
|
||||
// Body 格式: { db?: DBConfig, ai?: AIConfig }
|
||||
// Body 格式: { db?: DBConfig, ai?: AIConfig, export?: ExportConfig }
|
||||
export async function POST(request: Request) {
|
||||
try {
|
||||
const body = await request.json();
|
||||
const { db, ai } = body;
|
||||
const { db, ai, export: exportConfig } = body;
|
||||
|
||||
if (db) {
|
||||
saveDBConfig(db);
|
||||
@@ -32,8 +32,12 @@ export async function POST(request: Request) {
|
||||
saveAIConfig(ai);
|
||||
}
|
||||
|
||||
if (exportConfig) {
|
||||
saveExportConfig(exportConfig);
|
||||
}
|
||||
|
||||
// 如果同时发送了完整配置
|
||||
if (!db && !ai && body.db === undefined && body.ai === undefined) {
|
||||
if (!db && !ai && !exportConfig && body.db === undefined && body.ai === undefined && body.export === undefined) {
|
||||
// 可能是旧的扁平格式,尝试兼容
|
||||
if (body.apiKey !== undefined || body.baseUrl !== undefined || body.model !== undefined) {
|
||||
saveAIConfig({
|
||||
|
||||
Reference in New Issue
Block a user