feat(characters): support character-scoped conversations
This commit is contained in:
@@ -2,6 +2,7 @@ import {
|
||||
ChatHistoryResponse,
|
||||
ChatSendResponse,
|
||||
SendMessageRequest,
|
||||
UnlockHistoryRequest,
|
||||
UnlockHistoryResponse,
|
||||
UnlockPrivateRequest,
|
||||
UnlockPrivateResponse,
|
||||
@@ -14,11 +15,13 @@ export class ChatRemoteDataSource {
|
||||
constructor(private readonly api: ChatApi) {}
|
||||
|
||||
async sendMessage(
|
||||
characterId: string,
|
||||
message: string,
|
||||
options?: { image?: string; useWebSocket?: boolean },
|
||||
): Promise<Result<ChatSendResponse>> {
|
||||
return Result.wrap(async () => {
|
||||
const request = SendMessageRequest.from({
|
||||
characterId,
|
||||
message,
|
||||
image: options?.image ?? "",
|
||||
useWebSocket: options?.useWebSocket ?? false,
|
||||
@@ -28,10 +31,11 @@ export class ChatRemoteDataSource {
|
||||
}
|
||||
|
||||
async getHistory(
|
||||
characterId: string,
|
||||
limit = 50,
|
||||
offset = 0,
|
||||
): Promise<Result<ChatHistoryResponse>> {
|
||||
return Result.wrap(() => this.api.getHistory(limit, offset));
|
||||
return Result.wrap(() => this.api.getHistory(characterId, limit, offset));
|
||||
}
|
||||
|
||||
async unlockPrivateMessage(
|
||||
@@ -42,7 +46,11 @@ export class ChatRemoteDataSource {
|
||||
);
|
||||
}
|
||||
|
||||
async unlockHistory(): Promise<Result<UnlockHistoryResponse>> {
|
||||
return Result.wrap(() => this.api.unlockHistory());
|
||||
async unlockHistory(
|
||||
characterId: string,
|
||||
): Promise<Result<UnlockHistoryResponse>> {
|
||||
return Result.wrap(() =>
|
||||
this.api.unlockHistory(UnlockHistoryRequest.from({ characterId })),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user