File tree Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Expand file tree Collapse file tree 1 file changed +6
-15
lines changed Original file line number Diff line number Diff line change @@ -112,24 +112,15 @@ export class XAIHandler extends BaseProvider implements SingleCompletionHandler
112112 const { id : modelId , reasoning } = this . getModel ( )
113113
114114 try {
115- let response
116- try {
117- response = await this . client . chat . completions . create ( {
118- model : modelId ,
119- messages : [ { role : "user" , content : prompt } ] ,
120- ...( reasoning && reasoning ) ,
121- } )
122- } catch ( error ) {
123- throw handleOpenAIError ( error , "xAI" )
124- }
115+ const response = await this . client . chat . completions . create ( {
116+ model : modelId ,
117+ messages : [ { role : "user" , content : prompt } ] ,
118+ ...( reasoning && reasoning ) ,
119+ } )
125120
126121 return response . choices [ 0 ] ?. message . content || ""
127122 } catch ( error ) {
128- if ( error instanceof Error ) {
129- throw new Error ( `xAI completion error: ${ error . message } ` )
130- }
131-
132- throw error
123+ throw handleOpenAIError ( error , "xAI" )
133124 }
134125 }
135126}
You can’t perform that action at this time.
0 commit comments