forgot to save before committing
This commit is contained in:
parent
f53d9d917e
commit
746432c6ff
1 changed files with 2 additions and 6 deletions
8
lydia.js
8
lydia.js
|
|
@ -108,12 +108,10 @@ function updateStreamMessage(content) {
|
||||||
let letterIndex = -1;
|
let letterIndex = -1;
|
||||||
for (let i = 0; i < content.length - 1; i++) {
|
for (let i = 0; i < content.length - 1; i++) {
|
||||||
if (/[a-zA-Z]/.test(content[i])) {
|
if (/[a-zA-Z]/.test(content[i])) {
|
||||||
// If it's capital I, split immediately
|
|
||||||
if (content[i] === "I") {
|
if (content[i] === "I") {
|
||||||
letterIndex = i;
|
letterIndex = i;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// If next character is also a letter, split at two consecutive letters
|
|
||||||
if (/[a-zA-Z]/.test(content[i + 1])) {
|
if (/[a-zA-Z]/.test(content[i + 1])) {
|
||||||
letterIndex = i;
|
letterIndex = i;
|
||||||
break;
|
break;
|
||||||
|
|
@ -173,7 +171,6 @@ function finalizeStreamMessage() {
|
||||||
addMessage(assistantname, currentStreamMessage);
|
addMessage(assistantname, currentStreamMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add assistant message to conversation history
|
|
||||||
conversationHistory.push({
|
conversationHistory.push({
|
||||||
role: "assistant",
|
role: "assistant",
|
||||||
content: assistantMessage,
|
content: assistantMessage,
|
||||||
|
|
@ -200,7 +197,6 @@ async function sendMessage(message) {
|
||||||
|
|
||||||
addMessage(username, message);
|
addMessage(username, message);
|
||||||
|
|
||||||
// Add user message to conversation history
|
|
||||||
conversationHistory.push({
|
conversationHistory.push({
|
||||||
role: "user",
|
role: "user",
|
||||||
content: message,
|
content: message,
|
||||||
|
|
@ -239,7 +235,7 @@ inputBox.on("submit", async (text) => {
|
||||||
inputBox.clearValue();
|
inputBox.clearValue();
|
||||||
inputBox.focus();
|
inputBox.focus();
|
||||||
|
|
||||||
// Handle commands
|
// command trash
|
||||||
if (text.trim().startsWith("l!")) {
|
if (text.trim().startsWith("l!")) {
|
||||||
const commandParts = text.trim().slice(2).split(" ");
|
const commandParts = text.trim().slice(2).split(" ");
|
||||||
const command = commandParts[0];
|
const command = commandParts[0];
|
||||||
|
|
@ -270,7 +266,7 @@ inputBox.on("submit", async (text) => {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Regular message - send to ollama
|
// message just send it
|
||||||
await sendMessage(text);
|
await sendMessage(text);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue