File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -197,10 +197,21 @@ impl TryFrom<Vec<u8>> for LlmOptions {
197197 // Extract system_message
198198 let system_message = json[ "system_message" ] . as_str ( ) . map ( |s| s. to_string ( ) ) ;
199199
200- // Extract tools_sse_urls
201- let tools_sse_urls = json[ "tools_sse_urls" ]
202- . as_str ( )
203- . map ( |s| s. split ( ',' ) . map ( |s| s. trim ( ) . to_string ( ) ) . collect ( ) ) ;
200+ // Extract tools_sse_urls - can be an array or a comma-separated string
201+ let tools_sse_urls = if json[ "tools_sse_urls" ] . is_array ( ) {
202+ // Handle array format - native runtime
203+ Some (
204+ json[ "tools_sse_urls" ]
205+ . members ( )
206+ . filter_map ( |v| v. as_str ( ) . map ( |s| s. to_string ( ) ) )
207+ . collect ( ) ,
208+ )
209+ } else if let Some ( s) = json[ "tools_sse_urls" ] . as_str ( ) {
210+ // Handle comma-separated string format - Browser runtime
211+ Some ( s. split ( ',' ) . map ( |s| s. trim ( ) . to_string ( ) ) . collect ( ) )
212+ } else {
213+ None
214+ } ;
204215
205216 Ok ( LlmOptions {
206217 system_message : system_message,
You can’t perform that action at this time.
0 commit comments