Spaces:
Sleeping
Sleeping
Pnut
commited on
Commit
•
017dec1
1
Parent(s):
a435e54
解决Bug(‘str’ object has no attribute ‘api_key’) (#589)
Browse files- modules/shared.py +3 -3
modules/shared.py
CHANGED
@@ -41,11 +41,11 @@ class State:
|
|
41 |
def switching_api_key(self, func):
|
42 |
if not hasattr(self, "api_key_queue"):
|
43 |
return func
|
44 |
-
|
45 |
def wrapped(*args, **kwargs):
|
46 |
api_key = self.api_key_queue.get()
|
47 |
-
args =
|
48 |
-
ret = func(
|
49 |
self.api_key_queue.put(api_key)
|
50 |
return ret
|
51 |
|
|
|
41 |
def switching_api_key(self, func):
|
42 |
if not hasattr(self, "api_key_queue"):
|
43 |
return func
|
44 |
+
|
45 |
def wrapped(*args, **kwargs):
|
46 |
api_key = self.api_key_queue.get()
|
47 |
+
args[0].api_key = api_key
|
48 |
+
ret = func(*args, **kwargs)
|
49 |
self.api_key_queue.put(api_key)
|
50 |
return ret
|
51 |
|