@@ -36,21 +36,21 @@ describe("ZAiHandler", () => {
3636
3737 describe ( "International Z AI" , ( ) => {
3838 beforeEach ( ( ) => {
39- handler = new ZAiHandler ( { zaiApiKey : "test-zai-api-key" , zaiApiLine : "international " } )
39+ handler = new ZAiHandler ( { zaiApiKey : "test-zai-api-key" , zaiApiLine : "international_coding " } )
4040 } )
4141
4242 it ( "should use the correct international Z AI base URL" , ( ) => {
43- new ZAiHandler ( { zaiApiKey : "test-zai-api-key" , zaiApiLine : "international " } )
43+ new ZAiHandler ( { zaiApiKey : "test-zai-api-key" , zaiApiLine : "international_coding " } )
4444 expect ( OpenAI ) . toHaveBeenCalledWith (
4545 expect . objectContaining ( {
46- baseURL : "https://api.z.ai/api/paas/v4" ,
46+ baseURL : "https://api.z.ai/api/coding/ paas/v4" ,
4747 } ) ,
4848 )
4949 } )
5050
5151 it ( "should use the provided API key for international" , ( ) => {
5252 const zaiApiKey = "test-zai-api-key"
53- new ZAiHandler ( { zaiApiKey, zaiApiLine : "international " } )
53+ new ZAiHandler ( { zaiApiKey, zaiApiLine : "international_coding " } )
5454 expect ( OpenAI ) . toHaveBeenCalledWith ( expect . objectContaining ( { apiKey : zaiApiKey } ) )
5555 } )
5656
@@ -65,7 +65,7 @@ describe("ZAiHandler", () => {
6565 const handlerWithModel = new ZAiHandler ( {
6666 apiModelId : testModelId ,
6767 zaiApiKey : "test-zai-api-key" ,
68- zaiApiLine : "international " ,
68+ zaiApiLine : "international_coding " ,
6969 } )
7070 const model = handlerWithModel . getModel ( )
7171 expect ( model . id ) . toBe ( testModelId )
@@ -77,7 +77,7 @@ describe("ZAiHandler", () => {
7777 const handlerWithModel = new ZAiHandler ( {
7878 apiModelId : testModelId ,
7979 zaiApiKey : "test-zai-api-key" ,
80- zaiApiLine : "international " ,
80+ zaiApiLine : "international_coding " ,
8181 } )
8282 const model = handlerWithModel . getModel ( )
8383 expect ( model . id ) . toBe ( testModelId )
@@ -88,19 +88,19 @@ describe("ZAiHandler", () => {
8888
8989 describe ( "China Z AI" , ( ) => {
9090 beforeEach ( ( ) => {
91- handler = new ZAiHandler ( { zaiApiKey : "test-zai-api-key" , zaiApiLine : "china " } )
91+ handler = new ZAiHandler ( { zaiApiKey : "test-zai-api-key" , zaiApiLine : "china_coding " } )
9292 } )
9393
9494 it ( "should use the correct China Z AI base URL" , ( ) => {
95- new ZAiHandler ( { zaiApiKey : "test-zai-api-key" , zaiApiLine : "china " } )
95+ new ZAiHandler ( { zaiApiKey : "test-zai-api-key" , zaiApiLine : "china_coding " } )
9696 expect ( OpenAI ) . toHaveBeenCalledWith (
97- expect . objectContaining ( { baseURL : "https://open.bigmodel.cn/api/paas/v4" } ) ,
97+ expect . objectContaining ( { baseURL : "https://open.bigmodel.cn/api/coding/ paas/v4" } ) ,
9898 )
9999 } )
100100
101101 it ( "should use the provided API key for China" , ( ) => {
102102 const zaiApiKey = "test-zai-api-key"
103- new ZAiHandler ( { zaiApiKey, zaiApiLine : "china " } )
103+ new ZAiHandler ( { zaiApiKey, zaiApiLine : "china_coding " } )
104104 expect ( OpenAI ) . toHaveBeenCalledWith ( expect . objectContaining ( { apiKey : zaiApiKey } ) )
105105 } )
106106
@@ -115,7 +115,7 @@ describe("ZAiHandler", () => {
115115 const handlerWithModel = new ZAiHandler ( {
116116 apiModelId : testModelId ,
117117 zaiApiKey : "test-zai-api-key" ,
118- zaiApiLine : "china " ,
118+ zaiApiLine : "china_coding " ,
119119 } )
120120 const model = handlerWithModel . getModel ( )
121121 expect ( model . id ) . toBe ( testModelId )
@@ -127,7 +127,7 @@ describe("ZAiHandler", () => {
127127 const handlerWithModel = new ZAiHandler ( {
128128 apiModelId : testModelId ,
129129 zaiApiKey : "test-zai-api-key" ,
130- zaiApiLine : "china " ,
130+ zaiApiLine : "china_coding " ,
131131 } )
132132 const model = handlerWithModel . getModel ( )
133133 expect ( model . id ) . toBe ( testModelId )
@@ -151,14 +151,14 @@ describe("ZAiHandler", () => {
151151 } )
152152
153153 it ( "should use 'not-provided' as default API key when none is specified" , ( ) => {
154- new ZAiHandler ( { zaiApiLine : "international " } )
154+ new ZAiHandler ( { zaiApiLine : "international_coding " } )
155155 expect ( OpenAI ) . toHaveBeenCalledWith ( expect . objectContaining ( { apiKey : "not-provided" } ) )
156156 } )
157157 } )
158158
159159 describe ( "API Methods" , ( ) => {
160160 beforeEach ( ( ) => {
161- handler = new ZAiHandler ( { zaiApiKey : "test-zai-api-key" , zaiApiLine : "international " } )
161+ handler = new ZAiHandler ( { zaiApiKey : "test-zai-api-key" , zaiApiLine : "international_coding " } )
162162 } )
163163
164164 it ( "completePrompt method should return text from Z AI API" , async ( ) => {
@@ -231,7 +231,7 @@ describe("ZAiHandler", () => {
231231 const handlerWithModel = new ZAiHandler ( {
232232 apiModelId : modelId ,
233233 zaiApiKey : "test-zai-api-key" ,
234- zaiApiLine : "international " ,
234+ zaiApiLine : "international_coding " ,
235235 } )
236236
237237 mockCreate . mockImplementationOnce ( ( ) => {
0 commit comments