perf: optimize message loading based on streaming state
Decreased message limit to 90 for historical views when not streaming. Add fetch buffer to preload additional messages for efficient syncing.
This commit is contained in:
@@ -354,10 +354,11 @@ class OpencodeService {
|
||||
return response.data;
|
||||
}
|
||||
|
||||
async getSessionMessages(id: string): Promise<{ info: Message; parts: Part[] }[]> {
|
||||
async getSessionMessages(id: string, limit?: number): Promise<{ info: Message; parts: Part[] }[]> {
|
||||
const response = await this.client.session.messages({
|
||||
sessionID: id,
|
||||
...(this.currentDirectory ? { directory: this.currentDirectory } : {})
|
||||
...(this.currentDirectory ? { directory: this.currentDirectory } : {}),
|
||||
...(typeof limit === 'number' ? { limit } : {}),
|
||||
});
|
||||
return response.data || [];
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user