Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in
Toggle navigation
A
aisbf
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexlab
aisbf
Commits
9a91c635
Commit
9a91c635
authored
Feb 08, 2026
by
Stefy Lanza (nextime / spora )
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix err 500
parent
c52a65d7
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
4 deletions
+26
-4
handlers.py
aisbf/handlers.py
+26
-4
No files found.
aisbf/handlers.py
View file @
9a91c635
...
@@ -953,9 +953,9 @@ class RotationHandler:
...
@@ -953,9 +953,9 @@ class RotationHandler:
"rotation_id"
:
rotation_id
,
"rotation_id"
:
rotation_id
,
"error_details"
:
error_details
"error_details"
:
error_details
}
}
#
Return as StreamingResponse if original request was streaming, otherwise return dict
#
For streaming requests, wrap in a simple streaming response
if
stream
:
if
stream
:
return
self
.
_create_
streaming_response
(
error_response
,
rotation_id
)
return
self
.
_create_
error_streaming_response
(
error_response
)
else
:
else
:
return
error_response
return
error_response
else
:
else
:
...
@@ -1312,9 +1312,9 @@ class RotationHandler:
...
@@ -1312,9 +1312,9 @@ class RotationHandler:
"last_error"
:
last_error
,
"last_error"
:
last_error
,
"error_details"
:
error_details
"error_details"
:
error_details
}
}
#
Return as StreamingResponse if original request was streaming, otherwise return dict
#
For streaming requests, wrap in a simple streaming response
if
stream
:
if
stream
:
return
self
.
_create_
streaming_response
(
error_response
,
rotation_id
)
return
self
.
_create_
error_streaming_response
(
error_response
)
else
:
else
:
return
error_response
return
error_response
else
:
else
:
...
@@ -1331,6 +1331,28 @@ class RotationHandler:
...
@@ -1331,6 +1331,28 @@ class RotationHandler:
}
}
)
)
def
_create_error_streaming_response
(
self
,
error_response
:
Dict
):
"""
Create a simple StreamingResponse for error messages.
This is used when notifyerrors is enabled and we need to return
an error as a streaming response instead of raising an HTTPException.
Args:
error_response: The error response dict to stream
Returns:
StreamingResponse with the error response as a single chunk
"""
import
json
import
time
async
def
error_stream_generator
():
# Send the error response as a single chunk
yield
f
"data: {json.dumps(error_response)}
\n\n
"
.
encode
(
'utf-8'
)
return
StreamingResponse
(
error_stream_generator
(),
media_type
=
"text/event-stream"
)
def
_create_streaming_response
(
self
,
response
,
provider_type
:
str
,
provider_id
:
str
,
model_name
:
str
,
handler
,
request_data
:
Dict
,
effective_context
:
int
):
def
_create_streaming_response
(
self
,
response
,
provider_type
:
str
,
provider_id
:
str
,
model_name
:
str
,
handler
,
request_data
:
Dict
,
effective_context
:
int
):
"""
"""
Create a StreamingResponse with proper handling based on provider type.
Create a StreamingResponse with proper handling based on provider type.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment