对话能够在两边显示,还缺少ui优化和长json显示

This commit is contained in:
fsy
2025-03-21 17:52:02 +08:00
parent 711ed1f13e
commit 9f58286bfe
3 changed files with 115 additions and 71 deletions

View File

@@ -35,10 +35,10 @@ class ApiService {
const response = await this.client.post(
`${this.baseUrl}/projects/${this.projectId}/join/`,
{
"name": "convaiconsole_181047",
"name": "convaiconsole_116347",
"properties": {
"channel": "convaiconsole_181047",
"agent_rtc_uid": "28794",
"channel": "convaiconsole_116347",
"agent_rtc_uid": "87578",
"remote_rtc_uids": [
"*"
],
@@ -93,7 +93,7 @@ class ApiService {
"enable_metrics": true,
"audio_scenario": "default"
},
"token": "007eJxTYChiW7ib6cSzPW7fP2xqFVvPqf854sNXniin39cd3pu931SlwGBgmGiYkpqUbGlmkmiSbJZokZIG5BslmiWnmicmmqRcenA7vSGQkaFhbQArIwMEgvgiDMn5eWWJmUCyOD8nNd7QwtDAxJyBAQDAkSkW",
"token": "007eJxTYOhQ/af5fwa3YP9mzYq4WWxKco1TJJqEC9L6z39c0cf2xkuBwcAw0TAlNSnZ0swk0STZLNEiJQ3IN0o0S041T0w0SQk0u5veEMjIwFi9lhFIgiGIL8KQnJ9XlpgJJIvzc1LjDQ3NjE3MGRgACCIjzA==",
"advanced_features": {
"enable_aivad": false
}
@@ -109,31 +109,6 @@ class ApiService {
}
}
/**
* Send a message to the AI agent
* @param {string} message - The message to send
* @returns {Promise} - The response from the API
*/
async sendMessage(message) {
if (!this.sessionId) {
throw new Error('No active session. Please join a project first.');
}
try {
const response = await this.client.post(
`${this.baseUrl}/sessions/${this.sessionId}/messages/`,
{
type: 'text',
content: message
}
);
return response.data;
} catch (error) {
console.error('Error sending message:', error);
throw error;
}
}
/**
* End the current session
* @returns {Promise} - The response from the API