Skip to content

Commit

Permalink
fix: 修复在线知识库爬取文档名超过128个字符报错 #706 (#778)
Browse files Browse the repository at this point in the history
(cherry picked from commit 3249811)
  • Loading branch information
shaohuzhang1 committed Jul 16, 2024
1 parent 56a7b7b commit 499fc90
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/dataset/serializers/document_serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,13 +656,13 @@ def handler(source_url: str, selector, response: Fork.Response):
paragraphs = get_split_model('web.md').parse(response.content)
# 插入
DocumentSerializers.Create(data={'dataset_id': dataset_id}).save(
{'name': source_url, 'paragraphs': paragraphs,
{'name': source_url[0:128], 'paragraphs': paragraphs,
'meta': {'source_url': source_url, 'selector': selector},
'type': Type.web}, with_valid=True)
except Exception as e:
logging.getLogger("max_kb_error").error(f'{str(e)}:{traceback.format_exc()}')
else:
Document(name=source_url,
Document(name=source_url[0:128],
meta={'source_url': source_url, 'selector': selector},
type=Type.web,
char_length=0,
Expand Down

0 comments on commit 499fc90

Please sign in to comment.