Skip to content

Commit

Permalink
Merge branch 'feat/0.3.2' of https://github.com/dataelement/bisheng i…
Browse files Browse the repository at this point in the history
…nto feat/0.3.2
  • Loading branch information
QwQ-wuwuwu committed Jun 28, 2024
2 parents f6c52fa + ced76bd commit 49c3dc4
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 22 deletions.
6 changes: 3 additions & 3 deletions src/frontend/src/layout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ export default function MainLayout() {
<ModelIcon className="h-6 w-6 my-[12px]" /><span className="mx-[14px] max-w-[48px] text-[14px] leading-[48px]">{t('menu.models')}</span>
</NavLink>
}
{/* {
中英
{/* 中英 */}
{
isMenu('evaluation') &&
<NavLink to='/evaluation' className={`navlink inline-flex rounded-lg w-full px-6 hover:bg-nav-hover h-12 mb-[3.5px]`}>
<EvaluatingIcon className="h-6 w-6 my-[12px]" /><span className="mx-[14px] max-w-[48px] text-[14px] leading-[48px]">{t('menu.evaluation')}</span>
</NavLink>
} */}
}
{
isAdmin && <>
<NavLink to='/sys' className={`navlink inline-flex rounded-lg w-full px-6 hover:bg-nav-hover h-12 mb-[3.5px]`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const ResultPanne = ({ chatId, words, data, onClose, onAdd, children }: { chatId
<div className="w-[300px] bg-gray-100 rounded-md py-4 px-2 h-full overflow-y-auto no-scrollbar">
{/* label */}
{/* 中英 */}
{/* <div className="mb-4 text-sm font-bold">
<div className="mb-4 text-sm font-bold">
{t('chat.filterLabel')}
<div className="tooltip fixed" data-tip={t('chat.tooltipText')}><span data-theme="light" className="badge cursor-pointer">?</span></div>
</div>
Expand All @@ -109,7 +109,7 @@ const ResultPanne = ({ chatId, words, data, onClose, onAdd, children }: { chatId
}}></input></div> :
<div className="badge badge-info gap-2 cursor-pointer bg-[rgba(53,126,249,.86)] text-gray-50" onClick={handleOpenInput}><span>{t('chat.addCustomLabel')}</span></div>
}
</div> */}
</div>
{/* files */}
<div className="mt-4">
<p className="mb-4 text-sm font-bold">{t('chat.sourceDocumentsLabel')}</p>
Expand Down
8 changes: 4 additions & 4 deletions src/frontend/src/pages/LoginPage/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -178,10 +178,10 @@ export const LoginPage = () => {
)
}
{/* 中英 */}
<Button
{/* <Button
className='h-[48px] mt-[32px] dark:bg-button'
disabled={isLoading} onClick={handleLogin} >{t('login.loginButton')}</Button>
{/* {
disabled={isLoading} onClick={handleLogin} >{t('login.loginButton')}</Button> */}
{
showLogin ? <>
<div className="text-center">
<a href="javascript:;" className=" text-blue-500 text-sm hover:underline" onClick={() => setShowLogin(false)}>{t('login.noAccountRegister')}</a>
Expand All @@ -198,7 +198,7 @@ export const LoginPage = () => {
className='h-[48px] mt-[32px] dark:bg-button'
disabled={isLoading} onClick={handleRegister} >{t('login.registerButton')}</Button>
</>
} */}
}
{appConfig.hasSSO && <LoginBridge />}
</div>
<div className=" absolute right-[16px] bottom-[16px] flex">
Expand Down
4 changes: 2 additions & 2 deletions src/frontend/src/pages/SystemPage/components/EditRole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -200,12 +200,12 @@ export default function EditRole({ id, name, groupId, onChange, onBeforeChange }
</TableCell>
</TableRow>
{/* 中英 */}
{/* <TableRow>
<TableRow>
<TableCell className="font-medium">评测</TableCell>
<TableCell className="text-right">
<Switch checked={form.useMenu.includes(MenuType.EVALUATION)} onCheckedChange={(bln) => switchDataChange(MenuType.EVALUATION, 'useMenu', bln)} />
</TableCell>
</TableRow> */}
</TableRow>
</TableBody>
</Table>
</div>
Expand Down
56 changes: 45 additions & 11 deletions src/frontend/vite.config.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import react from "@vitejs/plugin-react-swc";
import { visualizer } from "rollup-plugin-visualizer";
import path from "path";
import { defineConfig } from "vite";
import { createHtmlPlugin } from 'vite-plugin-html';
import { viteStaticCopy } from 'vite-plugin-static-copy';
import svgr from "vite-plugin-svgr";
const apiRoutes = ["^/api/", "/health"];
import path from "path";

// Use environment variable to determine the target.
const target = process.env.VITE_PROXY_TARGET || "http://192.168.106.120:3002";
const apiRoutes = ["^/api/", "/health"];

const proxyTargets = apiRoutes.reduce((proxyObj, route) => {
proxyObj[route] = {
Expand All @@ -16,19 +17,41 @@ const proxyTargets = apiRoutes.reduce((proxyObj, route) => {
secure: false,
ws: true,
};
// 文件服务地址
proxyObj['/bisheng'] = {
target: "http://127.0.0.1:50061",
changeOrigin: true,
withCredentials: true,
secure: false
}
return proxyObj;
}, {});
// 文件服务地址
proxyTargets['/bisheng'] = {
target: "http://127.0.0.1:50061",
changeOrigin: true,
withCredentials: true,
secure: false
}
proxyTargets['/custom_base/api'] = {
target,
changeOrigin: true,
withCredentials: true,
secure: false,
rewrite: (path) => {
return path.replace(/^\/custom_base\/api/, '/api');
},
configure: (proxy, options) => {
proxy.on('proxyReq', (proxyReq, req, res) => {
console.log('Proxying request to:', proxyReq.path);
});
}
}

/**
* 开启子路由访问
* 开启后一般外层网管匹配【custom】时直接透传转到内层网关
* 内层网关访问 api或者前端静态资源需要去掉【custom】前缀
*/
// const app_env = { BASE_URL: '/custom' }
const app_env = { BASE_URL: '' }

export default defineConfig(() => {
return {
// base: '/poo',
base: app_env.BASE_URL || '/',
build: {
// minify: 'esbuild', // 使用 esbuild 进行 Tree Shaking 和压缩
outDir: "build",
Expand All @@ -51,6 +74,14 @@ export default defineConfig(() => {
plugins: [
react(),
svgr(),
createHtmlPlugin({
minify: true,
inject: {
data: {
aceScriptSrc: `<script src="${process.env.NODE_ENV === 'production' ? app_env.BASE_URL : ''}/node_modules/ace-builds/src-min-noconflict/ace.js" type="text/javascript"></script>`,
},
},
}),
viteStaticCopy({
targets: [
{
Expand All @@ -74,6 +105,9 @@ export default defineConfig(() => {
// open: true,
// })
],
define: {
__APP_ENV__: JSON.stringify(app_env)
},
server: {
host: '0.0.0.0',
port: 3001,
Expand Down

0 comments on commit 49c3dc4

Please sign in to comment.