mirror of
https://github.com/searxng/searxng
synced 2024-01-01 19:24:07 +01:00
Update search.html
This commit is contained in:
parent
b448a5963e
commit
fddd8acef5
1 changed files with 30 additions and 0 deletions
|
@ -11,6 +11,12 @@
|
||||||
<button id="send_search" type="submit" aria-label="{{ _('search') }}"><span class="hide_if_nojs">{{ icon_big('search-outline') }}</span><span class="show_if_nojs">{{ _('search') }}</span></button>
|
<button id="send_search" type="submit" aria-label="{{ _('search') }}"><span class="hide_if_nojs">{{ icon_big('search-outline') }}</span><span class="show_if_nojs">{{ _('search') }}</span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="chat-form">
|
||||||
|
<form id="chat-form">
|
||||||
|
<input type="text" id="chat-input" placeholder="Ask me a question...">
|
||||||
|
<button type="submit" id="chat-submit">Submit</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
{% set display_tooltip = true %}
|
{% set display_tooltip = true %}
|
||||||
{% include 'simple/categories.html' %}
|
{% include 'simple/categories.html' %}
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,3 +28,27 @@
|
||||||
<input type="hidden" name="theme" value="{{ theme }}" >
|
<input type="hidden" name="theme" value="{{ theme }}" >
|
||||||
{% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
|
{% if timeout_limit %}<input type="hidden" name="timeout_limit" value="{{ timeout_limit|e }}" >{% endif %}
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
document.getElementById("chat-form").addEventListener("submit", function(event) {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
// Get the value of the chat input field
|
||||||
|
let chatInput = document.getElementById("chat-input").value;
|
||||||
|
|
||||||
|
// Make a POST request to the back-end with the chat input as the data
|
||||||
|
fetch("/chat", {
|
||||||
|
method: "POST",
|
||||||
|
body: JSON.stringify({ chatInput }),
|
||||||
|
headers: {
|
||||||
|
"Content-Type": "application/json"
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
// Display the response from the back-end in the page
|
||||||
|
let chatResponse = document.getElementById("chat-response");
|
||||||
|
chatResponse.innerHTML = data.response;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
Loading…
Add table
Reference in a new issue