Skip to content

Commit

Permalink
feat: Supports text output and sound output infiniflow#1877
Browse files Browse the repository at this point in the history
  • Loading branch information
cike8899 committed Sep 14, 2024
1 parent deeb950 commit e6bc86c
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 20 deletions.
7 changes: 0 additions & 7 deletions web/.umirc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,5 @@ export default defineConfig({
logger: console,
// pathRewrite: { '^/v1': '/v1' },
},
'/HPImageArchive': {
target: 'https://cn.bing.com/',
changeOrigin: true,
ws: true,
logger: console,
// pathRewrite: { '^/v1': '/v1' },
},
},
});
17 changes: 9 additions & 8 deletions web/src/components/message-item/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { useSetModalState } from '@/hooks/common-hooks';
import { IRemoveMessageById, useSpeechWithSse } from '@/hooks/logic-hooks';
import { IFeedbackRequestBody } from '@/interfaces/request/chat';
import { getMessagePureId } from '@/utils/chat';
import { hexStringToUint8Array } from '@/utils/common-util';
import { SpeechPlayer } from 'openai-speech-stream-player';
import { useCallback, useEffect, useRef, useState } from 'react';

Expand Down Expand Up @@ -94,14 +95,14 @@ export const useSpeech = (content: string, audioBinary?: string) => {
}
}, [setIsPlaying, speech, isPlaying, pause]);

// useEffect(() => {
// if (audioBinary) {
// const units = hexStringToUint8Array(audioBinary);
// if (units) {
// player.current?.feed(units);
// }
// }
// }, [audioBinary]);
useEffect(() => {
if (audioBinary) {
const units = hexStringToUint8Array(audioBinary);
if (units) {
player.current?.feed(units);
}
}
}, [audioBinary]);

useEffect(() => {
initialize();
Expand Down
6 changes: 3 additions & 3 deletions web/src/locales/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -362,9 +362,9 @@ The above is the content you need to summarize.`,
The 'knowledge' is a very special variable which will be filled-in with the retrieved chunks.
All the variables in 'System' should be curly bracketed.`,
add: 'Add',
key: 'key',
key: 'Key',
optional: 'Optional',
operation: 'operation',
operation: 'Operation',
model: 'Model',
modelTip: 'Large language chat model',
modelMessage: 'Please select!',
Expand Down Expand Up @@ -642,7 +642,7 @@ The above is the content you need to summarize.`,
'Loop is the upper limit of the number of loops of the current component, when the number of loops exceeds the value of loop, it means that the component can not complete the current task, please re-optimize agent',
yes: 'Yes',
no: 'No',
key: 'key',
key: 'Key',
componentId: 'Component ID',
add: 'Add',
operation: 'operation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ const AssistantSetting = ({ show }: ISegmentedContentProps) => {
>
<Switch />
</Form.Item> */}
{/* <Form.Item
<Form.Item
label={t('tts')}
valuePropName="checked"
name={['prompt_config', 'tts']}
tooltip={t('ttsTip')}
initialValue={false}
>
<Switch />
</Form.Item> */}
</Form.Item>
<KnowledgeBaseItem></KnowledgeBaseItem>
</section>
);
Expand Down

0 comments on commit e6bc86c

Please sign in to comment.