gpt4 book ai didi

python - 如何在 getstream.io python 中将回复(子评论)添加到提要评论中

转载 作者:太空宇宙 更新时间:2023-11-03 21:02:21 25 4
gpt4 key购买 nike

我正在使用 getstream.io 创建提要。用户可以关注源并添加 react 和评论。如果一个用户在提要上添加评论,而另一个用户想要回复该评论,那么我如何才能实现这一目标并检索该评论的所有回复。

最佳答案

getstream.io 支持 child 对 react 的 react 。文档是here .

当您向事件添加 react 时,请使用该 react 来创建子 react 。

comment = client.reactions.add(
"comment",
activity_id,
user_id="mike",
data={"text": "@thierry great post!"},
target_feeds=["notification:thierry"],
)

例如,创建一个与上述评论 react “类似”的子 react 。

client.reactions.add_child("like", comment, user_id="thierry")

同样,创建一个子 react “评论”

client.reactions.add_child(
"comment",
comment,
user_id="thierry",
data={"text":"Thanks @mike"},
target_feeds=["notification:mike"],
)

检索 react 的子 react

# retrieve first 10 likes for an reaction
response = client.reactions.filter(
reaction_id="ed2837a6-0a3b-4679-adc1-778a1704852d", kind="like", limit=10
)

检索事件的父级 react

# retrieve first 10 likes for an activity
response = client.reactions.filter(
activity_id="ed2837a6-0a3b-4679-adc1-778a1704852d", kind="like", limit=10
)

注意: child react 不能有 child react 。要了解有关分页和检索的更多信息,请阅读文档 here

关于python - 如何在 getstream.io python 中将回复(子评论)添加到提要评论中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/55644656/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com