Skip to content

Commit

Permalink
feat: support query to specify graph (#191)
Browse files Browse the repository at this point in the history
* feat: support query to specify graph

* fix: prevent using useSearchParams
  • Loading branch information
plutoless authored Aug 11, 2024
1 parent 475e0ab commit e4e93e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
6 changes: 4 additions & 2 deletions playground/src/common/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ interface StartRequestConfig {
userId: number,
language: string
voiceType: string
graphName: string | null
}

interface GenAgoraDataConfig {
Expand Down Expand Up @@ -34,14 +35,15 @@ export const apiGenAgoraData = async (config: GenAgoraDataConfig) => {

export const apiStartService = async (config: StartRequestConfig): Promise<any> => {
const url = `${REQUEST_URL}/start`
const { language, channel, userId, voiceType } = config
const { language, channel, userId, voiceType, graphName } = config
const data = {
request_id: genUUID(),
agora_asr_language: language,
channel_name: channel,
openai_proxy_url: "",
remote_stream_id: userId,
voice_type: voiceType
voice_type: voiceType,
graph_name: graphName
}
let resp: any = await fetch(url, {
method: "POST",
Expand Down
5 changes: 4 additions & 1 deletion playground/src/components/setting/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,14 @@ const Setting = () => {
message.success("Agent disconnected")
stopPing()
} else {
let params = new URLSearchParams(document.location.search);
let graph_name = params.get("graph_name");
const res = await apiStartService({
channel,
userId,
language: lang,
voiceType: voice
voiceType: voice,
graphName: graph_name,
})
const { code, msg } = res || {}
if (code != 0) {
Expand Down

0 comments on commit e4e93e3

Please sign in to comment.