feat: add remove chat button and logic

This commit is contained in:
tusharmagar 2026-02-16 15:28:20 +05:30
parent c5c36ed0e4
commit 503693775a
6 changed files with 46 additions and 2 deletions

View file

@ -12,6 +12,7 @@ export interface IRunsRepo {
fetch(id: string): Promise<z.infer<typeof Run>>;
list(cursor?: string): Promise<z.infer<typeof ListRunsResponse>>;
appendEvents(runId: string, events: z.infer<typeof RunEvent>[]): Promise<void>;
delete(id: string): Promise<void>;
}
/**
@ -236,4 +237,9 @@ export class FSRunsRepo implements IRunsRepo {
...(nextCursor ? { nextCursor } : {}),
};
}
async delete(id: string): Promise<void> {
const filePath = path.join(WorkDir, 'runs', `${id}.jsonl`);
await fsp.unlink(filePath);
}
}

View file

@ -65,6 +65,11 @@ export async function stop(runId: string, force: boolean = false): Promise<void>
// This avoids duplicate events and ensures proper sequencing.
}
export async function deleteRun(runId: string): Promise<void> {
const repo = container.resolve<IRunsRepo>('runsRepo');
await repo.delete(runId);
}
export async function fetchRun(runId: string): Promise<z.infer<typeof Run>> {
const repo = container.resolve<IRunsRepo>('runsRepo');
return repo.fetch(runId);