mirror of
https://github.com/lobehub/lobe-chat.git
synced 2026-06-14 11:40:07 +00:00
🐛 fix: fix topic fetch not correct in custom agent (#9761)
* fix topic issue * fix tests
This commit is contained in:
@@ -20,7 +20,6 @@ interface QueryTopicParams {
|
||||
containerId?: string | null; // sessionId or groupId
|
||||
current?: number;
|
||||
pageSize?: number;
|
||||
sessionId?: string | null;
|
||||
}
|
||||
|
||||
export class TopicModel {
|
||||
|
||||
@@ -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' }]);
|
||||
});
|
||||
|
||||
@@ -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 };
|
||||
|
||||
@@ -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[]>;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user