Skip to content

Commit

Permalink
fix: fix ai server processing bug
Browse files Browse the repository at this point in the history
  • Loading branch information
hqer927 committed Jan 17, 2025
1 parent 4b70d12 commit 16410f9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 15 deletions.
4 changes: 2 additions & 2 deletions src/v1/controller/agora/ai/ping.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class AgoraAIPing extends AbstractController<RequestType, any> {

public async execute(): Promise<Response<any>> {
const { request_id, channel_name, language } = this.body;
const api = language === "cn" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN;
const api = language === "zh" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN;
const res = await ax.post<any>(`${api}/ping`, {
request_id,
channel_name
Expand All @@ -44,7 +44,7 @@ export class AgoraAIPing extends AbstractController<RequestType, any> {
)
return {
status: Status.Success,
data: res,
data: res.data,
}

}
Expand Down
17 changes: 6 additions & 11 deletions src/v1/controller/agora/ai/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import { AbstractController } from "../../../../abstract/controller";
import { Controller } from "../../../../decorator/Controller";
import { AI_SERVER_URL_CN, AI_SERVER_URL_EN } from "./const";
import { Status } from "../../../../constants/Project";

@Controller<RequestType, any>({
method: "post",
path: "agora/ai/start",
Expand All @@ -14,7 +13,7 @@ export class AgoraAIStart extends AbstractController<RequestType, any> {
public static readonly schema: FastifySchema<RequestType> = {
body: {
type: "object",
required: ["request_id", "channel_name", "user_uid", "language", "scene", "role"],
required: ["request_id", "channel_name", "user_uid", "language", "role"],
properties: {
request_id: {
type: "string",
Expand All @@ -23,14 +22,11 @@ export class AgoraAIStart extends AbstractController<RequestType, any> {
type: "string",
},
user_uid: {
type: "string",
type: "number",
},
language: {
type: "string",
},
scene: {
type: "string",
},
role: {
type: "string",
},
Expand All @@ -40,12 +36,12 @@ export class AgoraAIStart extends AbstractController<RequestType, any> {

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

return {
status: Status.Success,
data: res,
data: res.data,
}
}

Expand All @@ -69,9 +65,8 @@ interface RequestType {
body: {
request_id: string;
channel_name: string;
user_uid: string;
user_uid: number;
language: string;
scene: string;
role: string;
};
}
4 changes: 2 additions & 2 deletions src/v1/controller/agora/ai/stop.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class AgoraAIStop extends AbstractController<RequestType, any> {

public async execute(): Promise<Response<any>> {
const { request_id, channel_name, language } = this.body;
const api = language === "cn" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN;
const api = language === "zh" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN;
const res = await ax.post<any>(`${api}/start`, {
request_id,
channel_name,
Expand All @@ -44,7 +44,7 @@ export class AgoraAIStop extends AbstractController<RequestType, any> {
)
return {
status: Status.Success,
data: res,
data: res.data,
}
}

Expand Down

0 comments on commit 16410f9

Please sign in to comment.