Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ def to_human_message(prompt: str,
content=no_references_setting.get('value').replace('{question}', problem))
else:
return HumanMessage(content=prompt.replace('{data}', "").replace('{question}', problem))
temp_data = ""
temp_len = 0
data_list = []
for p in paragraph_list:
content = f"{p.title}:{p.content}"
temp_data += content
if len(temp_data) > max_paragraph_char_number:
row_data = content[0:max_paragraph_char_number - len(temp_data)]
temp_len += len(content)
if temp_len > max_paragraph_char_number:
row_data = content[0:max_paragraph_char_number - temp_len]
data_list.append(f"<data>{row_data}</data>")
break
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

顺便优化:减少内存的使用。

else:
Expand Down
4 changes: 2 additions & 2 deletions apps/models_provider/serializers/model_serializer.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,8 @@ def one_meta(self, with_valid=False):
super().is_valid(raise_exception=True)
model = QuerySet(Model).filter(id=self.data.get("id"),
workspace_id=self.data.get('workspace_id', 'None')).first()
if model is None:
raise AppApiException(500, _('Model does not exist'))
if model is None:
raise AppApiException(500, _('Model does not exist'))
return {'id': str(model.id), 'provider': model.provider, 'name': model.name, 'model_type': model.model_type,
Copy link
Copy Markdown
Contributor Author

@wangliang181230 wangliang181230 Apr 28, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

移到 if 外面,否则 model.id 报空指针,抛出 Model does not exist 更合理

'model_name': model.model_name,
'status': model.status,
Expand Down
Loading