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
e241ce57
Commit
e241ce57
authored
Apr 21, 2026
by
Your Name
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix user provider rate limit and error tracking initialization
parent
160e0766
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
16 deletions
+5
-16
__init__.py
aisbf/providers/__init__.py
+1
-11
base.py
aisbf/providers/base.py
+4
-5
No files found.
aisbf/providers/__init__.py
View file @
e241ce57
...
...
@@ -122,17 +122,7 @@ def get_provider_handler(provider_id: str, api_key: Optional[str] = None, user_i
handler
=
handler_class
(
provider_id
,
api_key
)
# Set user_id manually for base class compatibility
handler
.
user_id
=
user_id
# Fix error tracking and rate limit for user providers
if
user_id
is
not
None
:
handler
.
error_tracking
=
{
"enabled"
:
True
,
"max_errors"
:
5
,
"cooldown_seconds"
:
60
,
"failures"
:
0
,
"last_failure"
:
0
,
"disabled_until"
:
None
}
handler
.
rate_limit
=
60
# Base class already handles default error tracking and rate limit for user providers
# Store user provider config on the handler for later use
if
user_id
is
not
None
and
provider_config
is
not
None
:
...
...
aisbf/providers/base.py
View file @
e241ce57
...
...
@@ -748,9 +748,7 @@ class BaseProviderHandler:
self
.
user_provider_config
=
None
# Get error tracking config - use user-specific or default to global
if
user_id
is
not
None
and
provider_id
in
config
.
error_tracking
:
self
.
error_tracking
=
config
.
error_tracking
[
provider_id
]
elif
user_id
is
not
None
:
if
user_id
is
not
None
:
# Default error tracking for user providers
self
.
error_tracking
=
{
"enabled"
:
True
,
...
...
@@ -766,8 +764,9 @@ class BaseProviderHandler:
self
.
last_request_time
=
0
# Get rate limit - use user-specific or default to global
if
user_id
is
not
None
and
provider_id
in
config
.
providers
:
self
.
rate_limit
=
config
.
providers
[
provider_id
]
.
rate_limit
if
user_id
is
not
None
and
hasattr
(
self
,
'user_provider_config'
)
and
self
.
user_provider_config
is
not
None
:
# User provider config (dict)
self
.
rate_limit
=
self
.
user_provider_config
.
get
(
'rate_limit'
,
60
)
elif
user_id
is
not
None
:
# Default rate limit for user providers
self
.
rate_limit
=
60
...
...
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