mirror of
https://github.com/luckyyzh/pi-agent-integrated.git
synced 2026-10-03 02:59:35 +00:00
- FileViewer 新增文本编辑模式(textarea + 保存/取消 + Ctrl+S) - 后端 /api/files POST 新增 type=write 原子写入 - i18n 补充编辑相关文案(en/zh-CN) - searxng-search: 加强 web_search 自动搜索条件 - worktree/next.config: 路径比较与 allowedDevOrigins 优化
57 lines
1.6 KiB
TypeScript
57 lines
1.6 KiB
TypeScript
import type { NextConfig } from "next";
|
|
import { readFileSync } from "fs";
|
|
import { join } from "path";
|
|
|
|
const { version } = JSON.parse(readFileSync(join(__dirname, "package.json"), "utf8")) as { version: string };
|
|
let piVersion = "unknown";
|
|
try {
|
|
const piPkgPath = join(__dirname, "node_modules/@earendil-works/pi-coding-agent/package.json");
|
|
piVersion = (JSON.parse(readFileSync(piPkgPath, "utf8")) as { version: string }).version;
|
|
} catch { /* package not found, use default */ }
|
|
|
|
const allowedDevOrigins = [
|
|
"192.168.*.*",
|
|
...(process.env.PI_WEB_ALLOWED_HOSTS?.split(",") ?? []),
|
|
].map((origin) => origin.trim()).filter(Boolean);
|
|
|
|
const nextConfig: NextConfig = {
|
|
devIndicators: false,
|
|
serverExternalPackages: [
|
|
"undici",
|
|
"@earendil-works/pi-coding-agent",
|
|
"@earendil-works/pi-agent-core",
|
|
"@earendil-works/pi-ai",
|
|
"@earendil-works/pi-tui",
|
|
],
|
|
allowedDevOrigins,
|
|
async headers() {
|
|
return [
|
|
{
|
|
source: "/",
|
|
headers: [
|
|
{ key: "Cache-Control", value: "private, no-cache, max-age=0, must-revalidate" },
|
|
],
|
|
},
|
|
{
|
|
source: "/sw.js",
|
|
headers: [
|
|
{ key: "Cache-Control", value: "public, max-age=0, must-revalidate" },
|
|
{ key: "Service-Worker-Allowed", value: "/" },
|
|
],
|
|
},
|
|
{
|
|
source: "/manifest.webmanifest",
|
|
headers: [
|
|
{ key: "Cache-Control", value: "public, max-age=0, must-revalidate" },
|
|
],
|
|
},
|
|
];
|
|
},
|
|
env: {
|
|
NEXT_PUBLIC_APP_VERSION: version,
|
|
NEXT_PUBLIC_PI_VERSION: piVersion,
|
|
},
|
|
};
|
|
|
|
export default nextConfig;
|