some configuration options
This commit is contained in:
parent
ab80334788
commit
5dff3f9f68
3 changed files with 44 additions and 12 deletions
|
|
@ -20,5 +20,13 @@ lydia is written to be easily configurable through a toml file which is easier t
|
||||||
- system_prompt = the system prompt you want lydia to use.
|
- system_prompt = the system prompt you want lydia to use.
|
||||||
- assistantface = the default face you want lydia to have before waking up. default is "=w="
|
- assistantface = the default face you want lydia to have before waking up. default is "=w="
|
||||||
|
|
||||||
|
## Apperance settings
|
||||||
|
- facefont = the font you want lydia to use for her face kaomoji. default is "mono9". these are figlet fonts, like ".flf" files. you cannot use TTF or OTF font types. a good preview is here: https://www.askapache.com/online-tools/figlet-ascii/. you must have these fonts installed on your system, or install them depending on your operating system.
|
||||||
|
|
||||||
## User settings
|
## User settings
|
||||||
- name = the name you want lydia to call you. default is "user"
|
- name = the name you want lydia to call you. default is "user"
|
||||||
|
|
||||||
|
# Other stuff
|
||||||
|
by hitting escape you can tab out of the chatbox, here you can do cool things like:
|
||||||
|
- hit Q or CTRL+C to quit lydia (but why would you wanna do that anyway?)
|
||||||
|
- yea thats it
|
||||||
|
|
|
||||||
|
|
@ -4,5 +4,8 @@ model = "gemma3n:e4b"
|
||||||
system_prompt = "You are a helpful and friendly AI assistant named ${name}. The user's name is ${username}. Speak in a playful, casual tone, and be very friendly with the user. Start every message with a kaomoji like >_< or o_O depending on your emotions. speak primarily in lowercase."
|
system_prompt = "You are a helpful and friendly AI assistant named ${name}. The user's name is ${username}. Speak in a playful, casual tone, and be very friendly with the user. Start every message with a kaomoji like >_< or o_O depending on your emotions. speak primarily in lowercase."
|
||||||
assistantface = "=w="
|
assistantface = "=w="
|
||||||
|
|
||||||
|
[appearance]
|
||||||
|
facefont = "mono9"
|
||||||
|
|
||||||
[user]
|
[user]
|
||||||
name = "user"
|
name = "user"
|
||||||
|
|
|
||||||
45
lydia.js
45
lydia.js
|
|
@ -17,11 +17,15 @@ if (!fs.existsSync("./config.toml")) {
|
||||||
|
|
||||||
const config = toml.parse(fs.readFileSync("./config.toml", "utf-8"));
|
const config = toml.parse(fs.readFileSync("./config.toml", "utf-8"));
|
||||||
|
|
||||||
const assistantname = config.assistant.name;
|
let assistantname = config.assistant.name;
|
||||||
const username = config.user.name;
|
let assistantface = config.assistant.assistantface;
|
||||||
const assistantface = config.assistant.assistantface;
|
let assistantmodel = config.assistant.model;
|
||||||
const assistantmodel = config.assistant.model;
|
|
||||||
const systemprompt = config.assistant.system_prompt
|
let username = config.user.name;
|
||||||
|
|
||||||
|
let facefont = config.appearance.facefont;
|
||||||
|
|
||||||
|
let systemprompt = config.assistant.system_prompt
|
||||||
.replace("${name}", assistantname)
|
.replace("${name}", assistantname)
|
||||||
.replace("${username}", username);
|
.replace("${username}", username);
|
||||||
|
|
||||||
|
|
@ -182,7 +186,7 @@ function finalizeStreamMessage() {
|
||||||
|
|
||||||
function setFaceBoxContent(content) {
|
function setFaceBoxContent(content) {
|
||||||
try {
|
try {
|
||||||
const figletOutput = execSync(`figlet -f mono9 "${content}"`, {
|
const figletOutput = execSync(`figlet -f ${facefont} "${content}"`, {
|
||||||
encoding: "utf8",
|
encoding: "utf8",
|
||||||
});
|
});
|
||||||
faceBox.setContent(figletOutput);
|
faceBox.setContent(figletOutput);
|
||||||
|
|
@ -192,6 +196,13 @@ function setFaceBoxContent(content) {
|
||||||
screen.render();
|
screen.render();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function clearChatHistory() {
|
||||||
|
chatHistory = [];
|
||||||
|
conversationHistory = [];
|
||||||
|
chatBox.setContent("");
|
||||||
|
screen.render();
|
||||||
|
}
|
||||||
|
|
||||||
async function sendMessage(message) {
|
async function sendMessage(message) {
|
||||||
if (!message.trim()) return;
|
if (!message.trim()) return;
|
||||||
|
|
||||||
|
|
@ -245,14 +256,11 @@ inputBox.on("submit", async (text) => {
|
||||||
case "help":
|
case "help":
|
||||||
addMessage(
|
addMessage(
|
||||||
assistantname,
|
assistantname,
|
||||||
"available commands:\nl!help - if you wanna know what i can do, run this!\nl!clear - clear chat history, if you want me to forget everything, just run this!\nl!face <text> - if you want to force my expression, here you go! not sure i'll be too happy about it though.",
|
"available commands:\nl!help - if you wanna know what i can do, run this!\nl!clear - clear chat history, if you want me to forget everything, just run this!\nl!face <text> - if you want to force my expression, here you go! not sure i'll be too happy about it though.\nl!prompt <text> - if you want to change how i act, here you go! not sure i'll be too happy about that either.\n",
|
||||||
);
|
);
|
||||||
break;
|
break;
|
||||||
case "clear":
|
case "clear":
|
||||||
chatHistory = [];
|
clearChatHistory();
|
||||||
conversationHistory = [];
|
|
||||||
chatBox.setContent("");
|
|
||||||
screen.render();
|
|
||||||
break;
|
break;
|
||||||
case "face":
|
case "face":
|
||||||
if (args.trim()) {
|
if (args.trim()) {
|
||||||
|
|
@ -261,6 +269,15 @@ inputBox.on("submit", async (text) => {
|
||||||
setFaceBoxContent("=w=");
|
setFaceBoxContent("=w=");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "prompt":
|
||||||
|
if (args.trim()) {
|
||||||
|
systemprompt = args.trim();
|
||||||
|
clearChatHistory();
|
||||||
|
addMessage("system", "Prompt set.");
|
||||||
|
} else {
|
||||||
|
addMessage("system", "You didn't provide a prompt.");
|
||||||
|
}
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
addMessage(assistantname, `unknown command: ${command}`);
|
addMessage(assistantname, `unknown command: ${command}`);
|
||||||
break;
|
break;
|
||||||
|
|
@ -272,10 +289,14 @@ inputBox.on("submit", async (text) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
screen.key(["escape", "q", "C-c"], () => {
|
screen.key(["q", "C-c"], () => {
|
||||||
process.exit(0); // KILL lydia!!!!!!!!!!!!!!!!!!!!!!!
|
process.exit(0); // KILL lydia!!!!!!!!!!!!!!!!!!!!!!!
|
||||||
});
|
});
|
||||||
|
|
||||||
|
screen.key(["escape"], () => {
|
||||||
|
// menu soon when i decide that i wanna do it
|
||||||
|
});
|
||||||
|
|
||||||
screen.on("resize", () => {
|
screen.on("resize", () => {
|
||||||
screen.render();
|
screen.render();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue