feat: add chat reset feature with welcome message
Co-authored-by: aider (openai//models/Qwen/Qwen2.5-Coder-32B-Instruct-GGUF/qwen2.5-coder-32b-instruct-q4_k_m.gguf) <aider@aider.chat>
This commit is contained in:
62
chatv2.js
62
chatv2.js
@@ -613,14 +613,68 @@ window.onload = () => {
|
||||
|
||||
// Load chat history from localStorage
|
||||
if (chatHistory.length === 0) {
|
||||
// Re-add all messages from chatHistory
|
||||
chatHistory.forEach(message => {
|
||||
addMessage(message.role, message.content, message.markdown, message.messageId)
|
||||
})
|
||||
// Add welcome message (this will be the first entry in chatHistory)
|
||||
const welcomeMessage = `# Welcome to LM Studio Chat!
|
||||
|
||||
I now support **full conversation history**, **real-time streaming responses** and **dark, readable text formatting**.
|
||||
|
||||
## Features:
|
||||
1. **Full Chat History** - Complete conversation context is now sent to the AI
|
||||
2. **Smart History Management** - Automatically keeps the last ${ MAX_CHAT_HISTORY } messages
|
||||
3. **Streaming Mode** (enabled by default) - Watch responses appear word-by-word
|
||||
4. **Markdown Rendering** - Proper formatting for code, lists, tables, and more
|
||||
5. **Readable Dark Text** - No more eye strain from light gray text
|
||||
|
||||
## Try it out:
|
||||
- Ask follow-up questions that reference earlier messages
|
||||
- Have a multi-turn conversation with full context
|
||||
- Ask "what did I just ask?" to test history retention
|
||||
- Watch the streaming response in real-time!
|
||||
|
||||
> *Tip: You can toggle streaming and markdown using the checkboxes below.*`
|
||||
|
||||
addMessage('assistant', welcomeMessage, true)
|
||||
} else {
|
||||
// Re-add all messages from chatHistory
|
||||
chatHistory.forEach(message => {
|
||||
addMessage(message.role, message.content, message.markdown, message.messageId)
|
||||
})
|
||||
}
|
||||
|
||||
// Add event listener for reset button
|
||||
document.getElementById('resetBtn').addEventListener('click', resetChat)
|
||||
}
|
||||
|
||||
// Reset chat history
|
||||
function resetChat() {
|
||||
// Clear chat history
|
||||
chatHistory = []
|
||||
|
||||
// Clear chat log
|
||||
chatLog.innerHTML = ''
|
||||
|
||||
// Add welcome message
|
||||
const welcomeMessage = `# Welcome to LM Studio Chat!
|
||||
|
||||
I now support **full conversation history**, **real-time streaming responses** and **dark, readable text formatting**.
|
||||
|
||||
## Features:
|
||||
1. **Full Chat History** - Complete conversation context is now sent to the AI
|
||||
2. **Smart History Management** - Automatically keeps the last ${ MAX_CHAT_HISTORY } messages
|
||||
3. **Streaming Mode** (enabled by default) - Watch responses appear word-by-word
|
||||
4. **Markdown Rendering** - Proper formatting for code, lists, tables, and more
|
||||
5. **Readable Dark Text** - No more eye strain from light gray text
|
||||
|
||||
## Try it out:
|
||||
- Ask follow-up questions that reference earlier messages
|
||||
- Have a multi-turn conversation with full context
|
||||
- Ask "what did I just ask?" to test history retention
|
||||
- Watch the streaming response in real-time!
|
||||
|
||||
> *Tip: You can toggle streaming and markdown using the checkboxes below.*`
|
||||
|
||||
addMessage('assistant', welcomeMessage, true)
|
||||
|
||||
// Save chat history to localStorage
|
||||
localStorage.setItem('chatHistory', JSON.stringify(chatHistory))
|
||||
}
|
||||
|
||||
@@ -54,6 +54,7 @@
|
||||
<div id="modelInfo">Model: <span id="modelName">unknown</span></div>
|
||||
</div>
|
||||
<button id="sendBtn">Send</button>
|
||||
<button id="resetBtn">Reset Chat</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user