mirror of
https://github.com/coaidev/coai.git
synced 2025-05-23 23:10:13 +09:00
fix connection error
This commit is contained in:
parent
2d931d4938
commit
18c2679826
@ -84,7 +84,17 @@ export class Conversation {
|
||||
if (auth.value) this.connection = new Connection();
|
||||
}
|
||||
|
||||
public notReady(): boolean {
|
||||
return Boolean(auth.value && !this.connection?.state);
|
||||
}
|
||||
|
||||
public async send(content: string): Promise<void> {
|
||||
if (this.notReady()) {
|
||||
const apply = () => {
|
||||
if (this.notReady()) return setTimeout(apply, 100);
|
||||
this.send(content);
|
||||
};
|
||||
}
|
||||
return await (auth.value ? this.sendAuthenticated(content) : this.sendAnonymous(content));
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user