Skip to content

Commit f13a885

Browse files
committed
add support for mapper
1 parent 92e5537 commit f13a885

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

main.ts

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import { serve } from "https://deno.land/std@0.181.0/http/server.ts";
22

33
// The name of your Azure OpenAI Resource.
44
const resourceName:string = "your-resource-name";
5-
6-
// The deployment name you chose when you deployed the model.
7-
// const deployName:string = "deployment-name";
8-
5+
// The version of OpenAI API.
96
const apiVersion:string = "2023-03-15-preview";
10-
// 自定义 mapper 来映射 model 字段
7+
// The mapping of model name.
118
const mapper:any = {
12-
'gpt-3.5-turbo': 'gpt35'
13-
// 其他映射规则可以在这里添加
9+
'gpt-3.5-turbo': 'gpt35',
10+
'gpt-4': 'gpt4'
11+
// Other mapping rules can be added here.
1412
};
1513

1614
async function handleRequest(request:Request):Promise<Response> {
@@ -31,7 +29,7 @@ async function handleRequest(request:Request):Promise<Response> {
3129
}
3230

3331

34-
// 获取 model 字段的值,并进行映射
32+
// Get the value of the model field and perform mapping.
3533
let deployName:string = '';
3634
let body:any;
3735
if (request.method === 'POST') {

0 commit comments

Comments
 (0)