From ed83c9a0b8303517856ee8d0cdf8a688d2e24075 Mon Sep 17 00:00:00 2001 From: Pabloader Date: Wed, 8 Apr 2026 09:22:19 +0000 Subject: [PATCH] Continue prompt in the settings --- .../storywriter/components/chat-sidebar.tsx | 5 ++-- .../storywriter/components/settings-modal.tsx | 10 ++++++- .../components/settings/continue-prompt.tsx | 28 +++++++++++++++++++ src/games/storywriter/contexts/state.tsx | 8 ++++++ 4 files changed, 47 insertions(+), 4 deletions(-) create mode 100644 src/games/storywriter/components/settings/continue-prompt.tsx diff --git a/src/games/storywriter/components/chat-sidebar.tsx b/src/games/storywriter/components/chat-sidebar.tsx index 6b044d0..2fc848c 100644 --- a/src/games/storywriter/components/chat-sidebar.tsx +++ b/src/games/storywriter/components/chat-sidebar.tsx @@ -13,7 +13,6 @@ import { Tools } from "../utils/tools"; import { useChapterSummarization } from "../utils/useChapterSummarization"; import { Sidebar } from "./sidebar"; -const CONTINUE_PROMPT = "Continue the story naturally.\nUse `edit_text` tool in append mode to add new text to the story.\nWait for the approval after adding.\nNote: added text could be cropped due to limit, do not make any attempts to add it back."; interface RoleHeaderProps { message: ChatMessage; @@ -44,7 +43,7 @@ const RoleHeader = ({ message, chatMessages }: RoleHeaderProps) => { export const ChatPanel = () => { const appState = useAppState(); - const { currentWorld, currentStory, dispatch, connection, model, enableThinking, chatOpen } = appState; + const { currentWorld, currentStory, dispatch, connection, model, enableThinking, chatOpen, continuePrompt } = appState; const { summarizeAll, isSummarizing } = useChapterSummarization(); const [input, setInput] = useInputState(''); const [isLoading, setIsLoading] = useState(false); @@ -325,7 +324,7 @@ export const ChatPanel = () => { await sendMessage([{ id: crypto.randomUUID(), role: 'user' as const, - content: (CONTINUE_PROMPT + '\n\n' + input).trim(), + content: (continuePrompt + '\n\n' + input).trim(), }]); } finally { setIsLoading(false); diff --git a/src/games/storywriter/components/settings-modal.tsx b/src/games/storywriter/components/settings-modal.tsx index fa30884..720edf3 100644 --- a/src/games/storywriter/components/settings-modal.tsx +++ b/src/games/storywriter/components/settings-modal.tsx @@ -4,6 +4,7 @@ import { useState } from "preact/hooks"; import styles from "../assets/settings-modal.module.css"; import { BannedTokensSettings } from "./settings/banned-tokens"; import { ChatSystemInstructionSettings } from "./settings/chat-system-instruction"; +import { ContinuePromptSettings } from "./settings/continue-prompt"; import { ConnectionSettings } from "./settings/connection"; import { SystemInstructionSettings } from "./settings/system-instruction"; import { UserSettings } from "./settings/user"; @@ -12,7 +13,7 @@ interface Props { onClose: () => void; } -type Tab = "banned-tokens" | "system-instruction" | "chat-system-instruction" | "connection" | "user"; +type Tab = "banned-tokens" | "system-instruction" | "chat-system-instruction" | "continue-prompt" | "connection" | "user"; export const SettingsModal = ({ onClose }: Props) => { const [activeTab, setActiveTab] = useState("connection"); @@ -46,6 +47,12 @@ export const SettingsModal = ({ onClose }: Props) => { > System Instruction +