trying to convert to dictionary
This commit is contained in:
parent
0ac027bf1c
commit
72171e9ed0
@ -338,10 +338,11 @@ class ReginaldCog(commands.Cog):
|
|||||||
response_data = response.choices[0].message
|
response_data = response.choices[0].message
|
||||||
|
|
||||||
# 🟢 Check if OpenAI returned a function call
|
# 🟢 Check if OpenAI returned a function call
|
||||||
if response_data.get("function_call"):
|
if hasattr(response_data, "function_call") and response_data.function_call:
|
||||||
function_call = response_data["function_call"]
|
function_call = response_data.function_call
|
||||||
function_name = function_call["name"]
|
|
||||||
function_args = json.loads(function_call["arguments"]) # Convert JSON string to dict
|
function_name = function_call.name
|
||||||
|
function_args = json.loads(function_call.arguments) # Convert JSON string to dict
|
||||||
|
|
||||||
# 🟢 Call the appropriate function
|
# 🟢 Call the appropriate function
|
||||||
if function_name == "set_board":
|
if function_name == "set_board":
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user