Feature:Add voice dialogue functionality to the agent application (#11668)

### What problem does this PR solve?

Feature:Add voice dialogue functionality to the agent application

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
chanx
2025-12-02 19:39:43 +08:00
committed by GitHub
parent 962bd5f5df
commit 1388c4420d
16 changed files with 677 additions and 60 deletions

View File

@ -50,10 +50,13 @@ export function findMessageFromList(eventList: IEventList) {
let startIndex = -1;
let endIndex = -1;
let audioBinary = undefined;
messageEventList.forEach((x, idx) => {
const { data } = x;
const { content, start_to_think, end_to_think } = data;
const { content, start_to_think, end_to_think, audio_binary } = data;
if (audio_binary) {
audioBinary = audio_binary;
}
if (start_to_think === true) {
nextContent += '<think>' + content;
startIndex = idx;
@ -82,6 +85,7 @@ export function findMessageFromList(eventList: IEventList) {
return {
id: eventList[0]?.message_id,
content: nextContent,
audio_binary: audioBinary,
attachment: workflowFinished?.data?.outputs?.attachment || {},
};
}
@ -393,12 +397,15 @@ export const useSendAgentMessage = ({
}, [sendMessageInTaskMode]);
useEffect(() => {
const { content, id, attachment } = findMessageFromList(answerList);
const { content, id, attachment, audio_binary } =
findMessageFromList(answerList);
const inputAnswer = findInputFromList(answerList);
const answer = content || getLatestError(answerList);
if (answerList.length > 0) {
addNewestOneAnswer({
answer: answer ?? '',
audio_binary: audio_binary,
attachment: attachment as IAttachment,
id: id,
...inputAnswer,