mirror of
https://github.com/siteboon/claudecodeui.git
synced 2026-07-07 14:12:40 +08:00
fix: remove gemini support since google discontinued it
This commit is contained in:
@@ -8,7 +8,7 @@ import { rgPath } from '@vscode/ripgrep';
|
||||
import { projectsDb, sessionsDb } from '@/modules/database/index.js';
|
||||
|
||||
type AnyRecord = Record<string, any>;
|
||||
type SearchableProvider = 'claude' | 'codex' | 'gemini';
|
||||
type SearchableProvider = 'claude' | 'codex';
|
||||
|
||||
type SearchSnippetHighlight = {
|
||||
start: number;
|
||||
@@ -82,7 +82,7 @@ type ProjectBucket = {
|
||||
sessions: SearchableSessionRow[];
|
||||
};
|
||||
|
||||
const SUPPORTED_PROVIDERS = new Set<SearchableProvider>(['claude', 'codex', 'gemini']);
|
||||
const SUPPORTED_PROVIDERS = new Set<SearchableProvider>(['claude', 'codex']);
|
||||
const MAX_MATCHES_PER_SESSION = 2;
|
||||
const RIPGREP_FILE_CHUNK_SIZE = 40;
|
||||
const RIPGREP_CHUNK_CONCURRENCY = 6;
|
||||
@@ -455,21 +455,6 @@ function extractCodexText(content: unknown): string {
|
||||
.join(' ');
|
||||
}
|
||||
|
||||
function extractGeminiText(content: unknown): string {
|
||||
if (typeof content === 'string') {
|
||||
return content;
|
||||
}
|
||||
|
||||
if (!Array.isArray(content)) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return content
|
||||
.filter((part: AnyRecord) => typeof part?.text === 'string')
|
||||
.map((part: AnyRecord) => String(part.text))
|
||||
.join(' ');
|
||||
}
|
||||
|
||||
function normalizeSearchableSessions(rows: SessionRepositoryRow[]): SearchableSessionRow[] {
|
||||
const normalizedRows: SearchableSessionRow[] = [];
|
||||
const projectArchiveStateByPath = new Map<string, boolean>();
|
||||
@@ -1065,81 +1050,6 @@ async function parseCodexSessionMatches(
|
||||
};
|
||||
}
|
||||
|
||||
async function parseGeminiSessionMatches(
|
||||
session: SearchableSessionRow,
|
||||
runtime: SearchRuntime,
|
||||
): Promise<SessionConversationResult | null> {
|
||||
let data: string;
|
||||
try {
|
||||
data = await fs.readFile(session.jsonl_path, 'utf8');
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
let parsed: AnyRecord;
|
||||
try {
|
||||
parsed = JSON.parse(data) as AnyRecord;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
|
||||
const sourceMessages = Array.isArray(parsed.messages) ? parsed.messages as AnyRecord[] : [];
|
||||
if (sourceMessages.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const matches: SessionConversationMatch[] = [];
|
||||
let firstUserText: string | null = null;
|
||||
|
||||
for (const msg of sourceMessages) {
|
||||
if (runtime.totalMatches >= runtime.limit || runtime.isAborted()) {
|
||||
break;
|
||||
}
|
||||
|
||||
const role = msg.type === 'user'
|
||||
? 'user'
|
||||
: (msg.type === 'gemini' || msg.type === 'assistant')
|
||||
? 'assistant'
|
||||
: null;
|
||||
if (!role) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const text = extractGeminiText(msg.content);
|
||||
if (!text) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (role === 'user' && !firstUserText) {
|
||||
firstUserText = text;
|
||||
}
|
||||
|
||||
if (!runtime.matchesQuery(text)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const { snippet, highlights } = runtime.buildSnippet(text);
|
||||
addSessionMatch(runtime, matches, {
|
||||
role,
|
||||
snippet,
|
||||
highlights,
|
||||
timestamp: msg.timestamp ? String(msg.timestamp) : null,
|
||||
provider: 'gemini',
|
||||
});
|
||||
}
|
||||
|
||||
if (matches.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return {
|
||||
sessionId: session.session_id,
|
||||
provider: 'gemini',
|
||||
sessionSummary: toSummaryText(session.custom_name, firstUserText, 'Gemini Session'),
|
||||
matches,
|
||||
};
|
||||
}
|
||||
|
||||
async function parseSessionMatches(
|
||||
session: SearchableSessionRow,
|
||||
runtime: SearchRuntime,
|
||||
@@ -1150,7 +1060,7 @@ async function parseSessionMatches(
|
||||
if (session.provider === 'codex') {
|
||||
return parseCodexSessionMatches(session, runtime);
|
||||
}
|
||||
return parseGeminiSessionMatches(session, runtime);
|
||||
return null;
|
||||
}
|
||||
|
||||
export async function searchConversations(
|
||||
|
||||
Reference in New Issue
Block a user