Skip to content
This repository was archived by the owner on Jul 22, 2025. It is now read-only.

Commit 50f71fb

Browse files
committed
Extract to constant
1 parent d4c7578 commit 50f71fb

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/ai_helper/assistant.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
module DiscourseAi
44
module AiHelper
55
class Assistant
6+
IMAGE_CAPTION_MAX_WORDS = 50
7+
68
def self.prompt_cache
79
@prompt_cache ||= ::DiscourseAi::MultisiteHash.new("prompt_cache")
810
end
@@ -164,7 +166,7 @@ def generate_image_caption(upload, user)
164166
feature_name: "image_caption",
165167
)
166168

167-
raw_caption.delete("|").squish.truncate_words(50)
169+
raw_caption.delete("|").squish.truncate_words(IMAGE_CAPTION_MAX_WORDS)
168170
end
169171

170172
private

0 commit comments

Comments
 (0)