diff --git a/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py b/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py index c8e3723ba..dac0370f8 100644 --- a/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py +++ b/apps/application/flow/step_node/image_understand_step_node/impl/base_image_understand_node.py @@ -130,7 +130,7 @@ class BaseImageUnderstandNode(IImageUnderstandNode): file_id_list = [image.get('file_id') for image in image_list] return HumanMessage(content=[ {'type': 'text', 'text': data['question']}, - *[{'type': 'image_url', 'image_url': {'url': f'/oss/file/{file_id}'}} for file_id in file_id_list] + *[{'type': 'image_url', 'image_url': {'url': f'./oss/file/{file_id}'}} for file_id in file_id_list] ]) return HumanMessage(content=chat_record.problem_text) diff --git a/apps/common/handle/impl/qa/xlsx_parse_qa_handle.py b/apps/common/handle/impl/qa/xlsx_parse_qa_handle.py index 4adf2ff48..71332b1b9 100644 --- a/apps/common/handle/impl/qa/xlsx_parse_qa_handle.py +++ b/apps/common/handle/impl/qa/xlsx_parse_qa_handle.py @@ -39,7 +39,7 @@ def handle_sheet(file_name, sheet, image_dict): content = str(content.value) image = image_dict.get(content, None) if image is not None: - content = f'![](/oss/file/{image.id})' + content = f'![](./oss/file/{image.id})' paragraph_list.append({'title': title[0:255], 'content': content[0:102400], 'problem_list': problem_list}) diff --git a/apps/common/handle/impl/qa/zip_parse_qa_handle.py b/apps/common/handle/impl/qa/zip_parse_qa_handle.py index 0fa72fe3e..cdf56ef15 100644 --- a/apps/common/handle/impl/qa/zip_parse_qa_handle.py +++ b/apps/common/handle/impl/qa/zip_parse_qa_handle.py @@ -98,12 +98,12 @@ def get_image_list(result_list: list, zip_files: List[str]): else: image_file_list.append({'source_file': image_path, 'image_id': new_image_id}) - content = content.replace(source_image_path, f'/oss/file/{new_image_id}') + content = content.replace(source_image_path, f'./oss/file/{new_image_id}') p['content'] = content else: image_file_list.append({'source_file': image_path, 'image_id': new_image_id}) - content = content.replace(source_image_path, f'/oss/file/{new_image_id}') + content = content.replace(source_image_path, f'./oss/file/{new_image_id}') p['content'] = content return image_file_list diff --git a/apps/common/handle/impl/table/xlsx_parse_table_handle.py b/apps/common/handle/impl/table/xlsx_parse_table_handle.py index 155c8266a..0a16fa25e 100644 --- a/apps/common/handle/impl/table/xlsx_parse_table_handle.py +++ b/apps/common/handle/impl/table/xlsx_parse_table_handle.py @@ -43,7 +43,7 @@ class XlsxParseTableHandle(BaseParseTableHandle): image = image_dict.get(cell_value, None) if image is not None: - cell_value = f'![](/oss/file/{image.id})' + cell_value = f'![](./oss/file/{image.id})' # 使用标题作为键,单元格的值作为值存入字典 row_data[headers[col_idx]] = cell_value diff --git a/apps/common/handle/impl/text/doc_split_handle.py b/apps/common/handle/impl/text/doc_split_handle.py index 3063c3fab..b1ed58177 100644 --- a/apps/common/handle/impl/text/doc_split_handle.py +++ b/apps/common/handle/impl/text/doc_split_handle.py @@ -44,7 +44,7 @@ def image_to_mode(image, doc: Document, images_list, get_image_id): if len([i for i in images_list if i.id == image_uuid]) == 0: image = File(id=image_uuid, file_name=part.filename, meta={'debug': False, 'content': part.blob}) images_list.append(image) - return f'![](/oss/file/{image_uuid})' + return f'![](./oss/file/{image_uuid})' return None return None diff --git a/apps/common/handle/impl/text/xlsx_split_handle.py b/apps/common/handle/impl/text/xlsx_split_handle.py index 845a12828..55f3786ce 100644 --- a/apps/common/handle/impl/text/xlsx_split_handle.py +++ b/apps/common/handle/impl/text/xlsx_split_handle.py @@ -20,7 +20,7 @@ from common.utils.logger import maxkb_logger def post_cell(image_dict, cell_value): image = image_dict.get(cell_value, None) if image is not None: - return f'![](/oss/file/{image.id})' + return f'![](./oss/file/{image.id})' return cell_value.replace('\n', '
').replace('|', '|') diff --git a/apps/common/handle/impl/text/zip_split_handle.py b/apps/common/handle/impl/text/zip_split_handle.py index 0b03434d5..d448f28cb 100644 --- a/apps/common/handle/impl/text/zip_split_handle.py +++ b/apps/common/handle/impl/text/zip_split_handle.py @@ -92,12 +92,12 @@ def get_image_list(result_list: list, zip_files: List[str]): else: image_file_list.append({'source_file': image_path, 'image_id': new_image_id}) - content = content.replace(source_image_path, f'/oss/file/{new_image_id}') + content = content.replace(source_image_path, f'./oss/file/{new_image_id}') p['content'] = content else: image_file_list.append({'source_file': image_path, 'image_id': new_image_id}) - content = content.replace(source_image_path, f'/oss/file/{new_image_id}') + content = content.replace(source_image_path, f'./oss/file/{new_image_id}') p['content'] = content return image_file_list diff --git a/apps/knowledge/serializers/common.py b/apps/knowledge/serializers/common.py index b8551bb00..2d97fc00d 100644 --- a/apps/knowledge/serializers/common.py +++ b/apps/knowledge/serializers/common.py @@ -167,8 +167,8 @@ def write_image(zip_path: str, image_list: List[str]): search = re.search("\(.*\)", image) if search: text = search.group() - if text.startswith('(/oss/file/'): - r = text.replace('(/oss/file/', '').replace(')', '') + if text.startswith('(./oss/file/'): + r = text.replace('(./oss/file/', '').replace(')', '') r = r.strip().split(" ")[0] if not is_valid_uuid(r): break diff --git a/apps/tools/serializers/tool.py b/apps/tools/serializers/tool.py index e9b3f3155..e9ec68b7e 100644 --- a/apps/tools/serializers/tool.py +++ b/apps/tools/serializers/tool.py @@ -452,7 +452,7 @@ class ToolSerializer(serializers.Serializer): ) file.save(self.data.get('image').read()) - tool.icon = f'/oss/file/{file_id}' + tool.icon = f'./oss/file/{file_id}' tool.save() return tool.icon @@ -475,14 +475,7 @@ class ToolSerializer(serializers.Serializer): Q(scope=ToolScope.INTERNAL) & Q(is_active=True) ) - # 处理动态url - prefix = CONFIG.get_admin_path() - return [ - { - **tool, - 'icon': tool['icon'].replace('/admin', prefix), - } for tool in ToolModelSerializer(query_set, many=True).data - ] + return ToolModelSerializer(query_set, many=True).data class AddInternalTool(serializers.Serializer): user_id = serializers.UUIDField(required=True, label=_("User ID"))