api配置更改

This commit is contained in:
fsy
2025-03-18 20:02:21 +08:00
parent 1dfedce690
commit 53493be75d
3 changed files with 48 additions and 20 deletions

View File

@@ -143,7 +143,7 @@ export default {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
align-items: center; align-items: center;
padding: 16px; padding: 10px;
background-color: #f9f9f9; background-color: #f9f9f9;
border-top: 1px solid #e8e8e8; border-top: 1px solid #e8e8e8;
} }

View File

@@ -2,7 +2,7 @@ import axios from 'axios';
class ApiService { class ApiService {
constructor() { constructor() {
this.baseUrl = '/api'; // Using Vite proxy instead of direct URL this.baseUrl = '/create-api'; // Using Vite proxy instead of direct URL
this.projectId = '01a1debc964a4c6a8df1de2a6ce7aa4d'; this.projectId = '01a1debc964a4c6a8df1de2a6ce7aa4d';
this.authToken = 'Basic OGRkM2EzOGUxNTJjNGU1NDlmNWMwOTg0YmRhYzc1ZTE6ZWY1MTI2ZTRmMWFlNGE5MWE0MzVhN2Q0ZDc0YzNlYjg='; // Set the auth token this.authToken = 'Basic OGRkM2EzOGUxNTJjNGU1NDlmNWMwOTg0YmRhYzc1ZTE6ZWY1MTI2ZTRmMWFlNGE5MWE0MzVhN2Q0ZDc0YzNlYjg='; // Set the auth token
this.sessionId = null; this.sessionId = null;
@@ -30,20 +30,21 @@ class ApiService {
* @param {string} agentRtcUid - The agent RTC UID * @param {string} agentRtcUid - The agent RTC UID
* @returns {Promise} - The response from the API * @returns {Promise} - The response from the API
*/ */
async joinProject(channelName = 'convaiconsole_130103', agentRtcUid = '59560') { async joinProject(channelName = 'convaiconsole_108446', agentRtcUid = '91482') {
try { try {
const response = await this.client.post( const response = await this.client.post(
`${this.baseUrl}/projects/${this.projectId}/join/`, `${this.baseUrl}/projects/${this.projectId}/join/`,
{ {
name: channelName, name: channelName,
properties: { properties: {
channel: channelName, channel: "testChannel",
agent_rtc_uid: agentRtcUid, token: "007eJxTYJBc1LqzN+VLw4SMTFNviZTzYeGSTz2UP69pceR+fcXAWFyBwcAw0TAlNSnZ0swk0STZLNEiJQ3IN0o0S041T0w0SamzvJneEMjIsCrrFwMjFIL43AwlqcUlzhmJeXmpOQwMABPJIos=",
agent_rtc_uid: 0,
remote_rtc_uids: ["*"], remote_rtc_uids: ["*"],
enable_string_uid: true, enable_string_uid: false,
idle_timeout: 120, idle_timeout: 120,
llm: { llm: {
url: "/ai-api", url: "/llm-api",
api_key: "sk-xVIc9b7EfY7LlPagF31d90F4736f4aE18cB91b5957A40506", api_key: "sk-xVIc9b7EfY7LlPagF31d90F4736f4aE18cB91b5957A40506",
max_history: 10, max_history: 10,
system_messages: [ system_messages: [
@@ -53,7 +54,7 @@ class ApiService {
} }
], ],
params: { params: {
model: "deepseek-r1", model: "deepseek-chat",
max_token: 1024 max_token: 1024
}, },
greeting_message: "你好呀,有什么可以帮您?", greeting_message: "你好呀,有什么可以帮您?",
@@ -69,19 +70,18 @@ class ApiService {
threshold: 0.5 threshold: 0.5
}, },
tts: { tts: {
vendor: "minimax", vendor: "bytedance",
params: { params: {
group_id: "wN-fMujjNdcwJ2M3-MbhMHSF6-j_3dT3", token: "wN-fMujjNdcwJ2M3-MbhMHSF6-j_3dT3",
key: "4417529362", app_id: "4417529362",
model: "speech-01-turbo-240228", cluster: "volcano_tts",
voice_settings: { voice_type: "BV700_streaming",
voice_id: "female-shaonv", speed_ratio: 1.0,
speed: 1, volume_ratio: 1.0,
vol: 1, pitch_ratio: 1.0,
pitch: 0, emotion: "happy"
emotion: "neutral"
}
} }
}, },
parameters: { parameters: {
transcript: { transcript: {
@@ -93,7 +93,7 @@ class ApiService {
enable_metrics: true, enable_metrics: true,
audio_scenario: "default" audio_scenario: "default"
}, },
token: "007eJxTYDB8wl8ofHzCsqYtWZqLK64uTOnlWjOtuUS7m6Od7Q7P7+cKDAaGiYYpqUnJlmYmiSbJZokWKWlAvlGiWXKqeWKiScrFJdfTGwIZGV5YrmVhZIBAEF+EITk/rywxE0gW5+ekxhsaGxgaGDMwAADNWiaV", token: "007eJxTYBDbc7v13v7dwVVOXVMOWv1jZlsa57TyYqDInTmtH+UcZroqMBgYJhqmpCYlW5qZJJokmyVapKQB+UaJZsmp5omJJinlZjfTGwIZGZYb8DIwQiGIL8KQnJ9XlpgJJIvzc1LjDQ0sTEzMGBgA4KQlrw==",
advanced_features: { advanced_features: {
enable_aivad: true enable_aivad: true
} }

View File

@@ -5,4 +5,32 @@ import path from 'path'
// https://vite.dev/config/ // https://vite.dev/config/
export default defineConfig({ export default defineConfig({
plugins: [vue()], plugins: [vue()],
resolve: {
alias: {
'@': path.resolve(__dirname, './src'),
},
},
server: {
host: '0.0.0.0',
port: 3000,
open: true,
cors:true,
proxy:{
'/create-api':{
// target:'https://api.agora.io/cn/api/conversational-ai-agent/v2',
target: 'https://api.sd-rtn.com/cn/api/conversational-ai-agent/v2',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/create-api/, ''),
headers: {
'Authorization': 'Basic OGRkM2EzOGUxNTJjNGU1NDlmNWMwOTg0YmRhYzc1ZTE6ZWY1MTI2ZTRmMWFlNGE5MWE0MzVhN2Q0ZDc0YzNlYjg=',
}
},
'/llm-api':{
target:'https://vip.apiyi.com/v1/chat/completions',
changeOrigin: true,
rewrite: (path) => path.replace(/^\/llm-api/, ''),
}
}
}
}) })