File tree Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Expand file tree Collapse file tree 1 file changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -187,11 +187,13 @@ def generate_prompt(self, instance: dict):
187
187
188
188
def process ():
189
189
model = get_model_instance_by_model_workspace_id (model_id = model_id , workspace_id = workspace_id ,** application .model_params_setting )
190
- for r in model .stream ([SystemMessage (content = system_content ),
190
+ try :
191
+ for r in model .stream ([SystemMessage (content = system_content ),
191
192
* [HumanMessage (content = m .get ('content' )) if m .get ('role' ) == 'user' else AIMessage (
192
193
content = m .get ('content' )) for m in messages ]]):
193
- yield 'data: ' + json .dumps ({'content' : r .content }) + '\n \n '
194
-
194
+ yield 'data: ' + json .dumps ({'content' : r .content }) + '\n \n '
195
+ except Exception as e :
196
+ yield 'data: ' + json .dumps ({'error' : str (e )}) + '\n \n '
195
197
return to_stream_response_simple (process ())
196
198
197
199
You can’t perform that action at this time.
0 commit comments