File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed
Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -824,20 +824,21 @@ def generate_conversation_title(self):
824824 temperature = self .temperature_spinner .GetValue (),
825825 top_p = self .top_p_spinner .GetValue (),
826826 max_tokens = self .max_tokens_spin_ctrl .GetValue (),
827- stream = self . stream_mode . GetValue (),
827+ stream = True , # Required for Anthropic: long requests must use streaming
828828 )
829829 engine = self .current_engine
830830 completion_kw = {
831831 "system_message" : None ,
832832 "conversation" : self .conversation ,
833833 "new_block" : new_block ,
834- "stream" : False ,
834+ "stream" : True ,
835835 }
836836 response = engine .completion (** completion_kw )
837- new_block = engine .completion_response_without_stream (
838- response = response , ** completion_kw
839- )
840- return new_block .response .content
837+ content_parts = []
838+ for chunk in engine .completion_response_with_stream (response ):
839+ if isinstance (chunk , str ):
840+ content_parts .append (chunk )
841+ return "" .join (content_parts ).strip ()
841842 except Exception as e :
842843 show_enhanced_error_dialog (
843844 parent = self ,
You can’t perform that action at this time.
0 commit comments