@clowder-ai/companion 0.1.0-alpha.1 → 0.1.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/plugin.yaml +1 -1
- package/renderer/conversation.mjs +7 -6
package/manifest.json
CHANGED
package/package.json
CHANGED
package/plugin.yaml
CHANGED
|
@@ -26,10 +26,6 @@ export class CompanionConversation {
|
|
|
26
26
|
this.show('正在连接…');
|
|
27
27
|
this.deadline = setTimeout(() => { if (this.current(generation)) void this.end('连接超时 · 点击开始聊天重试'); }, 60_000);
|
|
28
28
|
try {
|
|
29
|
-
const identity = await preparation;
|
|
30
|
-
if (!this.current(generation)) return;
|
|
31
|
-
if (identity.phase !== 'ready') throw { code: 'unavailable' };
|
|
32
|
-
this.identity = identity;
|
|
33
29
|
const peer = this.createPeer(event => {
|
|
34
30
|
if (!this.current(generation)) return;
|
|
35
31
|
if (event.type === 'connected') { clearTimeout(this.deadline); this.phase = 'talking'; this.show(this.listening()); }
|
|
@@ -40,8 +36,13 @@ export class CompanionConversation {
|
|
|
40
36
|
});
|
|
41
37
|
this.peer = peer;
|
|
42
38
|
peer.muteMic(this.muted); peer.muteSpeaker(this.silent);
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
// Submit capture intent while this same click is active. The Host waits
|
|
40
|
+
// for its matching preparation before creating the media document.
|
|
41
|
+
const [identity] = await Promise.all([preparation, peer.connect()]);
|
|
42
|
+
if (!this.current(generation)) { await peer.close(); return; }
|
|
43
|
+
if (identity.phase !== 'ready') throw { code: 'unavailable' };
|
|
44
|
+
this.identity = identity;
|
|
45
|
+
this.show(this.message);
|
|
45
46
|
} catch (error) {
|
|
46
47
|
if (this.current(generation)) await this.end(explainError(error));
|
|
47
48
|
}
|