fix(chat): isolate pending flows and cancel stale requests
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import type {
|
||||
CacheRemoteChatMediaInput,
|
||||
ChatMediaLookupInput,
|
||||
ChatRequestOptions,
|
||||
ChatSendOptions,
|
||||
IChatRepository,
|
||||
UnlockPrivateMessageInput,
|
||||
UnlockedPrivateMessageLocalPatch,
|
||||
@@ -38,7 +40,7 @@ export class ChatRepository implements IChatRepository {
|
||||
async sendMessage(
|
||||
characterId: string,
|
||||
message: string,
|
||||
options?: { image?: string; useWebSocket?: boolean },
|
||||
options?: ChatSendOptions,
|
||||
): Promise<Result<ChatSendResponse>> {
|
||||
return this.remote.sendMessage(characterId, message, options);
|
||||
}
|
||||
@@ -48,22 +50,25 @@ export class ChatRepository implements IChatRepository {
|
||||
characterId: string,
|
||||
limit = 50,
|
||||
offset = 0,
|
||||
options?: ChatRequestOptions,
|
||||
): Promise<Result<ChatHistoryResponse>> {
|
||||
return this.remote.getHistory(characterId, limit, offset);
|
||||
return this.remote.getHistory(characterId, limit, offset, options);
|
||||
}
|
||||
|
||||
/** 解锁单条历史付费 / 私密消息。 */
|
||||
async unlockPrivateMessage(
|
||||
input: UnlockPrivateMessageInput,
|
||||
options?: ChatRequestOptions,
|
||||
): Promise<Result<UnlockPrivateResponse>> {
|
||||
return this.remote.unlockPrivateMessage(input);
|
||||
return this.remote.unlockPrivateMessage(input, options);
|
||||
}
|
||||
|
||||
/** 一键解锁历史锁定消息。 */
|
||||
async unlockHistory(
|
||||
characterId: string,
|
||||
options?: ChatRequestOptions,
|
||||
): Promise<Result<UnlockHistoryResponse>> {
|
||||
return this.remote.unlockHistory(characterId);
|
||||
return this.remote.unlockHistory(characterId, options);
|
||||
}
|
||||
|
||||
/** 把本地缓存中的单条锁定消息标记为已解锁。 */
|
||||
|
||||
Reference in New Issue
Block a user