mirror of
https://github.com/hwchase17/langchain.git
synced 2025-06-24 15:43:54 +00:00
Langchain_community: Small Fix when loading facebook messages (#15358)
- **Description:** SingleFileFacebookMessengerChatLoader did not handle the case for when messages had stickers and/or photos so fixed that. - **Issue:** #15356 --------- Co-authored-by: Harrison Chase <hw.chase.17@gmail.com>
This commit is contained in:
parent
cbfaccc424
commit
b6c57d38fa
@ -37,7 +37,13 @@ class SingleFileFacebookMessengerChatLoader(BaseChatLoader):
|
||||
data = json.load(f)
|
||||
sorted_data = sorted(data["messages"], key=lambda x: x["timestamp_ms"])
|
||||
messages = []
|
||||
for m in sorted_data:
|
||||
for index, m in enumerate(sorted_data):
|
||||
if "content" not in m:
|
||||
logger.info(
|
||||
f"""Skipping Message No.
|
||||
{index+1} as no content is present in the message"""
|
||||
)
|
||||
continue
|
||||
messages.append(
|
||||
HumanMessage(
|
||||
content=m["content"], additional_kwargs={"sender": m["sender_name"]}
|
||||
|
Loading…
Reference in New Issue
Block a user