mirror of
https://github.com/openclaw/openclaw.git
synced 2026-06-26 04:09:32 +00:00
refactor(memory): drop unused host helpers
This commit is contained in:
@@ -799,34 +799,3 @@ export function expandQueryForFts(
|
||||
|
||||
return { original, keywords, expanded };
|
||||
}
|
||||
|
||||
/**
|
||||
* Type for an optional LLM-based query expander.
|
||||
* Can be provided to enhance keyword extraction with semantic understanding.
|
||||
*/
|
||||
export type LlmQueryExpander = (query: string) => Promise<string[]>;
|
||||
|
||||
/**
|
||||
* Expand query with optional LLM assistance.
|
||||
* Falls back to local extraction if LLM is unavailable or fails.
|
||||
*/
|
||||
export async function expandQueryWithLlm(
|
||||
query: string,
|
||||
llmExpander?: LlmQueryExpander,
|
||||
opts?: { ftsTokenizer?: "unicode61" | "trigram" },
|
||||
): Promise<string[]> {
|
||||
// If LLM expander is provided, try it first
|
||||
if (llmExpander) {
|
||||
try {
|
||||
const llmKeywords = await llmExpander(query);
|
||||
if (llmKeywords.length > 0) {
|
||||
return llmKeywords;
|
||||
}
|
||||
} catch {
|
||||
// LLM failed, fall back to local extraction
|
||||
}
|
||||
}
|
||||
|
||||
// Fall back to local keyword extraction
|
||||
return extractKeywords(query, opts);
|
||||
}
|
||||
|
||||
@@ -42,11 +42,3 @@ export function resolveMemoryCacheSummary(cache: { enabled: boolean; entries?: n
|
||||
const suffix = typeof cache.entries === "number" ? ` (${cache.entries})` : "";
|
||||
return { tone: "ok", text: `cache on${suffix}` };
|
||||
}
|
||||
|
||||
/** Resolve cache enabled state without count text. */
|
||||
export function resolveMemoryCacheState(cache: { enabled: boolean }): {
|
||||
tone: Tone;
|
||||
state: "enabled" | "disabled";
|
||||
} {
|
||||
return cache.enabled ? { tone: "ok", state: "enabled" } : { tone: "muted", state: "disabled" };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user