FIX: Fallback to whole LLM response when XML fail (#340)

This commit is contained in:
Rafael dos Santos Silva 2023-12-06 18:58:26 -03:00 committed by GitHub
parent 7ac1dbb6b6
commit c8352f21ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -114,7 +114,7 @@ module DiscourseAi
SiteSetting.ai_embeddings_semantic_search_hyde_model,
).completion!(prompt, @guardian.user)
Nokogiri::HTML5.fragment(llm_response).at("ai").text
Nokogiri::HTML5.fragment(llm_response).at("ai").text.presence || llm_response
end
end
end