chore: version info modal
This commit is contained in:
+8
-3
@@ -1,9 +1,13 @@
|
||||
import { defineConfig } from '@umijs/max';
|
||||
import theme from './theme';
|
||||
const CompressionWebpackPlugin = require('compression-webpack-plugin');
|
||||
|
||||
import proxy from './proxy';
|
||||
import routes from './routes';
|
||||
import theme from './theme';
|
||||
import { getBranchInfo } from './utils';
|
||||
const CompressionWebpackPlugin = require('compression-webpack-plugin');
|
||||
|
||||
const versionInfo = getBranchInfo();
|
||||
process.env.VERSION = JSON.stringify(versionInfo);
|
||||
|
||||
const env = process.env.NODE_ENV;
|
||||
const isProduction = env === 'production';
|
||||
|
||||
@@ -15,6 +19,7 @@ export default defineConfig({
|
||||
history: {
|
||||
type: 'hash'
|
||||
},
|
||||
|
||||
base: process.env.npm_config_base || '/',
|
||||
...(isProduction
|
||||
? {
|
||||
|
||||
+3
-3
@@ -1,16 +1,16 @@
|
||||
const proxyTableList = ['cli', 'v1', 'auth', 'v1-openai'];
|
||||
const proxyTableList = ['cli', 'v1', 'auth', 'v1-openai', 'version'];
|
||||
|
||||
// @ts-ingore
|
||||
export default function createProxyTable(target?: string) {
|
||||
const proxyTable = proxyTableList.reduce(
|
||||
(obj: Record<string, object>, api) => {
|
||||
const newTarget = target || 'http://localhost';
|
||||
obj[`/${api}/`] = {
|
||||
obj[`/${api}`] = {
|
||||
target: newTarget,
|
||||
changeOrigin: true,
|
||||
secure: false,
|
||||
ws: true,
|
||||
pathRewrite: (pth: string) => pth.replace(`/^/${api}/`, `/${api}`),
|
||||
pathRewrite: (pth: string) => pth.replace(`/^/${api}`, `/${api}`),
|
||||
// onProxyRes: (proxyRes: any, req: any, res: any) => {
|
||||
// if (req.headers.accept === 'text/event-stream') {
|
||||
// res.writeHead(res.statusCode, {
|
||||
|
||||
+1
-1
@@ -9,5 +9,5 @@ export const getBranchInfo = () => {
|
||||
.execSync(`git tag --contains ${latestCommit}`)
|
||||
.toString()
|
||||
.trim();
|
||||
return { version: versionTag, commitId: latestCommit };
|
||||
return { version: versionTag || 'dev', commitId: latestCommit.slice(0, 7) };
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user