mirror of
https://github.com/EthanMarti/infio-copilot.git
synced 2026-05-08 16:10:09 +00:00
update history
This commit is contained in:
@@ -55,8 +55,10 @@ export abstract class AbstractJsonRepository<T, M> {
|
||||
|
||||
// List metadata for all records by parsing file names.
|
||||
public async listMetadata(): Promise<(M & { fileName: string })[]> {
|
||||
console.log('AbstractJsonRepository - listMetadata called for dataDir:', this.dataDir)
|
||||
const files = await this.app.vault.adapter.list(this.dataDir)
|
||||
return files.files
|
||||
console.log('AbstractJsonRepository - files in directory:', files)
|
||||
const result = files.files
|
||||
.map((filePath) => path.basename(filePath))
|
||||
.filter((fileName) => fileName.endsWith('.json'))
|
||||
.map((fileName) => {
|
||||
@@ -66,6 +68,8 @@ export abstract class AbstractJsonRepository<T, M> {
|
||||
.filter(
|
||||
(metadata): metadata is M & { fileName: string } => metadata !== null,
|
||||
)
|
||||
console.log('AbstractJsonRepository - parsed metadata:', result)
|
||||
return result
|
||||
}
|
||||
|
||||
public async read(fileName: string): Promise<T | null> {
|
||||
|
||||
@@ -111,7 +111,12 @@ export class ChatManager extends AbstractJsonRepository<
|
||||
}
|
||||
|
||||
public async listChats(): Promise<ChatConversationMeta[]> {
|
||||
console.log('ChatManager - listChats called')
|
||||
console.log('ChatManager - data directory:', this.dataDir)
|
||||
const metadata = await this.listMetadata()
|
||||
return metadata.sort((a, b) => b.updatedAt - a.updatedAt)
|
||||
console.log('ChatManager - raw metadata:', metadata)
|
||||
const sorted = metadata.sort((a, b) => b.updatedAt - a.updatedAt)
|
||||
console.log('ChatManager - sorted chats:', sorted)
|
||||
return sorted
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user