Compare commits
4 Commits
31c8b96f5e
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 888764c45a | |||
| 3030c5e10b | |||
| ad8f1397bc | |||
| bda9e5a462 |
@@ -1,9 +1,9 @@
|
|||||||
<div align="center">
|
<div align="center">
|
||||||
|
|
||||||
[](https://git.tysstech.com/TySS-Dev/ollama-ai-answers-searxng)
|
[](https://git.tysstech.com/TySS-Dev/ollama-ai-answers-searxng)
|
||||||
[](https://github.com/TySP-Dev/ollama-ai-answers-searxng)
|
[](https://github.com/TySP-Dev/ollama-ai-answers-searxng)
|
||||||
|
|
||||||
<div align="left">
|
</div>
|
||||||
|
|
||||||
# Ollama AI Answers Plugin for SearXNG
|
# Ollama AI Answers Plugin for SearXNG
|
||||||
**Based on [ai-answers-searxng](https://github.com/cra88y/ai-answers-searxng) by [cra88y](https://github.com/cra88y)**
|
**Based on [ai-answers-searxng](https://github.com/cra88y/ai-answers-searxng) by [cra88y](https://github.com/cra88y)**
|
||||||
|
|||||||
+21
-12
@@ -386,17 +386,6 @@ def dev_search():
|
|||||||
|
|
||||||
scores.sort(key=lambda s: s['score'], reverse=True)
|
scores.sort(key=lambda s: s['score'], reverse=True)
|
||||||
|
|
||||||
# Refresh latest intent from Valkey
|
|
||||||
try:
|
|
||||||
from ollama_answers import _get_valkey
|
|
||||||
vk = _get_valkey()
|
|
||||||
latest_intent = vk.get("ai:last_intent")
|
|
||||||
|
|
||||||
if latest_intent:
|
|
||||||
detected_intent = latest_intent
|
|
||||||
except Exception:
|
|
||||||
pass
|
|
||||||
|
|
||||||
_last_render['html'] = html_payload
|
_last_render['html'] = html_payload
|
||||||
_last_render['query'] = query
|
_last_render['query'] = query
|
||||||
_last_render['intent'] = detected_intent
|
_last_render['intent'] = detected_intent
|
||||||
@@ -527,6 +516,20 @@ def dev_stream_watch():
|
|||||||
'X-Accel-Buffering': 'no'
|
'X-Accel-Buffering': 'no'
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@app.route('/dev/job-intent/<job_id>')
|
||||||
|
def dev_job_intent(job_id):
|
||||||
|
try:
|
||||||
|
import valkey as _vk
|
||||||
|
host = os.getenv('VALKEY_HOST', 'localhost')
|
||||||
|
port = int(os.getenv('VALKEY_PORT', 6379))
|
||||||
|
v = _vk.Valkey(host=host, port=port,
|
||||||
|
socket_connect_timeout=2,
|
||||||
|
decode_responses=True)
|
||||||
|
intent = v.get(f"ai:job:{job_id}:intent")
|
||||||
|
return jsonify({'intent': intent or '—', 'job_id': job_id})
|
||||||
|
except Exception as e:
|
||||||
|
return jsonify({'intent': '—', 'error': str(e)})
|
||||||
|
|
||||||
# ── dev config update ─────────────────────────────────────────────────────────
|
# ── dev config update ─────────────────────────────────────────────────────────
|
||||||
@app.route('/dev/config', methods=['POST'])
|
@app.route('/dev/config', methods=['POST'])
|
||||||
def dev_config():
|
def dev_config():
|
||||||
@@ -1055,7 +1058,6 @@ async function doSearch() {
|
|||||||
fetch('/dev/last-scores?t=' + Date.now())
|
fetch('/dev/last-scores?t=' + Date.now())
|
||||||
.then(r => r.json())
|
.then(r => r.json())
|
||||||
.then(meta => {
|
.then(meta => {
|
||||||
console.log('LAST SCORES:', meta);
|
|
||||||
|
|
||||||
const intentEl = document.getElementById('intent');
|
const intentEl = document.getElementById('intent');
|
||||||
if (intentEl) {
|
if (intentEl) {
|
||||||
@@ -1329,6 +1331,13 @@ async function attachStreamViewer() {
|
|||||||
document.getElementById('stream-status').textContent = '✓ Done';
|
document.getElementById('stream-status').textContent = '✓ Done';
|
||||||
document.getElementById('stream-status').style.color = 'var(--green)';
|
document.getElementById('stream-status').style.color = 'var(--green)';
|
||||||
document.getElementById('sv-total-time').textContent = `Total: ${total}ms`;
|
document.getElementById('sv-total-time').textContent = `Total: ${total}ms`;
|
||||||
|
fetch(`/dev/job-intent/${jobId}`)
|
||||||
|
.then(r => r.json())
|
||||||
|
.then(d => {
|
||||||
|
const svIntent = document.getElementById('sv-intent');
|
||||||
|
if (svIntent) svIntent.textContent = d.intent || '—';
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (e.data.startsWith('__ERROR__')) {
|
if (e.data.startsWith('__ERROR__')) {
|
||||||
|
|||||||
@@ -2,3 +2,4 @@ flask
|
|||||||
flask-babel
|
flask-babel
|
||||||
certifi
|
certifi
|
||||||
python-dotenv
|
python-dotenv
|
||||||
|
valkey
|
||||||
Reference in New Issue
Block a user