Skip to content

Commit

Permalink
修复docx问题
Browse files Browse the repository at this point in the history
  • Loading branch information
iCanDoAllThingszz committed Oct 15, 2024
1 parent ac9da83 commit 8fde567
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions dbgpt/rag/knowledge/docx.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
"""Docx Knowledge."""
from typing import Any, Dict, List, Optional, Union
from docx.opc.pkgreader import _SerializedRelationships, _SerializedRelationship
from docx.opc.oxml import parse_xml

import docx
from docx.opc.oxml import parse_xml
from docx.opc.pkgreader import _SerializedRelationship, _SerializedRelationships

from dbgpt.core import Document
from dbgpt.rag.knowledge.base import (
Expand All @@ -14,20 +14,20 @@
)


def load_from_xml_v2(baseURI, rels_item_xml):
def load_from_xml_v2(base_uri, rels_item_xml):
"""
Return |_SerializedRelationships| instance loaded with the
relationships contained in *rels_item_xml*. Returns an empty
collection if *rels_item_xml* is |None|.
"""
srels = _SerializedRelationships()
serial_rels = _SerializedRelationships()
if rels_item_xml is not None:
rels_elm = parse_xml(rels_item_xml)
for rel_elm in rels_elm.Relationship_lst:
if rel_elm.target_ref in ('../NULL', 'NULL'):
continue
srels._srels.append(_SerializedRelationship(baseURI, rel_elm))
return srels
serial_rels.srels.append(_SerializedRelationship(base_uri, rel_elm))
return serial_rels


class DocxKnowledge(Knowledge):
Expand Down

0 comments on commit 8fde567

Please sign in to comment.