improve replies, formatting and system prompt handling

This commit is contained in:
2026-04-29 19:13:28 +03:00
parent 27ca75ed7c
commit d41a4ed3ea
8 changed files with 258 additions and 17 deletions
+14
View File
@@ -2,6 +2,7 @@ import * as fs from "fs";
import {Environment} from "../common/environment";
import {logError} from "../util/utils";
import {Answers} from "../model/answers";
import path from "node:path";
type DataJsonFile = {
admins: number[]
@@ -27,6 +28,19 @@ export async function readData(): Promise<void> {
}
}
export async function readPrompts(): Promise<void> {
try {
const prompt = fs.readFileSync(path.join(Environment.DATA_PATH, "system_prompt.txt")).toString().trim();
if (prompt.length) {
Environment.setSystemPrompt(prompt);
}
} catch (e) {
logError(e);
}
return Promise.resolve();
}
export async function saveData(): Promise<void> {
const adminIds: number[] = [];
Environment.ADMIN_IDS.forEach(id => adminIds.push(id));