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
2 changes: 1 addition & 1 deletion api/controllers/files/image_preview.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ def get(self, file_id: UUID):
if args.as_attachment:
encoded_filename = quote(upload_file.name)
response.headers["Content-Disposition"] = f"attachment; filename*=UTF-8''{encoded_filename}"
response.headers["Content-Type"] = "application/octet-stream"
response.headers["Content-Type"] = "application/octet-stream"

enforce_download_for_html(
response,
Expand Down
9 changes: 7 additions & 2 deletions api/core/app/apps/advanced_chat/app_generator.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@
from models.enums import WorkflowRunTriggeredFrom
from services.conversation_service import ConversationService
from services.errors.conversation import ConversationNotExistsError
from services.errors.message import MessageNotExistsError
from services.workflow_draft_variable_service import (
DraftVarLoader,
WorkflowDraftVariableService,
Expand Down Expand Up @@ -616,8 +617,12 @@ def _generate_worker(

with preserve_flask_contexts(flask_app, context_vars=context):
# get conversation and message
conversation = self._get_conversation(conversation_id)
message = self._get_message(message_id)
try:
conversation = self._get_conversation(conversation_id)
message = self._get_message(message_id)
except (ConversationNotExistsError, MessageNotExistsError) as e:
queue_manager.publish_error(e, PublishFrom.APPLICATION_MANAGER)
return

with Session(db.engine, expire_on_commit=False) as session:
workflow = session.scalar(
Expand Down
3 changes: 2 additions & 1 deletion api/services/variable_truncator.py
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ def _truncate_array(self, value: list[object], target_size: int) -> _PartResult[
used_size += 1 # Account for comma

if used_size > target_size:
truncated = True
break

remaining_budget = target_size - used_size
Expand All @@ -301,7 +302,7 @@ def _truncate_array(self, value: list[object], target_size: int) -> _PartResult[
raise UnknownTypeError(f"got unknown type {type(item)} in array truncation")
truncated_value.append(part_result.value)
used_size += part_result.value_size
truncated = part_result.truncated
truncated = truncated or part_result.truncated
return _PartResult(truncated_value, used_size, truncated)

@classmethod
Expand Down
Loading