Skip to content

Commit 3a03797

Browse files
jackshen310shenxiaojie.316
andauthored
feat(realtime-websocket): implement settings component and API integration (#277)
Co-authored-by: shenxiaojie.316 <shenxiaojie.316@bytedance.com>
1 parent 9ed09d2 commit 3a03797

15 files changed

Lines changed: 659 additions & 39 deletions

File tree

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"changes": [
3+
{
4+
"packageName": "@coze/api",
5+
"comment": "implement settings component and API integration",
6+
"type": "minor"
7+
}
8+
],
9+
"packageName": "@coze/api",
10+
"email": "shenxiaojie.316@bytedance.com"
11+
}

examples/coze-js-node/src/bot.ts

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,16 +36,14 @@ async function main() {
3636
console.log('client.bots.publish', publishedBot);
3737

3838
await sleep(1000);
39-
const list = await client.bots.list({
40-
space_id: spaceId,
41-
page_index: 1,
39+
const list = await client.bots.listNew({
40+
workspace_id: spaceId,
41+
page_num: 1,
4242
page_size: 10,
4343
});
4444
console.log('client.bots.list', list);
4545

46-
const info = await client.bots.retrieve({
47-
bot_id: bot.bot_id,
48-
});
46+
const info = await client.bots.retrieveNew(bot.bot_id);
4947
console.log('client.bots.retrieve', info);
5048
}
5149

examples/coze-js-node/src/websockets/transcriptions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ const filename = fileURLToPath(import.meta.url);
1010
const filePath = join(dirname(filename), '../../tmp/pcm.txt');
1111

1212
async function main() {
13-
const ws = await client.websockets.audio.transcriptions.create({
13+
const ws = await client.websockets.audio.transcriptions.create(undefined, {
1414
maxRetries: 3,
1515
});
1616

examples/realtime-websocket/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@
55
"type": "module",
66
"scripts": {
77
"build": "tsc && vite build",
8-
"lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
8+
"lint": "eslint . --max-warnings 0",
99
"preview": "vite preview",
1010
"run-preinstall": "node scripts/preinstall.cjs",
11-
"start": "vite",
11+
"start": "vite --host",
1212
"test": "exit 0"
1313
},
1414
"dependencies": {

examples/realtime-websocket/src/components/audio-config/index.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ export interface AudioConfigRef {
2727
autoGainControl: boolean;
2828
debug: boolean;
2929
audioMutedDefault: boolean;
30+
isHuaweiMobile: boolean;
3031
};
3132
}
3233

@@ -53,6 +54,9 @@ export const AudioConfig = forwardRef<
5354
const [autoGainControl, setAutoGainControl] = useState(true);
5455
const [debug, setDebug] = useState(false);
5556
const [audioMutedDefault, setAudioMutedDefault] = useState(false);
57+
const [isHuaweiMobile, setIsHuaweiMobile] = useState(
58+
WsToolsUtils.isHarmonOS(),
59+
);
5660

5761
useEffect(() => {
5862
if (!clientRef.current) {
@@ -93,6 +97,7 @@ export const AudioConfig = forwardRef<
9397
autoGainControl,
9498
debug,
9599
audioMutedDefault,
100+
isHuaweiMobile,
96101
}),
97102
}));
98103

@@ -151,6 +156,20 @@ export const AudioConfig = forwardRef<
151156
</Tooltip>
152157
</Checkbox>
153158
</Col>
159+
<Col>
160+
<Checkbox
161+
checked={isHuaweiMobile}
162+
disabled={isRecording}
163+
onChange={e => setIsHuaweiMobile(e.target.checked)}
164+
>
165+
鸿蒙手机
166+
<Tooltip title="解决回音无法消除的问题">
167+
<InfoCircleOutlined
168+
style={{ marginLeft: 4, color: '#999' }}
169+
/>
170+
</Tooltip>
171+
</Checkbox>
172+
</Col>
154173
</Row>
155174
</Col>
156175

examples/realtime-websocket/src/components/header/header.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ const AppHeader: React.FC<AppHeaderProps> = ({
2626
<Settings
2727
onSettingsChange={onSettingsChange}
2828
localStorageKey={localStorageKey}
29+
fields={[]}
2930
/>
3031
</div>
3132
</Header>

0 commit comments

Comments
 (0)