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

Commit ce7c672

Browse files
committed
correct logic
1 parent 3240367 commit ce7c672

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

lib/ai_helper/assistant.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -141,10 +141,10 @@ def generate_prompt(
141141
buffer_blk =
142142
Proc.new do |partial, _, type|
143143
if type == :structured_output && schema_type
144-
bad_json ||= partial.broken?
145144
helper_chunk = partial.read_buffered_property(schema_key)
145+
bad_json ||= partial.broken?
146146
if !helper_chunk.nil? && !helper_chunk.empty?
147-
if !bad_json
147+
if bad_json
148148
helper_response << helper_chunk
149149
else
150150
if schema_type == "string" || schema_type == "array"
@@ -173,6 +173,7 @@ def generate_prompt(
173173
schema_type,
174174
schema_key,
175175
)
176+
p helper_response
176177
block.call(helper_response) if block
177178
end
178179
helper_response

0 commit comments

Comments
 (0)