@@ -2,7 +2,7 @@ import { FastifySchema, Response, ResponseError } from "../../../../types/Server
22import { ax } from "../../../utils/Axios" ;
33import { AbstractController } from "../../../../abstract/controller" ;
44import { Controller } from "../../../../decorator/Controller" ;
5- import { AI_SERVER_URL } from "./const" ;
5+ import { AI_SERVER_URL_CN , AI_SERVER_URL_EN } from "./const" ;
66
77@Controller < RequestType , any > ( {
88 method : "post" ,
@@ -13,22 +13,25 @@ export class AgoraAIStop extends AbstractController<RequestType, any> {
1313 public static readonly schema : FastifySchema < RequestType > = {
1414 body : {
1515 type : "object" ,
16- required : [ "request_id" , "channel_name" ] ,
16+ required : [ "request_id" , "channel_name" , "language" ] ,
1717 properties : {
1818 request_id : {
1919 type : "string" ,
2020 } ,
2121 channel_name : {
2222 type : "string" ,
2323 } ,
24+ language : {
25+ type : "string" ,
26+ }
2427 } ,
2528 } ,
2629 } ;
2730
2831 public async execute ( ) : Promise < Response < any > > {
29- const { request_id, channel_name } = this . body ;
30-
31- const res = await ax . post < any > ( `${ AI_SERVER_URL } /start` , {
32+ const { request_id, channel_name, language } = this . body ;
33+ const api = language === "cn" ? AI_SERVER_URL_CN : AI_SERVER_URL_EN ;
34+ const res = await ax . post < any > ( `${ api } /start` , {
3235 request_id,
3336 channel_name,
3437 } ,
@@ -50,5 +53,6 @@ interface RequestType {
5053 body : {
5154 request_id : string ;
5255 channel_name : string ;
56+ language : string ;
5357 } ;
5458}
0 commit comments