Remove unnecessary comments and improve result handling in ConversationChainComponent

This commit is contained in:
Gabriel Luiz Freitas Almeida 2024-02-22 18:41:29 -03:00
commit 9192d50e72

View file

@ -32,8 +32,6 @@ class ConversationChainComponent(CustomComponent):
else:
chain = ConversationChain(llm=llm, memory=memory)
result = chain.invoke(inputs)
# result is an AIMessage which is a subclass of BaseMessage
# We need to check if it is a string or a BaseMessage
if hasattr(result, "content") and isinstance(result.content, str):
result = result.content
elif isinstance(result, str):