feat(platform): 开发环境 - 新增 Docker 热更新并完善私网上游指引 (#122)
* feat(platform): 开发环境 - 新增 Docker 热更新开发配置 * docs(platform): 开发环境 - 记录 Fork 分支同步流程 * fix(platform): 开发环境 - 避让端口冲突并持久化构建缓存 * fix(platform): 模型渠道 - 改进私网上游配置指引 * docs(platform): 开发环境 - 本机升级流程仅保留在本地手册 * feat(security): 自定义渠道 - 允许白名单主机使用 HTTP 中转 --------- Co-authored-by: sqy941013 <sqy941013@users.noreply.github.com>
This commit is contained in:
1 parent
50d8c2854a
commit
5e93fa7704
10 files changed
+173
-13
No files matched your search
@@ -50,6 +50,15 @@ function isConfigSection(value: string | null): value is ConfigSectionKey {
|
||||
return configSections.some((section) => section.key === value);
|
||||
}
|
||||
|
||||
function channelModelFetchErrorMessage(error: unknown) {
|
||||
const detail = error instanceof Error ? error.message : "读取模型失败";
|
||||
// 私网地址会在实际生成时继续被 SSRF 防护拦截,不能提示用户靠手填模型绕过。
|
||||
if (detail.includes("不允许访问本机") || detail.includes("不允许访问保留地址")) {
|
||||
return `${detail};可信私网服务需由部署管理员配置 CANVAS_ALLOWED_PRIVATE_UPSTREAM_HOSTS`;
|
||||
}
|
||||
return `${detail};也可以直接在模型列表中手动输入模型名`;
|
||||
}
|
||||
|
||||
export default function SettingsPage() {
|
||||
const { message } = App.useApp();
|
||||
const navigate = useNavigate();
|
||||
@@ -184,7 +193,7 @@ export default function SettingsPage() {
|
||||
);
|
||||
message.success(`${latestChannel.name || "当前渠道"}模型列表已更新`);
|
||||
} catch (error) {
|
||||
message.error(error instanceof Error ? `${error.message};也可以直接在模型列表中手动输入模型名` : "读取模型失败,可直接手动输入模型名");
|
||||
message.error(channelModelFetchErrorMessage(error));
|
||||
} finally {
|
||||
setChannelLoading(channel.id, false);
|
||||
}
|
||||
|
||||
+5
-2
@@ -7,6 +7,7 @@ import { defineConfig } from "vite";
|
||||
const webDir = dirname(fileURLToPath(import.meta.url));
|
||||
const appVersion = readFileSync(resolve(webDir, "../VERSION"), "utf8").trim();
|
||||
const appChangelog = readFileSync(resolve(webDir, "../CHANGELOG.md"), "utf8");
|
||||
const apiProxyTarget = process.env.VITE_API_PROXY_TARGET?.trim() || "http://127.0.0.1:8080";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
@@ -17,12 +18,14 @@ export default defineConfig({
|
||||
server: {
|
||||
proxy: {
|
||||
"/api": {
|
||||
target: "http://127.0.0.1:8080",
|
||||
target: apiProxyTarget,
|
||||
changeOrigin: true,
|
||||
xfwd: true,
|
||||
},
|
||||
"/oauth/linuxdo/callback": {
|
||||
target: "http://127.0.0.1:8080",
|
||||
target: apiProxyTarget,
|
||||
changeOrigin: true,
|
||||
xfwd: true,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user