Compare commits

...

4 Commits

Author SHA1 Message Date
Alexej Wolff 96432d22f5 chore: remove deploy.ps1 from repo, add to gitignore 2026-05-07 00:39:01 +02:00
Alexej Wolff a4cbc2db86 fix: textarea resize vertical only, deploy script npm install 2026-05-07 00:37:54 +02:00
Alexej Wolff 49f2b9261d feat: auto-save story characters as global NPCs on save 2026-05-07 00:32:51 +02:00
Alexej Wolff 56e78053cf fix: restore messages variable in deepseek endpoints 2026-05-07 00:25:44 +02:00
4 changed files with 38 additions and 3 deletions
+3
View File
@@ -43,3 +43,6 @@ Thumbs.db
# Testing
coverage
.nyc_output
# Deploy scripts
deploy.ps1
+2 -2
View File
@@ -1207,7 +1207,7 @@ app.post("/api/deepseek/chat", requireAuth, async (req, res) => {
return res.status(500).json({ error: "DeepSeek API key not configured" });
}
const { temperature = 0.8, max_tokens = 1000 } = req.body;
const { messages, temperature = 0.8, max_tokens = 1000 } = req.body;
const sanitizedMessages = sanitizeDeepSeekMessages(messages);
const clampedMaxTokens = Math.min(
max_tokens,
@@ -1268,7 +1268,7 @@ app.post("/api/deepseek/chat/stream", requireAuth, async (req, res) => {
return res.status(500).json({ error: "DeepSeek API key not configured" });
}
const { temperature = 0.8, max_tokens = 1000 } = req.body;
const { messages, temperature = 0.8, max_tokens = 1000 } = req.body;
const sanitizedMessages = sanitizeDeepSeekMessages(messages);
const clampedMaxTokens = Math.min(
max_tokens,
+4
View File
@@ -703,6 +703,10 @@
font-size: 0.95rem;
}
.character-fields textarea {
resize: vertical;
}
.character-fields input:focus,
.character-fields select:focus,
.character-fields textarea:focus {
+29 -1
View File
@@ -7,6 +7,7 @@ import {
getStory,
updateStory,
getNPCCharacters,
createNPCCharacter,
} from "../services/api";
import { generateAvatarUrl } from "../services/imageGen";
import { useStoryGeneration } from "../hooks/useStoryGeneration";
@@ -424,6 +425,8 @@ export default function CreateStoryPage() {
allSettings.push(form.customSetting.trim());
}
const storyCharacters = form.characters.filter((c) => c.name.trim());
const storyData = {
title: form.title,
description: form.description || `Исекай история: ${form.title}`,
@@ -436,7 +439,7 @@ export default function CreateStoryPage() {
summary: form.summary,
plot: form.plot,
firstMessage: form.firstMessage,
characters: form.characters.filter((c) => c.name.trim()),
characters: storyCharacters,
isNsfw: form.isNsfw,
temperature: form.temperature,
narrativeRules: form.narrativeRules.trim() || undefined,
@@ -447,14 +450,39 @@ export default function CreateStoryPage() {
},
};
// Helper function to save characters as global NPCs
const saveCharactersAsGlobalNPCs = async () => {
const existingNames = savedNPCs.map((npc) => npc.name.toLowerCase());
for (const char of storyCharacters) {
// Skip if NPC with this name already exists
if (existingNames.includes(char.name.toLowerCase())) {
continue;
}
// Create global NPC from story character
await createNPCCharacter({
name: char.name,
description: char.description,
role: char.role,
age: char.age || "adult",
gender: char.gender || "female",
isNsfw: form.isNsfw,
avatarUrl: char.avatarUrl,
});
}
};
if (isEditMode && id) {
const success = await updateStory(id, storyData);
if (success) {
await saveCharactersAsGlobalNPCs();
navigate(`/story/${id}`);
}
} else {
const story = await createStory(storyData);
if (story) {
await saveCharactersAsGlobalNPCs();
navigate(`/story/${story.id}`);
}
}