Skip to content

Commit

Permalink
fix: 评测结果download
Browse files Browse the repository at this point in the history
  • Loading branch information
dolphin0618 committed Jul 3, 2024
1 parent 0fe70c8 commit 5ea6378
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/frontend/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ export default function App() {

// 动态路由根据权限
const router = useMemo(() => {
return getAdminRouter()
// return getAdminRouter()
if (user && ['admin', 'group_admin'].includes(user.role)) return getAdminRouter()
return user?.user_id ? getPrivateRouter(user.web_menu) : null
}, [user])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ export default function MessagePanne({ useName, guideWord, loadMore }) {
type = 'separator'
} else if (msg.files?.length) {
type = 'file'
} else if (['tool', 'flow', 'knowledge'].includes(msg.category)) {
// || msg.category === 'processing') { // 项目演示?
} else if (['tool', 'flow', 'knowledge'].includes(msg.category)
|| msg.category === 'processing') { // 项目演示?
type = 'runLog'
} else if (msg.thought) {
type = 'system'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ export default function MessageSystem({ data }) {
return <div className="py-1">
<div className={`relative rounded-sm px-6 py-4 border text-sm ${data.category === 'guide' ? 'bg-[#EDEFF6]' : 'bg-slate-50'} ${border[data.category || 'system']}`}>
{logMkdown}
{/* 中英 */}
{data.category === 'report' && <CopyIcon className=" absolute right-4 top-2 cursor-pointer" onClick={(e) => handleCopy(e.target.parentNode)}></CopyIcon>}
{/* {<CopyIcon className=" absolute right-4 top-2 cursor-pointer" onClick={(e) => handleCopy(e.target.parentNode)}></CopyIcon>} */}
</div>
</div>
};
2 changes: 1 addition & 1 deletion src/frontend/src/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ i18n.use(Backend)
ns: ['bs'],
lng: 'zh', // userLanguage === 'zh' ? userLanguage : 'en', // 除中文即英文
backend: {
loadPath: __APP_ENV__.BASE_URL + '/locales/{{lng}}/{{ns}}.json'
loadPath: __APP_ENV__.BASE_URL + '/locales/{{lng}}/{{ns}}.json?v=' + new Date().getTime()
},
interpolation: {
escapeValue: false // react already safes from xss
Expand Down
1 change: 0 additions & 1 deletion src/frontend/src/layout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,6 @@ 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]`}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ export default function ChatPanne({ customWsHost = '', appendHistory = false, da
</div>
<ChatComponent
form={flowSate.isForm}
// stop={flowSate.isReport || flowSate.isRoom}
stop={flowSate.isReport || flowSate.isRoom}
useName={sendUserName}
guideWord={flow.guide_word}
wsUrl={wsUrl}
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/src/pages/ChatAppPage/components/FileView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FixedSizeList as List, areEqual } from 'react-window';

const SASS_HOST = 'https://bisheng.dataelem.com'
export const checkSassUrl = (url: string) => {
return url.replace(/https?:\/\/[^\/]+/, '')
return url.replace(/https?:\/\/[^\/]+/, __APP_ENV__.BASE_URL)
// location.origin === SASS_HOST ? url.replace(/https?:\/\/[^\/]+/, '') : url;
}
interface Chunk {
Expand Down
25 changes: 13 additions & 12 deletions src/frontend/src/pages/EvaluationPage/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import {
EvaluationType,
EvaluationTypeLabelMap,
} from "./types";
import { checkSassUrl } from "../ChatAppPage/components/FileView";

export default function EvaluationPage() {
const navigate = useNavigate();
Expand Down Expand Up @@ -76,7 +77,7 @@ export default function EvaluationPage() {

const handleDownload = async (el) => {
const { url } = await getEvaluationUrlApi(el.result_file_path);
await downloadFile(url, el.file_name);
await downloadFile(checkSassUrl(url), el.file_name);
};

return (
Expand Down Expand Up @@ -162,17 +163,17 @@ export default function EvaluationPage() {
<div className="flex flex-wrap">
{el.result_score
? map(el.result_score, (value, key) => {
return (
<span className="whitespace-nowrap">
{
EvaluationScoreLabelMap[
EvaluationScore[key]
].label
}
:{value}&nbsp;
</span>
);
})
return (
<span className="whitespace-nowrap">
{
EvaluationScoreLabelMap[
EvaluationScore[key]
].label
}
:{value}&nbsp;
</span>
);
})
: "-"}
</div>
</TableCell>
Expand Down
1 change: 0 additions & 1 deletion src/frontend/src/pages/SystemPage/components/EditRole.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ export default function EditRole({ id, name, groupId, onChange, onBeforeChange }
<Switch checked={form.useMenu.includes(MenuType.MODEL)} onCheckedChange={(bln) => switchDataChange(MenuType.MODEL, 'useMenu', bln)} />
</TableCell>
</TableRow>
{/* 中英 */}
<TableRow>
<TableCell className="font-medium">评测</TableCell>
<TableCell className="text-right">
Expand Down

0 comments on commit 5ea6378

Please sign in to comment.