mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06:19 +00:00
🐛 fix(openaicaller.py): fix error in generate_response method where error_call argument is not properly handled
✨ feat(openaicaller.py): add default value for error_call argument in generate_response method to prevent potential errors
This commit is contained in:
@@ -83,10 +83,16 @@ class openai_caller:
|
|||||||
# async def generate_response(self, error_call=None, **kwargs):
|
# async def generate_response(self, error_call=None, **kwargs):
|
||||||
async def generate_response(*args, **kwargs):
|
async def generate_response(*args, **kwargs):
|
||||||
self = args[0]
|
self = args[0]
|
||||||
if args.get("error_call", None) != None:
|
if len(args) > 1:
|
||||||
error_call = args[1]
|
error_call = args[1] or nothing
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
async def nothing(x):
|
||||||
|
return x
|
||||||
|
|
||||||
|
error_call = nothing
|
||||||
|
if error_call == None:
|
||||||
|
|
||||||
async def nothing(x):
|
async def nothing(x):
|
||||||
return x
|
return x
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user