Spaces:
Paused
Paused
dushyantsingh0 commited on
Commit ·
f3292d9
1
Parent(s): 39fa38f
backend stabilization
Browse filesFiles changed (2)
374 unmodified lines375376377378379380381382374 unmodified lineslogger.info(f"⚡ Search Cache HIT [KB]: {q}")return cached_res# 0.5 Semantic Cache Check for pin-point Answer (if NL query)is_question = q.strip().endswith('?') or any(q.lower().startswith(w) for w in ["how", "what", "where", "why", "who", "tell"])if is_question:sem_answer = await SemanticCacheManager.check_cache(str(target_ws), q,374 unmodified lines375376377378379380381382383384385386374 unmodified lineslogger.info(f"⚡ Search Cache HIT [KB]: {q}")return cached_res# 0.5 Semantic Cache Check for pin-point Answer (if meaningful query)is_question = (q.strip().endswith('?') orany(q.lower().startswith(w) for w in ["how", "what", "where", "why", "who", "tell", "explain", "describe"]) orlen(q.strip().split()) >= 5 # Broaden to multi-word technical queries like "Data models")if is_question:sem_answer = await SemanticCacheManager.check_cache(str(target_ws), q,
283 unmodified lines28428528628728828929029129229358 unmodified lines352353354355356357358359360361362363364365283 unmodified lines<div style={{ position: "absolute", top: 0, left: 0, width: "100%", height: 3, background: COLORS.brand, borderRadius: "20px 20px 0 0" }} /><div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 24 }}><div style={{ display: "flex", alignItems: "center", gap: 10, background: COLORS.brandLight, padding: "6px 14px", borderRadius: 8 }}><Sparkles size={16} color={COLORS.brand} /><span style={{ fontSize: 11, fontWeight: 900, color: COLORS.brand, letterSpacing: "0.1em", textTransform: "uppercase" }}>AI DIRECT ANSWER</span></div>{isAiSynthetic && (<span style={{ fontSize: 10, fontWeight: 800, color: "#16A34A", background: "#F0FDF4", padding: "4px 8px", borderRadius: 4 }}>58 unmodified linese.currentTarget.style.borderColor = COLORS.gray100;}}><span style={{ fontSize: 10, fontWeight: 800, color: COLORS.brand, textTransform: "uppercase", letterSpacing: "0.1em", marginBottom: 16, display: "block" }}>{article.category || "N/A"}</span><h3 style={{ fontSize: 22, fontWeight: 800, color: COLORS.gray900, marginBottom: 12, lineHeight: 1.2, wordBreak: "break-word", overflowWrap: "anywhere" }}>{article.title}</h3><p style={{fontSize: 15, color: COLORS.gray600, lineHeight: 1.6, marginBottom: 24,display: "-webkit-box", WebkitLineClamp: 3, WebkitBoxOrient: "vertical", overflow: "hidden",wordBreak: "break-word", overflowWrap: "anywhere"}}>{article.snippet || article.summary || article.content.replace(/[#*`]/g, '').slice(0, 180)}...</p><div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", borderTop: `1px solid ${COLORS.gray50}`, paddingTop: 24, marginTop: "auto" }}><span style={{ fontSize: 12, color: COLORS.gray400, fontWeight: 500 }}>Published {new Date(article.created_at).toLocaleDateString()}</span>283 unmodified lines28428528628728828929029129229329429558 unmodified lines354355356357358359360361362363364365366367368369370371372373374375376377378283 unmodified lines<div style={{ position: "absolute", top: 0, left: 0, width: "100%", height: 3, background: COLORS.brand, borderRadius: "20px 20px 0 0" }} /><div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 24 }}><div style={{ display: "flex", alignItems: "center", gap: 10, background: COLORS.brandLight, padding: "6px 14px", borderRadius: 8 }}><div style={{ display: "flex", alignItems: "center", gap: 8 }}><Sparkles size={16} color={COLORS.brand} /><span style={{ fontSize: 11, fontWeight: 900, color: COLORS.brand, letterSpacing: "0.1em", textTransform: "uppercase" }}>AI DIRECT ANSWER</span></div></div>{isAiSynthetic && (<span style={{ fontSize: 10, fontWeight: 800, color: "#16A34A", background: "#F0FDF4", padding: "4px 8px", borderRadius: 4 }}>58 unmodified linese.currentTarget.style.borderColor = COLORS.gray100;}}><div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", marginBottom: 16 }}><span style={{ fontSize: 10, fontWeight: 800, color: COLORS.brand, textTransform: "uppercase", letterSpacing: "0.1em" }}>{article.category || "N/A"}</span>{article.score && (<span style={{ fontSize: 10, fontWeight: 800, color: article.score > 80 ? COLORS.success : COLORS.brand, background: article.score > 80 ? "#F0FDF4" : COLORS.brandLight, padding: "2px 8px", borderRadius: 4 }}>{article.score.toFixed(0)}% MATCH</span>)}</div><h3 style={{ fontSize: 22, fontWeight: 800, color: COLORS.gray900, marginBottom: 12, lineHeight: 1.2, wordBreak: "break-word", overflowWrap: "anywhere" }}>{article.title}</h3><p style={{fontSize: 15, color: COLORS.gray600, lineHeight: 1.6, marginBottom: 24,display: "-webkit-box", WebkitLineClamp: 3, WebkitBoxOrient: "vertical", overflow: "hidden",wordBreak: "break-word", overflowWrap: "anywhere"}}>{article.snippet ? (<span><strong style={{ color: COLORS.brand, fontSize: 11, marginRight: 6 }}>[MATCH]</strong> {article.snippet}</span>) : article.summary ? (<span><Sparkles size={12} style={{ display: "inline", marginRight: 6, verticalAlign: "middle" }} color={COLORS.brand} /> {article.summary}</span>) : article.content.replace(/[#*`]/g, '').slice(0, 180)}...</p><div style={{ display: "flex", justifyContent: "space-between", alignItems: "center", borderTop: `1px solid ${COLORS.gray50}`, paddingTop: 24, marginTop: "auto" }}><span style={{ fontSize: 12, color: COLORS.gray400, fontWeight: 500 }}>Published {new Date(article.created_at).toLocaleDateString()}</span>
api/v1/kb.py+6-2
frontend/apps/customer/src/components/KnowledgeBase.tsx+19-6