File tree 1 file changed +6
-8
lines changed
src/libs/agent-runtime/azureOpenai
1 file changed +6
-8
lines changed Original file line number Diff line number Diff line change @@ -81,27 +81,25 @@ export class LobeAzureOpenAI implements LobeRuntimeAI {
81
81
82
82
// Convert object keys to camel case, copy from `@azure/openai` in `node_modules/@azure/openai/dist/index.cjs`
83
83
private camelCaseKeys = ( obj : any ) : any => {
84
- if ( typeof obj !== "object" || ! obj )
85
- return obj ;
84
+ if ( typeof obj !== 'object' || ! obj ) return obj ;
86
85
if ( Array . isArray ( obj ) ) {
87
86
return obj . map ( ( v ) => this . camelCaseKeys ( v ) ) ;
88
- }
89
- else {
87
+ } else {
90
88
for ( const key of Object . keys ( obj ) ) {
91
89
const value = obj [ key ] ;
92
90
const newKey = this . tocamelCase ( key ) ;
93
91
if ( newKey !== key ) {
94
92
delete obj [ key ] ;
95
93
}
96
- obj [ newKey ] = typeof obj [ newKey ] === " object" ? this . camelCaseKeys ( value ) : value ;
94
+ obj [ newKey ] = typeof obj [ newKey ] === ' object' ? this . camelCaseKeys ( value ) : value ;
97
95
}
98
96
return obj ;
99
97
}
100
- }
98
+ } ;
101
99
102
100
private tocamelCase = ( str : string ) => {
103
101
return str
104
102
. toLowerCase ( )
105
- . replace ( / ( _ [ a - z ] ) / g, ( group ) => group . toUpperCase ( ) . replace ( "_" , "" ) ) ;
106
- }
103
+ . replaceAll ( / ( _ [ a - z ] ) / g, ( group ) => group . toUpperCase ( ) . replace ( '_' , '' ) ) ;
104
+ } ;
107
105
}
You can’t perform that action at this time.
0 commit comments