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

Commit ebd5384

Browse files
committed
nil
1 parent 6f60315 commit ebd5384

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

lib/translation/content_splitter.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class ContentSplitter
2626
def self.split(content:, chunk_size: DEFAULT_CHUNK_SIZE)
2727
return [] if content.nil?
2828
return [""] if content.empty?
29+
chunk_size ||= DEFAULT_CHUNK_SIZE
2930
return [content] if content.length <= chunk_size
3031

3132
chunks = []

spec/lib/translation/base_translator_spec.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# frozen_string_literal: true
22

3-
require "rails_helper"
4-
53
describe DiscourseAi::Translation::BaseTranslator do
64
let!(:persona) do
75
AiPersona.find(
@@ -28,7 +26,7 @@
2826
DiscourseAi::Translation::PostRawTranslator.new(text:, target_locale:, post:)
2927
allow(DiscourseAi::Completions::Prompt).to receive(:new).with(
3028
persona.system_prompt,
31-
messages: array_including({ type: :user, content: post_translator.formatted_content }),
29+
messages: array_including({ type: :user, content: a_string_including(text) }),
3230
post_id: post.id,
3331
topic_id: post.topic_id,
3432
).and_call_original

0 commit comments

Comments
 (0)