mirror of
https://github.com/discourse/discourse-ai.git
synced 2025-06-29 02:52:16 +00:00
FIX: add safe navigation to serializer include conditions (#1349)
In some rare cases a post can exist without a topic
This commit is contained in:
parent
296aa24df1
commit
de0625571b
@ -140,7 +140,8 @@ module DiscourseAi
|
|||||||
:topic_view,
|
:topic_view,
|
||||||
:is_bot_pm,
|
:is_bot_pm,
|
||||||
include_condition: -> do
|
include_condition: -> do
|
||||||
object.personal_message && object.topic.custom_fields[TOPIC_AI_BOT_PM_FIELD]
|
object.topic && object.personal_message &&
|
||||||
|
object.topic.custom_fields[TOPIC_AI_BOT_PM_FIELD]
|
||||||
end,
|
end,
|
||||||
) { true }
|
) { true }
|
||||||
|
|
||||||
@ -148,7 +149,7 @@ module DiscourseAi
|
|||||||
:post,
|
:post,
|
||||||
:llm_name,
|
:llm_name,
|
||||||
include_condition: -> do
|
include_condition: -> do
|
||||||
object.topic.private_message? && object.custom_fields[POST_AI_LLM_NAME_FIELD]
|
object&.topic&.private_message? && object.custom_fields[POST_AI_LLM_NAME_FIELD]
|
||||||
end,
|
end,
|
||||||
) { object.custom_fields[POST_AI_LLM_NAME_FIELD] }
|
) { object.custom_fields[POST_AI_LLM_NAME_FIELD] }
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user