fix(chat): behebe DB-Schema Migration für is_read und füge persona-spezifische Chat-Antworten hinzu
This commit is contained in:
1 parent
1b76475261
commit
88e2dcc24b
2 files changed
+84
-1
No files matched your search
@@ -397,10 +397,94 @@ const MOCK_LINES = {
|
||||
],
|
||||
};
|
||||
|
||||
const PERSONA_DM_MOCKS = {
|
||||
luna: [
|
||||
'draußen ist es grau und meine playlist läuft auf repeat... was treibst du? 🖤',
|
||||
'schwarz ist die einzig ehrliche Farbe, ganz ehrlich 🖤',
|
||||
'wunder geschehen, jemand schreibt mir... was gibt\'s?',
|
||||
'irgendwie melancholisch heute. Aber schön, dass du da bist 🖤',
|
||||
'ich lese gerade düstere Poesie. Wollte dir nur kurz antworten.',
|
||||
'sarkasmus ist mein Schutzmechanismus, nicht persönlich nehmen 🖤',
|
||||
'du störst mich nicht, ich hab ohnehin nur ins Leere gestarrt.',
|
||||
],
|
||||
helmut: [
|
||||
'HALLO JUNG ER FREUND! WIE GEHT ES DIR HEUTE? GRUSS HELMUT 😊👍',
|
||||
'ICH HABE AUS VERSEHEN AUF DIESES NACHRICHTENFELD GEDRÜCKT. ALLES GUT BEI DIR? 😊',
|
||||
'MEIN ENKEL SAGT MAN MUSS HIER AKTIV SEIN. GRÜSSE AUS DEM GARTEN! 🍅👍',
|
||||
'INTERESSANTE NACHRICHT. FRÜHER BEI SIEMENS HABEN WIR DAS ANDERS GEMACHT. GRUSS',
|
||||
'DANKE FÜR DIE RÜCKMELDUNG. ICH HOFFE DEINE WOCHE LÄUFT GUT 😊👍',
|
||||
],
|
||||
jonas: [
|
||||
'Yo bro! Warst du heute schon im Gym oder rest day? 💪🔥',
|
||||
'Disziplin schlägt Motivation, immer dranbleiben bro! Was steht heute an? 💪',
|
||||
'Gerade meinen Post-Workout-Shake getrunken. Wie läuft dein Tag? 🏋️',
|
||||
'Haha safe bro, Hauptsache die Proteine stimmen! 💪',
|
||||
'Guter Punkt bro, Fokus behalten und durchziehen!',
|
||||
],
|
||||
mia: [
|
||||
'Hey! Sitze gerade im Atelier und skizziere ein bisschen... wie geht\'s dir? ✨',
|
||||
'Das Licht heute ist so magisch! Musste dir einfach kurz schreiben ✨',
|
||||
'Danke für deine Nachricht! Wie läuft dein kreativer Tag so? 🎨',
|
||||
'Oh wie schön! Das inspiriert mich direkt für ein neues Bild ✨',
|
||||
],
|
||||
sara: [
|
||||
'Hey! Hab gerade frische Zimtschnecken gebacken... willst du eine? 🥐😋',
|
||||
'Oh hey! War heute in einem neuen Café in Neukölln, so lecker! Was machst du so?',
|
||||
'Klingt super! Essen tröstet über alles hinweg haha ☕🧁',
|
||||
],
|
||||
tim: [
|
||||
'bro bin noch mitten in der Runde, aber hey! 🎮😭',
|
||||
'mein Schlafrhythmus ist wieder komplett lost haha, was geht bei dir?',
|
||||
'classic move bro haha 😭',
|
||||
],
|
||||
aylin: [
|
||||
'Hey! Gerade den Bug nach 3 Stunden gefixt, brauche jetzt erstmal Kaffee ☕😅 Wie läuft\'s?',
|
||||
'Debugging am Wochenende macht Spaß... nicht 😅 Alles klar bei dir?',
|
||||
'Code compiliert, Kaffee ist heiß – Tag gerettet 🐛☕',
|
||||
],
|
||||
ben: [
|
||||
'Hey brother/sister! Sending you high vibrations today 🙏✨ How is your energy?',
|
||||
'Stay aligned and protect your peace today 🙏✨',
|
||||
],
|
||||
valentina: [
|
||||
'Hey! Just finished my morning surf, ocean vibes are so calming 🌊🌴 How are you?',
|
||||
'Sending you some sunshine vibes! Hope you have a wonderful day ✨',
|
||||
],
|
||||
};
|
||||
|
||||
const GENERIC_DM_MOCKS = {
|
||||
de: [
|
||||
'Hey, schön von dir zu hören! Wie geht\'s dir heute?',
|
||||
'Danke für deine Nachricht! Was treibst du gerade Schönes?',
|
||||
'Interessanter Gedanke... erzähl mir gern mehr davon!',
|
||||
'Klingt gut, freut mich von dir zu lesen! 😊',
|
||||
],
|
||||
en: [
|
||||
'Hey! Great hearing from you! How is your day going?',
|
||||
'Thanks for the message! What are you up to right now?',
|
||||
'Interesting thought... tell me more about that!',
|
||||
'Sounds awesome, good to chat with you! 😊',
|
||||
],
|
||||
};
|
||||
|
||||
export function mockText(messages, opts = {}) {
|
||||
const sys = messages.find((m) => m.role === 'system')?.content || '';
|
||||
const user = [...messages].reverse().find((m) => m.role === 'user')?.content || '';
|
||||
const isEn = /reply in natural English/i.test(sys);
|
||||
const isDm = /DMs|Direktnachricht|private Nachricht/i.test(sys) || opts.isDm;
|
||||
|
||||
if (isDm) {
|
||||
const nameMatch = sys.match(/Du bist (.+?) \(@?([a-zA-Z0-9._-]+)\)/i);
|
||||
const charKey = (nameMatch?.[2] || nameMatch?.[1] || '').toLowerCase();
|
||||
for (const [key, lines] of Object.entries(PERSONA_DM_MOCKS)) {
|
||||
if (charKey.includes(key)) {
|
||||
return lines[Math.floor(Math.random() * lines.length)];
|
||||
}
|
||||
}
|
||||
const dmPool = isEn ? GENERIC_DM_MOCKS.en : GENERIC_DM_MOCKS.de;
|
||||
return dmPool[Math.floor(Math.random() * dmPool.length)];
|
||||
}
|
||||
|
||||
const pool = isEn ? MOCK_LINES.en : MOCK_LINES.de;
|
||||
const line = pool[Math.floor(Math.random() * pool.length)];
|
||||
if (opts.mockAsPost) {
|
||||
|
||||
@@ -78,7 +78,6 @@ CREATE TABLE IF NOT EXISTS messages (
|
||||
is_read INTEGER NOT NULL DEFAULT 0
|
||||
);
|
||||
CREATE INDEX IF NOT EXISTS idx_messages_char ON messages(char_id, created_at);
|
||||
CREATE INDEX IF NOT EXISTS idx_messages_unread ON messages(char_id, sender, is_read);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS app_state (
|
||||
key VARCHAR(100) PRIMARY KEY,
|
||||
|
||||
Reference in new issue
Block a user