71 lines
2.2 KiB
HTML
71 lines
2.2 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>Ollama Chat</title>
|
|
<link rel="stylesheet" href="/css/clientstyle.css">
|
|
<!-- <link rel="stylesheet" href="python_test/smartassist/src/css/clientstyle.css"> -->
|
|
</head>
|
|
<body>
|
|
<h1>Ollama Chat</h1>
|
|
<div id="chatbox">
|
|
<!-- messages will be rendered here -->
|
|
</div>
|
|
<textarea id="userInput" placeholder="Type your message..." rows="5"></textarea>
|
|
<button id="sendButton" onclick="sendMessage()">Send</button>
|
|
|
|
<!-- Get the apiEndpoint -->
|
|
<script>
|
|
const apiEndpoint = window.apiEndpoint;
|
|
const useModel = window.useModel;
|
|
</script>
|
|
|
|
<!-- Marked for markdown rendering -->
|
|
<!-- <script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script> -->
|
|
<script src="https://cdn.jsdelivr.net/npm/markdown-it@14.1.0/dist/markdown-it.min.js"></script>
|
|
|
|
|
|
<!-- Include MathJax library to render mathematical notation -->
|
|
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
|
|
<script>
|
|
window.MathJax = {
|
|
loader: { load: ['input/tex', 'output/chtml'] },
|
|
tex: {
|
|
packages: ['base', 'ams'],
|
|
inlineMath: [['$', '$']]
|
|
}
|
|
};
|
|
</script>
|
|
|
|
|
|
<!-- Get the javascript handling communication with the backend -->
|
|
<script src="/js/frontend.js"></script>
|
|
|
|
<script>
|
|
const chatContainer = document.getElementById('chatbox');
|
|
|
|
// Handle resize events
|
|
window.addEventListener('resize',
|
|
function() {
|
|
chatContainer.style.height = 'auto';
|
|
});
|
|
|
|
const userInputElement = document.getElementById('userInput');
|
|
|
|
userInputElement.addEventListener('keydown', function(event) {
|
|
if (event.shiftKey && event.key === 'Enter') { // Shift+Enter for newline
|
|
event.preventDefault();
|
|
userInputElement.value += '\n';
|
|
} else if (event.key === 'Enter') { // Enter to send message
|
|
sendMessage();
|
|
userInputElement.value = ''; // Clear the input field after sending
|
|
event.preventDefault();
|
|
}
|
|
});
|
|
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|
|
|