🐛 fix: fix topic fetch not correct in custom agent (#9761)

* fix topic issue

* fix tests
This commit is contained in:
Arvin Xu
2025-10-18 13:34:07 +08:00
committed by GitHub
parent b56c9c51b8
commit ceffce27c3
4 changed files with 3 additions and 4 deletions
-1
View File
@@ -20,7 +20,6 @@ interface QueryTopicParams {
containerId?: string | null; // sessionId or groupId
current?: number;
pageSize?: number;
sessionId?: string | null;
}
export class TopicModel {
+1 -1
View File
@@ -32,7 +32,7 @@ describe('AiChatService', () => {
{ includeTopic: true, sessionId: 's1' },
expect.objectContaining({ postProcessUrl: expect.any(Function) }),
);
expect(mockQueryTopics).toHaveBeenCalledWith({ sessionId: 's1' });
expect(mockQueryTopics).toHaveBeenCalledWith({ containerId: 's1' });
expect(res.messages).toEqual([{ id: 'm1' }]);
expect(res.topics).toEqual([{ id: 't1' }]);
});
+1 -1
View File
@@ -29,7 +29,7 @@ export class AiChatService {
this.messageModel.query(params, {
postProcessUrl: (path) => this.fileService.getFullFileUrl(path),
}),
params.includeTopic ? this.topicModel.query({ sessionId: params.sessionId }) : undefined,
params.includeTopic ? this.topicModel.query({ containerId: params.sessionId }) : undefined,
]);
return { messages, topics };
+1 -1
View File
@@ -38,7 +38,7 @@ export class ClientService extends BaseClientService implements ITopicService {
getTopics: ITopicService['getTopics'] = async (params) => {
const data = await this.topicModel.query({
...params,
sessionId: this.toDbSessionId(params.containerId),
containerId: this.toDbSessionId(params.containerId),
});
return data as unknown as Promise<ChatTopic[]>;
};