Skip to content

Commit 6ede36a

Browse files
committed
First chunk received should be true even when chunk is empty
1 parent 66dd0dd commit 6ede36a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/ruby_llm/active_record/acts_as.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ def ask(message, with: nil, &)
154154

155155
alias say ask
156156

157-
def complete(*args, **kwargs, &) # rubocop:disable Metrics/PerceivedComplexity
157+
def complete(*args, **kwargs, &)
158158
@message = nil
159159
@streaming = block_given?
160160
first_chunk_received = false
@@ -163,7 +163,7 @@ def complete(*args, **kwargs, &) # rubocop:disable Metrics/PerceivedComplexity
163163
# For streaming, handle message creation on first chunk
164164
to_llm.complete(*args, **kwargs) do |chunk|
165165
# Create assistant message on first content chunk
166-
if !first_chunk_received && chunk.content.present?
166+
unless first_chunk_received
167167
first_chunk_received = true
168168
persist_new_message
169169
end

0 commit comments

Comments
 (0)