添加会话级固定预设

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2026-06-17 12:06:13 +08:00
co-authored by Claude
parent 0b48dc0d7d
commit 2c4d4af070
5 changed files with 154 additions and 15 deletions
+6 -2
View File
@@ -771,7 +771,12 @@ async function loadConversationList() {
}
async function createConversation() {
const res = await fetch('/api/conversations', { method: 'POST' });
const preset = getPresetPrompt();
const res = await fetch('/api/conversations', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ preset_prompt: preset }),
});
if (!res.ok) {
const err = await res.json().catch(() => ({ error: '创建对话失败' }));
throw new Error(err.error || '创建对话失败');
@@ -1075,7 +1080,6 @@ async function sendMessage() {
try {
if (!currentConvId) {
ensurePresetLoaded();
const conv = await createConversation();
currentConvId = conv.id;
await loadConversationList();