Skip to content

Commit 599e62c

Browse files
committed
fix: fix ai server processing bug
1 parent 4b70d12 commit 599e62c

File tree

3 files changed

+9
-14
lines changed

3 files changed

+9
-14
lines changed

src/v1/controller/agora/ai/ping.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class AgoraAIPing extends AbstractController<RequestType, any> {
3131

3232
public async execute(): Promise<Response<any>> {
3333
const { request_id, channel_name, language } = this.body;
34-
const api = language === "cn" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN;
34+
const api = language === "zh" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN;
3535
const res = await ax.post<any>(`${api}/ping`, {
3636
request_id,
3737
channel_name
@@ -44,7 +44,7 @@ export class AgoraAIPing extends AbstractController<RequestType, any> {
4444
)
4545
return {
4646
status: Status.Success,
47-
data: res,
47+
data: res.data,
4848
}
4949

5050
}

src/v1/controller/agora/ai/start.ts

+5-10
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { AbstractController } from "../../../../abstract/controller";
44
import { Controller } from "../../../../decorator/Controller";
55
import { AI_SERVER_URL_CN, AI_SERVER_URL_EN } from "./const";
66
import { Status } from "../../../../constants/Project";
7-
87
@Controller<RequestType, any>({
98
method: "post",
109
path: "agora/ai/start",
@@ -14,7 +13,7 @@ export class AgoraAIStart extends AbstractController<RequestType, any> {
1413
public static readonly schema: FastifySchema<RequestType> = {
1514
body: {
1615
type: "object",
17-
required: ["request_id", "channel_name", "user_uid", "language", "scene", "role"],
16+
required: ["request_id", "channel_name", "user_uid", "language", "role"],
1817
properties: {
1918
request_id: {
2019
type: "string",
@@ -23,14 +22,11 @@ export class AgoraAIStart extends AbstractController<RequestType, any> {
2322
type: "string",
2423
},
2524
user_uid: {
26-
type: "string",
25+
type: "number",
2726
},
2827
language: {
2928
type: "string",
3029
},
31-
scene: {
32-
type: "string",
33-
},
3430
role: {
3531
type: "string",
3632
},
@@ -40,7 +36,7 @@ export class AgoraAIStart extends AbstractController<RequestType, any> {
4036

4137
public async execute(): Promise<Response<any>> {
4238
const { request_id, channel_name, user_uid, language, role } = this.body;
43-
const api = language === "cn" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN;
39+
const api = language === "zh" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN;
4440
const res = await ax.post<any>(`${api}/start`, {
4541
request_id,
4642
channel_name,
@@ -56,7 +52,7 @@ export class AgoraAIStart extends AbstractController<RequestType, any> {
5652

5753
return {
5854
status: Status.Success,
59-
data: res,
55+
data: res.data,
6056
}
6157
}
6258

@@ -69,9 +65,8 @@ interface RequestType {
6965
body: {
7066
request_id: string;
7167
channel_name: string;
72-
user_uid: string;
68+
user_uid: number;
7369
language: string;
74-
scene: string;
7570
role: string;
7671
};
7772
}

src/v1/controller/agora/ai/stop.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ export class AgoraAIStop extends AbstractController<RequestType, any> {
3131

3232
public async execute(): Promise<Response<any>> {
3333
const { request_id, channel_name, language } = this.body;
34-
const api = language === "cn" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN;
34+
const api = language === "zh" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN;
3535
const res = await ax.post<any>(`${api}/start`, {
3636
request_id,
3737
channel_name,
@@ -44,7 +44,7 @@ export class AgoraAIStop extends AbstractController<RequestType, any> {
4444
)
4545
return {
4646
status: Status.Success,
47-
data: res,
47+
data: res.data,
4848
}
4949
}
5050

0 commit comments

Comments
 (0)