Fix.
This commit is contained in:
parent
d364d72e51
commit
68d29bbcea
@ -200,12 +200,12 @@ class Agent:
|
|||||||
|
|
||||||
def communicate(self, message: str,role:str="user"):
|
def communicate(self, message: str,role:str="user"):
|
||||||
log.debug(f"Sending message: {message} to assistant {self.assistant.id} in thread {self.thread.id}.")
|
log.debug(f"Sending message: {message} to assistant {self.assistant.id} in thread {self.thread.id}.")
|
||||||
messages = isinstance(message, list) and message or [message]
|
messages = hasattr(message, "__iter__") and message or [message]
|
||||||
|
|
||||||
for message in messages:
|
for message in messages:
|
||||||
if isinstance(message, dict):
|
if isinstance(message, dict):
|
||||||
|
message_role = message["role"]
|
||||||
message = message["content"]
|
message = message["content"]
|
||||||
message_role = message["content"]
|
|
||||||
else:
|
else:
|
||||||
message_role = role
|
message_role = role
|
||||||
self.client.beta.threads.messages.create(
|
self.client.beta.threads.messages.create(
|
||||||
|
Loading…
Reference in New Issue
Block a user