feat(characters): support character-scoped conversations

This commit is contained in:
2026-07-17 11:42:31 +08:00
parent 93efcb6604
commit 2796010971
85 changed files with 1645 additions and 251 deletions
+11 -3
View File
@@ -11,6 +11,7 @@ import {
ChatHistoryResponse,
ChatSendResponse,
SendMessageRequest,
UnlockHistoryRequest,
UnlockHistoryResponse,
UnlockPrivateRequest,
UnlockPrivateResponse,
@@ -31,9 +32,13 @@ export class ChatApi {
/**
* 获取聊天历史
*/
async getHistory(limit = 50, offset = 0): Promise<ChatHistoryResponse> {
async getHistory(
characterId: string,
limit = 50,
offset = 0,
): Promise<ChatHistoryResponse> {
const env = await httpClient<ApiEnvelope<unknown>>(ApiPath.chatHistory, {
query: { limit, offset },
query: { characterId, limit, offset },
});
return ChatHistoryResponse.fromJson(
unwrap(env) as Record<string, unknown>
@@ -61,11 +66,14 @@ export class ChatApi {
/**
* 一键解锁历史锁定消息
*/
async unlockHistory(): Promise<UnlockHistoryResponse> {
async unlockHistory(
body: UnlockHistoryRequest,
): Promise<UnlockHistoryResponse> {
const env = await httpClient<ApiEnvelope<unknown>>(
ApiPath.chatUnlockHistory,
{
method: "POST",
body: body.toJson(),
},
);
return UnlockHistoryResponse.fromJson(