From 064f9317eb9d44d31af208e518ed240810928f7e Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Mon, 1 Jul 2024 19:30:01 +0800 Subject: [PATCH 1/8] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=84=E6=97=B6=EF=BC=8C=E5=90=91redis=E9=98=9F?= =?UTF-8?q?=E5=88=97=E9=87=8C=E6=8F=92=E5=85=A5=E8=A2=AB=E5=88=A0=E9=99=A4?= =?UTF-8?q?=E7=9A=84=E7=94=A8=E6=88=B7=E7=BB=84id?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/services/role_group_service.py | 4 ++ src/backend/bisheng/api/v1/usergroup.py | 66 ------------------- src/backend/bisheng/cache/redis.py | 7 ++ 3 files changed, 11 insertions(+), 66 deletions(-) diff --git a/src/backend/bisheng/api/services/role_group_service.py b/src/backend/bisheng/api/services/role_group_service.py index a5aaa91e8..7a24245d5 100644 --- a/src/backend/bisheng/api/services/role_group_service.py +++ b/src/backend/bisheng/api/services/role_group_service.py @@ -1,3 +1,4 @@ +import json from datetime import datetime from typing import List, Any, Dict from uuid import UUID @@ -5,6 +6,7 @@ from fastapi.encoders import jsonable_encoder from fastapi import Request, HTTPException +from bisheng.cache.redis import redis_client from bisheng.api.services.assistant import AssistantService from bisheng.api.services.audit_log import AuditLogService from bisheng.api.services.user_service import UserPayload @@ -125,6 +127,8 @@ def delete_group_hook(self, request: Request, login_user: UserPayload, group_inf GroupResourceDao.delete_group_resource_by_group_id(group_info.id) # 删除用户组下的角色列表 RoleDao.delete_role_by_group_id(group_info.id) + # 将删除事件发到redis队列中 + redis_client.rpush('delete_group', json.dumps({"id": group_info.id})) def get_group_user_list(self, group_id: int, page_size: int, page_num: int) -> List[User]: """获取全量的group列表""" diff --git a/src/backend/bisheng/api/v1/usergroup.py b/src/backend/bisheng/api/v1/usergroup.py index 3ae4bee7f..4e3f6ffc3 100644 --- a/src/backend/bisheng/api/v1/usergroup.py +++ b/src/backend/bisheng/api/v1/usergroup.py @@ -202,69 +202,3 @@ async def get_group_roles(*, "data": role_list, "total": total }) - - -@router.get("/assistant", response_model=UnifiedResponseModel[List[AssistantSimpleInfo]]) -async def get_group_assistant(*, - group_id: int = Query(..., description="用户组ID"), - keyword: str = Query(None, description="搜索关键字"), - page: int = 1, - limit: int = 10, - user: UserPayload = Depends(get_login_user)): - """ - 获取用户组可见的助手列表 - """ - # 判断是否是用户组的管理员 - if not user.check_group_admin(group_id): - return UnAuthorizedError.return_resp() - - # 查询用户组下的助手ID列表 - resource_list = GroupResourceDao.get_group_resource(group_id, ResourceTypeEnum.ASSISTANT) - res = [] - total = 0 - if resource_list: - assistant_ids = [UUID(resource.third_id) for resource in resource_list] # 查询助手 - data, total = AssistantDao.filter_assistant_by_id(assistant_ids, keyword, page, limit) - for one in data: - simple_one = AssistantService.return_simple_assistant_info(one) - res.append(simple_one) - return resp_200(data={ - "data": res, - "total": total - }) - - -@router.get("/knowledge", response_model=UnifiedResponseModel[GroupRead]) -async def get_group_knowledge(*, - group_id: int = Query(..., description="用户组ID"), - keyword: str = Query(None, description="搜索关键字"), - page: int = 1, - limit: int = 10, - user: UserPayload = Depends(get_login_user)): - """ - 获取用户组可见的知识库列表 - """ - - # 判断是否是用户组的管理员 - if not user.check_group_admin(group_id): - return UnAuthorizedError.return_resp() - - # 查询用户组下的知识库ID列表 - resource_list = GroupResourceDao.get_group_resource(group_id, ResourceTypeEnum.KNOWLEDGE) - res = [] - total = 0 - if resource_list: - knowledge_ids = [int(resource.third_id) for resource in resource_list] - # 查询知识库 - data, total = KnowledgeDao.filter_knowledge_by_ids(knowledge_ids, keyword, page, limit) - db_user_ids = {one.user_id for one in data} - user_list = UserDao.get_user_by_ids(list(db_user_ids)) - user_map = {user.user_id: user.user_name for user in user_list} - for one in data: - one_dict = one.model_dump() - one_dict["user_name"] = user_map.get(one.user_id, one.user_id) - res.append(one_dict) - return resp_200(data={ - "data": res, - "total": total - }) diff --git a/src/backend/bisheng/cache/redis.py b/src/backend/bisheng/cache/redis.py index 6b37a55bd..4d1bf6c61 100644 --- a/src/backend/bisheng/cache/redis.py +++ b/src/backend/bisheng/cache/redis.py @@ -131,6 +131,13 @@ def delete(self, key): finally: self.close() + def rpush(self, key, value): + try: + self.cluster_nodes(key) + return self.connection.rpush(key, value) + finally: + self.close() + def exists(self, key): try: self.cluster_nodes(key) From 85adad243bc5df96b532f40ca9c09a5625549e39 Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Tue, 2 Jul 2024 11:58:42 +0800 Subject: [PATCH 2/8] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=84=E6=97=B6=EF=BC=8C=E5=8F=91=E5=B8=83redis?= =?UTF-8?q?=E5=88=A0=E9=99=A4channel=EF=BC=8C=E6=B8=85=E7=90=86=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=84=E7=AE=A1=E7=90=86=E5=91=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bisheng/api/services/role_group_service.py | 6 +++++- src/backend/bisheng/cache/redis.py | 7 +++++++ src/backend/bisheng/database/models/user_group.py | 12 ++++++++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/src/backend/bisheng/api/services/role_group_service.py b/src/backend/bisheng/api/services/role_group_service.py index 7a24245d5..6e8ef57fd 100644 --- a/src/backend/bisheng/api/services/role_group_service.py +++ b/src/backend/bisheng/api/services/role_group_service.py @@ -127,8 +127,12 @@ def delete_group_hook(self, request: Request, login_user: UserPayload, group_inf GroupResourceDao.delete_group_resource_by_group_id(group_info.id) # 删除用户组下的角色列表 RoleDao.delete_role_by_group_id(group_info.id) + # 删除用户组的管理员 + UserGroupDao.delete_group_all_admin(group_info.id) # 将删除事件发到redis队列中 - redis_client.rpush('delete_group', json.dumps({"id": group_info.id})) + delete_message = json.dumps({"id": group_info.id}) + redis_client.rpush('delete_group', delete_message) + redis_client.publish('delete_group', delete_message) def get_group_user_list(self, group_id: int, page_size: int, page_num: int) -> List[User]: """获取全量的group列表""" diff --git a/src/backend/bisheng/cache/redis.py b/src/backend/bisheng/cache/redis.py index 4d1bf6c61..79ebf3905 100644 --- a/src/backend/bisheng/cache/redis.py +++ b/src/backend/bisheng/cache/redis.py @@ -138,6 +138,13 @@ def rpush(self, key, value): finally: self.close() + def publish(self, key, value): + try: + self.cluster_nodes(key) + return self.connection.publish(key, value) + finally: + self.close() + def exists(self, key): try: self.cluster_nodes(key) diff --git a/src/backend/bisheng/database/models/user_group.py b/src/backend/bisheng/database/models/user_group.py index b35b8416e..df2bd9151 100644 --- a/src/backend/bisheng/database/models/user_group.py +++ b/src/backend/bisheng/database/models/user_group.py @@ -191,3 +191,15 @@ def delete_group_admins(cls, group_id: int, admin_ids: List[int]) -> None: UserGroup.is_group_admin == 1) session.exec(statement) session.commit() + + @classmethod + def delete_group_all_admin(cls, group_id: int) -> None: + """ + 删除用户组下所有的管理员 + """ + with session_getter() as session: + statement = delete(UserGroup).where( + UserGroup.group_id == group_id).where( + UserGroup.is_group_admin == 1) + session.exec(statement) + session.commit() From e12f621011d608d6cf3314d38910355981f22e0f Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Tue, 2 Jul 2024 14:52:37 +0800 Subject: [PATCH 3/8] =?UTF-8?q?feat:=20=E5=88=A0=E9=99=A4=E7=94=A8?= =?UTF-8?q?=E6=88=B7=E7=BB=84=E7=9A=84=E9=98=9F=E5=88=97=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E8=BF=87=E6=9C=9F=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/bisheng/api/services/role_group_service.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/backend/bisheng/api/services/role_group_service.py b/src/backend/bisheng/api/services/role_group_service.py index 6e8ef57fd..66c349edf 100644 --- a/src/backend/bisheng/api/services/role_group_service.py +++ b/src/backend/bisheng/api/services/role_group_service.py @@ -132,6 +132,7 @@ def delete_group_hook(self, request: Request, login_user: UserPayload, group_inf # 将删除事件发到redis队列中 delete_message = json.dumps({"id": group_info.id}) redis_client.rpush('delete_group', delete_message) + redis_client.expire_key('delete_group', 86400) redis_client.publish('delete_group', delete_message) def get_group_user_list(self, group_id: int, page_size: int, page_num: int) -> List[User]: From 4c088fb4e30cf91843c2ec4e8441e6c409b9e0d0 Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Tue, 2 Jul 2024 18:05:33 +0800 Subject: [PATCH 4/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E4=B8=8B=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=B5=84=E6=BA=90=E7=9A=84=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/bisheng/database/models/group_resource.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/bisheng/database/models/group_resource.py b/src/backend/bisheng/database/models/group_resource.py index 314378eff..d0f179432 100644 --- a/src/backend/bisheng/database/models/group_resource.py +++ b/src/backend/bisheng/database/models/group_resource.py @@ -112,7 +112,7 @@ def get_group_all_resource(cls, group_id: int) -> List[GroupResource]: """ with session_getter() as session: return session.exec( - select(GroupResource).where(GroupResource.group_id == group_id)) + select(GroupResource).where(GroupResource.group_id == group_id)).all() @classmethod def update_group_resource(cls, group_resources: List[GroupResource]) -> List[GroupResource]: From 48924655f762501c6035375e2bedeebedb40b2ae Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Tue, 2 Jul 2024 19:05:14 +0800 Subject: [PATCH 5/8] =?UTF-8?q?fix:=20=E5=AE=A1=E8=AE=A1=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=BF=AE=E6=94=B9=E4=B8=BAtext=E7=B1=BB?= =?UTF-8?q?=E5=9E=8B=EF=BC=8C=E9=98=B2=E6=AD=A2=E5=86=85=E5=AE=B9=E8=B6=85?= =?UTF-8?q?=E9=95=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/bisheng/database/models/audit_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/bisheng/database/models/audit_log.py b/src/backend/bisheng/database/models/audit_log.py index 03083a425..7cfbda92c 100644 --- a/src/backend/bisheng/database/models/audit_log.py +++ b/src/backend/bisheng/database/models/audit_log.py @@ -64,7 +64,7 @@ class AuditLogBase(SQLModelSerializable): object_type: Optional[str] = Field(index=True, description="操作对象类型") object_id: Optional[int] = Field(index=True, description="操作对象ID") object_name: Optional[str] = Field(description="操作对象名称") - note: Optional[str] = Field(sa_column=Column(Text(255)), description="操作备注") + note: Optional[str] = Field(sa_column=Column(Text), description="操作备注") ip_address: Optional[str] = Field(index=True, description="操作时客户端的IP地址") create_time: Optional[datetime] = Field(sa_column=Column( DateTime, nullable=False, index=True, server_default=text('CURRENT_TIMESTAMP')), description="操作时间") From e09f4284aad8cac76626fd1a56bdc3d905aee755 Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Tue, 2 Jul 2024 19:44:21 +0800 Subject: [PATCH 6/8] =?UTF-8?q?fix:=20v2=E6=8E=A5=E5=8F=A3=E4=B8=8D?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E5=AE=A1=E8=AE=A1=E6=97=A5=E5=BF=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/bisheng/api/v1/knowledge.py | 25 +++++++++++++++++++++---- src/backend/bisheng/api/v2/filelib.py | 11 +---------- 2 files changed, 22 insertions(+), 14 deletions(-) diff --git a/src/backend/bisheng/api/v1/knowledge.py b/src/backend/bisheng/api/v1/knowledge.py index f1238368a..6ec5d7077 100644 --- a/src/backend/bisheng/api/v1/knowledge.py +++ b/src/backend/bisheng/api/v1/knowledge.py @@ -173,12 +173,18 @@ async def process_knowledge(*, session.add(knowledge) session.commit() + upload_knowledge_file_hook(request, login_user, knowledge_id, files) + return resp_200(result) + + +def upload_knowledge_file_hook(request: Request, login_user: UserPayload, knowledge_id: int, + file_list: List[KnowledgeFile]): + logger.info(f'act=upload_knowledge_file_hook user={login_user.user_name} knowledge_id={knowledge_id}') # 记录审计日志 file_name = "" - for one in files: + for one in file_list: file_name += "\n\n" + one.file_name AuditLogService.upload_knowledge_file(login_user, get_request_ip(request), knowledge_id, file_name) - return resp_200(result) @router.post('/create', response_model=UnifiedResponseModel[KnowledgeRead], status_code=201) @@ -220,7 +226,7 @@ def create_knowledge_hook(request: Request, knowledge: Knowledge, login_user: Us # 查询下用户所在的用户组 user_group = UserGroupDao.get_user_group(login_user.user_id) if user_group: - # 批量将助手资源插入到关联表里 + # 批量将知识库资源插入到关联表里 batch_resource = [] for one in user_group: batch_resource.append(GroupResource( @@ -438,6 +444,17 @@ def delete_knowledge_file(*, KnowledgeFileDao.delete_batch([file_id]) # 删除知识库文件的审计日志 - AuditLogService.delete_knowledge_file(login_user, get_request_ip(request), knowledge.id, knowledge_file.file_name) + delete_knowledge_file_hook(request, login_user, knowledge.id, [knowledge_file]) return resp_200(message='删除成功') + + +def delete_knowledge_file_hook(request: Request, login_user: UserPayload, knowledge_id: int, + file_list: List[KnowledgeFile]): + logger.info(f'act=delete_knowledge_file_hook user={login_user.user_name} knowledge_id={knowledge_id}') + # 记录审计日志 + # 记录审计日志 + file_name = "" + for one in file_list: + file_name += "\n\n" + one.file_name + AuditLogService.delete_knowledge_file(login_user, get_request_ip(request), knowledge_id, file_name) diff --git a/src/backend/bisheng/api/v2/filelib.py b/src/backend/bisheng/api/v2/filelib.py index f8e42d639..700097266 100644 --- a/src/backend/bisheng/api/v2/filelib.py +++ b/src/backend/bisheng/api/v2/filelib.py @@ -6,8 +6,6 @@ delete_es, delete_knowledge_by, delete_knowledge_file_vectors, delete_vector, text_knowledge) -from bisheng.api.services.user_service import UserPayload -from bisheng.api.v1.knowledge import delete_knowledge_hook, create_knowledge_hook from bisheng.api.v1.schemas import ChunkInput, UnifiedResponseModel, resp_200, resp_500 from bisheng.cache.utils import save_download_file from bisheng.database.base import session_getter @@ -33,16 +31,12 @@ @router.post('/', response_model=KnowledgeRead, status_code=201) -def creat(knowledge: KnowledgeCreate): +def create(knowledge: KnowledgeCreate): """创建知识库.""" user_id = knowledge.user_id or settings.get_from_db('default_operator').get('user') if not user_id: raise HTTPException(status_code=500, detail='未配置default_operator中user配置') - user_payload = UserPayload(**{ - "user_id": user_id - }) db_knowledge = create_knowledge(knowledge, user_id) - create_knowledge_hook(db_knowledge, user_payload) return db_knowledge @@ -129,9 +123,6 @@ def delete_knowledge_api(*, knowledge_id: int): raise HTTPException(status_code=404, detail='knowledge not found') try: delete_knowledge_by(knowledge) - delete_knowledge_hook(knowledge, UserPayload(**{ - "user_id": knowledge.user_id - })) return {'message': 'knowledge deleted successfully'} except Exception as e: logger.exception(e) From 0fe70c851b4d96a2b68b3915284934d4fdc2a1e1 Mon Sep 17 00:00:00 2001 From: GuoQing Zhang Date: Tue, 2 Jul 2024 19:46:30 +0800 Subject: [PATCH 7/8] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E5=86=85=E5=AE=B9=E8=BF=87=E5=A4=9A=E5=AF=BC=E8=87=B4=E7=9A=84?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E8=B6=85=E9=95=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/backend/bisheng/database/models/audit_log.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/bisheng/database/models/audit_log.py b/src/backend/bisheng/database/models/audit_log.py index 7cfbda92c..822072a07 100644 --- a/src/backend/bisheng/database/models/audit_log.py +++ b/src/backend/bisheng/database/models/audit_log.py @@ -63,7 +63,7 @@ class AuditLogBase(SQLModelSerializable): event_type: Optional[str] = Field(index=True, description="操作行为") object_type: Optional[str] = Field(index=True, description="操作对象类型") object_id: Optional[int] = Field(index=True, description="操作对象ID") - object_name: Optional[str] = Field(description="操作对象名称") + object_name: Optional[str] = Field(sa_column=Column(Text), description="操作对象名称") note: Optional[str] = Field(sa_column=Column(Text), description="操作备注") ip_address: Optional[str] = Field(index=True, description="操作时客户端的IP地址") create_time: Optional[datetime] = Field(sa_column=Column( From 5ea6378ec98f06502a2065ef442b098c95970da2 Mon Sep 17 00:00:00 2001 From: dolphin <78075021@qq.com> Date: Wed, 3 Jul 2024 11:31:52 +0800 Subject: [PATCH 8/8] =?UTF-8?q?fix:=20=E8=AF=84=E6=B5=8B=E7=BB=93=E6=9E=9C?= =?UTF-8?q?download?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/frontend/src/App.tsx | 2 +- .../bs-comp/chatComponent/MessagePanne.tsx | 4 +-- .../bs-comp/chatComponent/MessageSystem.tsx | 2 ++ src/frontend/src/i18n.js | 2 +- src/frontend/src/layout/MainLayout.tsx | 1 - .../ChatAppPage/components/ChatPanne.tsx | 2 +- .../pages/ChatAppPage/components/FileView.tsx | 2 +- .../src/pages/EvaluationPage/index.tsx | 25 ++++++++++--------- .../pages/SystemPage/components/EditRole.tsx | 1 - 9 files changed, 21 insertions(+), 20 deletions(-) diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index d745b0987..93bd6047c 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -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]) diff --git a/src/frontend/src/components/bs-comp/chatComponent/MessagePanne.tsx b/src/frontend/src/components/bs-comp/chatComponent/MessagePanne.tsx index e990f2d9b..707532270 100644 --- a/src/frontend/src/components/bs-comp/chatComponent/MessagePanne.tsx +++ b/src/frontend/src/components/bs-comp/chatComponent/MessagePanne.tsx @@ -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' diff --git a/src/frontend/src/components/bs-comp/chatComponent/MessageSystem.tsx b/src/frontend/src/components/bs-comp/chatComponent/MessageSystem.tsx index 474b356d6..bd77970c2 100644 --- a/src/frontend/src/components/bs-comp/chatComponent/MessageSystem.tsx +++ b/src/frontend/src/components/bs-comp/chatComponent/MessageSystem.tsx @@ -40,7 +40,9 @@ export default function MessageSystem({ data }) { return
{logMkdown} + {/* 中英 */} {data.category === 'report' && handleCopy(e.target.parentNode)}>} + {/* { handleCopy(e.target.parentNode)}>} */}
}; diff --git a/src/frontend/src/i18n.js b/src/frontend/src/i18n.js index 6619d6ae0..bd7e43a5a 100644 --- a/src/frontend/src/i18n.js +++ b/src/frontend/src/i18n.js @@ -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 diff --git a/src/frontend/src/layout/MainLayout.tsx b/src/frontend/src/layout/MainLayout.tsx index cd9e8b550..ab388898a 100755 --- a/src/frontend/src/layout/MainLayout.tsx +++ b/src/frontend/src/layout/MainLayout.tsx @@ -135,7 +135,6 @@ export default function MainLayout() { {t('menu.models')} } - {/* 中英 */} { isMenu('evaluation') && diff --git a/src/frontend/src/pages/ChatAppPage/components/ChatPanne.tsx b/src/frontend/src/pages/ChatAppPage/components/ChatPanne.tsx index a6db61bf0..cce80c336 100644 --- a/src/frontend/src/pages/ChatAppPage/components/ChatPanne.tsx +++ b/src/frontend/src/pages/ChatAppPage/components/ChatPanne.tsx @@ -186,7 +186,7 @@ export default function ChatPanne({ customWsHost = '', appendHistory = false, da { - return url.replace(/https?:\/\/[^\/]+/, '') + return url.replace(/https?:\/\/[^\/]+/, __APP_ENV__.BASE_URL) // location.origin === SASS_HOST ? url.replace(/https?:\/\/[^\/]+/, '') : url; } interface Chunk { diff --git a/src/frontend/src/pages/EvaluationPage/index.tsx b/src/frontend/src/pages/EvaluationPage/index.tsx index cc3cc5057..ae58152c1 100755 --- a/src/frontend/src/pages/EvaluationPage/index.tsx +++ b/src/frontend/src/pages/EvaluationPage/index.tsx @@ -33,6 +33,7 @@ import { EvaluationType, EvaluationTypeLabelMap, } from "./types"; +import { checkSassUrl } from "../ChatAppPage/components/FileView"; export default function EvaluationPage() { const navigate = useNavigate(); @@ -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 ( @@ -162,17 +163,17 @@ export default function EvaluationPage() {
{el.result_score ? map(el.result_score, (value, key) => { - return ( - - { - EvaluationScoreLabelMap[ - EvaluationScore[key] - ].label - } - :{value}  - - ); - }) + return ( + + { + EvaluationScoreLabelMap[ + EvaluationScore[key] + ].label + } + :{value}  + + ); + }) : "-"}
diff --git a/src/frontend/src/pages/SystemPage/components/EditRole.tsx b/src/frontend/src/pages/SystemPage/components/EditRole.tsx index 8a3af826d..bccb4db45 100644 --- a/src/frontend/src/pages/SystemPage/components/EditRole.tsx +++ b/src/frontend/src/pages/SystemPage/components/EditRole.tsx @@ -199,7 +199,6 @@ export default function EditRole({ id, name, groupId, onChange, onBeforeChange } switchDataChange(MenuType.MODEL, 'useMenu', bln)} /> - {/* 中英 */} 评测