Attmepting to hide SearXNG's native info block
This commit is contained in:
+8
-13
@@ -853,7 +853,6 @@ FRONTEND_JS_TEMPLATE = r"""
|
||||
const script_root = __SCRIPT_ROOT__;
|
||||
const model_init = __MODEL_INIT__;
|
||||
const session_id_init = __SESSION_ID__;
|
||||
const intent_init = __INTENT__;
|
||||
if (session_id_init && !document.cookie.includes('sxng_ai_session')) {
|
||||
document.cookie = `sxng_ai_session=${session_id_init}; path=/; max-age=1800; SameSite=Lax`;
|
||||
}
|
||||
@@ -872,14 +871,6 @@ FRONTEND_JS_TEMPLATE = r"""
|
||||
|
||||
__CITATION_HELPER_JS__
|
||||
|
||||
(function applyIntentBadge() {
|
||||
const intentEmoji = {factual:'📖',howto:'🔧',technical:'⌨️',comparison:'⚖️',opinion:'💬',current:'📰',local:'📍'}[intent_init] || '';
|
||||
if (intentEmoji) {
|
||||
const label = box ? box.querySelector('.sxng-ai-label') : null;
|
||||
if (label) label.innerHTML += ` <span style="font-size:0.8em;opacity:0.7;">${intentEmoji}</span>`;
|
||||
}
|
||||
})();
|
||||
|
||||
__INTERACTIVE_JS_INIT__
|
||||
|
||||
async function loadPriorConversation() {
|
||||
@@ -1972,9 +1963,6 @@ class SXNGPlugin(Plugin):
|
||||
).hexdigest()[:24]
|
||||
js_session_id = safe_json(session_id)
|
||||
|
||||
detected_intent = _detect_intent(q_clean)
|
||||
js_intent = safe_json(detected_intent)
|
||||
|
||||
b64_context = base64.b64encode(context_str.encode('utf-8')).decode('utf-8')
|
||||
total_context_count = self.context_deep_count + self.context_shallow_count
|
||||
|
||||
@@ -2008,7 +1996,6 @@ class SXNGPlugin(Plugin):
|
||||
.replace("__SCRIPT_ROOT__", js_script_root) \
|
||||
.replace("__MODEL_INIT__", js_model_init) \
|
||||
.replace("__SESSION_ID__", js_session_id) \
|
||||
.replace("__INTENT__", js_intent) \
|
||||
.replace("__CITATION_HELPER_JS__", CITATION_HELPER_JS) \
|
||||
.replace("__INTERACTIVE_JS_INIT__", interactive_js_init) \
|
||||
.replace("__STREAM_FN_SIG__", stream_fn_sig) \
|
||||
@@ -2082,6 +2069,14 @@ class SXNGPlugin(Plugin):
|
||||
</script>
|
||||
</article>
|
||||
'''
|
||||
try:
|
||||
search.result_container.answers.clear()
|
||||
except Exception:
|
||||
pass
|
||||
try:
|
||||
search.result_container.infoboxes.clear()
|
||||
except Exception:
|
||||
pass
|
||||
search.result_container.answers.add(results.types.Answer(answer=Markup(html_payload)))
|
||||
except Exception as e:
|
||||
logger.error(f"{PLUGIN_NAME}: {e}")
|
||||
|
||||
Reference in New Issue
Block a user