-
Notifications
You must be signed in to change notification settings - Fork 2.8k
fix: Fix null pointer exception #5136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -258,10 +258,10 @@ def get_role_list(user, | |
| """ | ||
| version = Cache_Version.ROLE_LIST.get_version() | ||
| key = Cache_Version.ROLE_LIST.get_key(user_id=user.id) | ||
| workspace_list = cache.get(key, version=version) | ||
| role_list = cache.get(key, version=version) | ||
| # 获取权限列表 | ||
| is_query_model = workspace_user_role_mapping_model is not None and workspace_model is not None and role_model is not None and role_permission_mapping_model is not None | ||
| if workspace_list is None: | ||
| if role_list is None: | ||
| if is_query_model: | ||
| # 获取工作空间 用户 角色映射数据 | ||
| workspace_user_role_mapping_list = QuerySet(workspace_user_role_mapping_model).filter(user_id=user.id) | ||
|
|
@@ -274,16 +274,14 @@ def get_role_list(user, | |
| for | ||
| workspace_user_role_mapping in | ||
| workspace_user_role_mapping_list], []))) | ||
| cache.set(key, workspace_list, version=version) | ||
| return role_list | ||
| cache.set(key, role_list, version=version) | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
| else: | ||
| if user.role == RoleConstants.ADMIN.value.__str__(): | ||
| role_list = [user.role, get_role_permission(RoleConstants.WORKSPACE_MANAGE, 'default')] | ||
| else: | ||
| role_list = [user.role, get_role_permission(RoleConstants.USER, 'default')] | ||
| cache.set(key, role_list, version=version) | ||
| return role_list | ||
| return workspace_list | ||
| return role_list | ||
|
|
||
|
|
||
| def get_auth(user): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -22,7 +22,7 @@ def get_title_row_index_dict(title_row_list): | |
| title_row_index_dict = {} | ||
| if len(title_row_list) == 1: | ||
| title_row_index_dict['content'] = 0 | ||
| elif len(title_row_list) == 1: | ||
| elif len(title_row_list) == 2: | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 修正错误的判断值 |
||
| title_row_index_dict['title'] = 0 | ||
| title_row_index_dict['content'] = 1 | ||
| else: | ||
|
|
@@ -33,11 +33,11 @@ def get_title_row_index_dict(title_row_list): | |
| title_row = title_row_list[index] | ||
| if title_row is None: | ||
| title_row = '' | ||
| if title_row.startswith('分段标题'): | ||
| elif title_row.startswith('分段标题'): | ||
| title_row_index_dict['title'] = index | ||
| if title_row.startswith('分段内容'): | ||
| elif title_row.startswith('分段内容'): | ||
| title_row_index_dict['content'] = index | ||
| if title_row.startswith('问题'): | ||
| elif title_row.startswith('问题'): | ||
| title_row_index_dict['problem_list'] = index | ||
| return title_row_index_dict | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -91,9 +91,9 @@ def get_embedding_model(model_id): | |
|
|
||
|
|
||
| class EmbedDocuments(serializers.Serializer): | ||
| texts = serializers.ListField(required=True, child=serializers.CharField(required=True, | ||
| label=_('vector text')), | ||
| label=_('vector text list')), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 多了一个逗号,导致 |
||
| texts = serializers.ListField(required=True, | ||
| child=serializers.CharField(required=True, label=_('vector text')), | ||
| label=_('vector text list')) | ||
|
|
||
|
|
||
| class EmbedQuery(serializers.Serializer): | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -108,13 +108,12 @@ def generate_video(self, prompt, negative_prompt=None, first_frame_url=None, las | |
| # --- 等待任务完成 --- | ||
| rsp = self._safe_call(VideoSynthesis.wait, task=rsp, api_key=self.api_key) | ||
| if rsp.status_code == HTTPStatus.OK: | ||
| maxkb_logger.info("视频生成完成!视频 URL:", rsp.output.video_url) | ||
| if rsp.output.task_status == "SUCCEEDED": | ||
| maxkb_logger.info("视频生成完成!视频 URL:", rsp.output.video_url) | ||
| maxkb_logger.info(f'视频生成完成!视频 URL: {rsp.output.video_url}') | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 上面重复记录了日志,删除掉上面的,保存 |
||
| return rsp.output.video_url | ||
| else: | ||
| maxkb_logger.error("视频生成失败!") | ||
| raise RuntimeError(f'生成失败, message: {rsp.output.message}') | ||
| maxkb_logger.error(f'视频生成失败: {rsp.output.message}') | ||
| raise RuntimeError(f'视频生成失败, message: {rsp.output.message}') | ||
| else: | ||
| maxkb_logger.error(f'生成失败,status_code: {rsp.status_code}, code: {rsp.code}, message: {rsp.message}') | ||
| raise RuntimeError(f'生成失败,status_code: {rsp.status_code}, code: {rsp.code}, message: {rsp.message}') | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -28,9 +28,9 @@ def get_embedding_model(model_id): | |
|
|
||
|
|
||
| class EmbedDocuments(serializers.Serializer): | ||
| texts = serializers.ListField(required=True, child=serializers.CharField(required=True, | ||
| label=_('vector text')), | ||
| label=_('vector text list')), | ||
|
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 同上:多了一个逗号,导致 |
||
| texts = serializers.ListField(required=True, | ||
| child=serializers.CharField(required=True, label=_('vector text')), | ||
| label=_('vector text list')) | ||
|
|
||
|
|
||
| class EmbedQuery(serializers.Serializer): | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
避免
v[0]空指针(以前合并的PR漏改的一处问题)