Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 21 additions & 2 deletions assistant/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import {
saveRawConfig,
getNestedValue,
setNestedValue,
getConfig,
API_KEY_PROVIDERS,
} from './config/loader.js';
import {
Expand All @@ -46,6 +47,7 @@ import {
clearAll as clearAllConversations,
} from './memory/conversation-store.js';
import { initializeDb } from './memory/db.js';
import { initQdrantClient } from './memory/qdrant-client.js';
import { formatMarkdown, formatJson } from './export/formatter.js';
import {
getMemorySystemStatus,
Expand Down Expand Up @@ -294,9 +296,9 @@ sessions

sessions
.command('clear')
.description('Clear all conversations and messages from the daemon SQLite DB (dev only)')
.description('Clear all conversations, messages, and vector data (dev only)')
.action(async () => {
console.log('This will permanently delete all conversations and messages from the daemon SQLite database.');
console.log('This will permanently delete all conversations, messages, and vector data.');

const readline = await import('node:readline');
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
Expand All @@ -312,6 +314,23 @@ sessions
initializeDb();
const result = clearAllConversations();
console.log(`Cleared ${result.conversations} conversations, ${result.messages} messages`);

const config = getConfig();
const qdrantUrl = process.env.QDRANT_URL?.trim() || config.memory.qdrant.url;
const qdrant = initQdrantClient({
url: qdrantUrl,
collection: config.memory.qdrant.collection,
vectorSize: config.memory.qdrant.vectorSize,
onDisk: config.memory.qdrant.onDisk,
quantization: config.memory.qdrant.quantization,
});
const deleted = await qdrant.deleteCollection();
Comment thread
siddseethepalli marked this conversation as resolved.
if (deleted) {
console.log(`Deleted Qdrant collection "${config.memory.qdrant.collection}"`);
} else {
console.log('Qdrant collection not found or not reachable (skipped)');
}

console.log('Done.');
});

Expand Down
13 changes: 13 additions & 0 deletions assistant/src/memory/qdrant-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,19 @@ export class VellumQdrantClient {
return result.count;
}

async deleteCollection(): Promise<boolean> {
try {
const exists = await this.client.collectionExists(this.collection);
if (!exists.exists) return false;
await this.client.deleteCollection(this.collection);
this.collectionReady = false;
return true;
} catch (err) {
log.warn({ err, collection: this.collection }, 'Failed to delete Qdrant collection');
return false;
}
}

private async findByTarget(targetType: string, targetId: string): Promise<string | null> {
try {
const results = await this.client.scroll(this.collection, {
Expand Down