Fix writer max_tokens (500→1000) for titles/tags, fix preview scrollbar height

This commit is contained in:
Yuzhiran Dev
2026-05-19 07:44:56 +08:00
parent 0897074d40
commit 3dce54b359
2 changed files with 5 additions and 5 deletions
+3 -3
View File
@@ -159,9 +159,9 @@
<el-button v-if="editing" size="small" type="primary" @click="saveContent" :loading="savingContent">保存</el-button>
</div>
</div>
<div style="max-width: 1000px; margin: 0 auto; width: 100%; display: flex; flex-direction: column;">
<div v-if="!editing" class="preview-body" style="flex:1; min-height:500px; max-height:calc(100vh - 310px); border:1px solid #ebeef5; border-radius:8px; background:#fff; padding:20px; overflow-y:auto; width:100%; line-height:1.8;" v-html="currentPreviewBody"></div>
<div v-else ref="editor" contenteditable="true" style="flex:1; min-height:500px; max-height:calc(100vh - 310px); border:1px solid #409eff; border-radius:8px; background:#fff; padding:20px; overflow-y:auto; width:100%; line-height:1.8; outline:none; box-shadow:0 0 0 2px rgba(64,158,255,0.2);" @input="editContent = $event.target.innerHTML"></div>
<div style="width:100%;">
<div v-if="!editing" class="preview-body" style="min-height:300px; height:68vh; border:1px solid #ebeef5; border-radius:8px; background:#fff; padding:20px; overflow-y:auto; width:100%; line-height:1.8;" v-html="currentPreviewBody"></div>
<div v-else ref="editor" contenteditable="true" style="min-height:300px; height:68vh; border:1px solid #409eff; border-radius:8px; background:#fff; padding:20px; overflow-y:auto; width:100%; line-height:1.8; outline:none; box-shadow:0 0 0 2px rgba(64,158,255,0.2);" @input="editContent = $event.target.innerHTML"></div>
</div>
</div>
<template #footer>
+2 -2
View File
@@ -246,7 +246,7 @@ class Writer:
if HAVE_LLM:
prompt = tag_prompts.get(platform, f"根据文章信息生成适合{platform}的标签。标题:{title} 领域:{field} 核心观点:{core} 直接输出标签,空格分隔。")
try:
tags_text = call_llm(prompt, temperature=0.2, max_tokens=500)
tags_text = call_llm(prompt, temperature=0.2, max_tokens=1000)
if tags_text:
tags = [t.strip('#') for t in tags_text.strip().split() if t.strip('#')]
if tags:
@@ -342,7 +342,7 @@ class Writer:
prompt = title_templates.get(platform, f"给以下文章改个吸引人的{platform}标题:{original}")
try:
resp = call_llm(prompt, temperature=0.7, max_tokens=500)
resp = call_llm(prompt, temperature=0.7, max_tokens=1000)
titles = []
for line in resp.strip().split('\n'):
line = line.strip()