Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| fb09560259 | |||
| 83bdab3205 |
@@ -1010,7 +1010,7 @@ async function generateConversationTitle() {
|
||||
`${m.role === 'user' ? '用户' : 'AI'}: ${m.content.slice(0, 200)}`
|
||||
).join('\n');
|
||||
|
||||
const titlePrompt = `请用不超过10个字总结以下对话的主题,只输出标题,不要其他内容:
|
||||
const titlePrompt = `请用不超过20个字总结以下对话的主题,只输出标题,不要其他内容:
|
||||
${conversationText}`;
|
||||
|
||||
try {
|
||||
@@ -1023,7 +1023,8 @@ ${conversationText}`;
|
||||
body: JSON.stringify({
|
||||
model: CONFIG.model,
|
||||
messages: [{ role: 'user', content: titlePrompt }],
|
||||
max_tokens: 50
|
||||
max_tokens: 100,
|
||||
thinking: { type: 'disabled' } // 禁用思考模式,直接输出标题
|
||||
})
|
||||
});
|
||||
|
||||
@@ -1038,7 +1039,7 @@ ${conversationText}`;
|
||||
if (newTitle && newTitle.length > 0) {
|
||||
// 去掉可能的引号和多余符号
|
||||
const cleanTitle = newTitle.replace(/^["'"']+|["'"']+$/g, '').trim();
|
||||
if (cleanTitle.length > 0 && cleanTitle.length <= 20) {
|
||||
if (cleanTitle.length > 0 && cleanTitle.length <= 30) {
|
||||
currentConversation.title = cleanTitle;
|
||||
currentConversation.updatedAt = Date.now();
|
||||
saveConversations();
|
||||
|
||||
@@ -8,12 +8,12 @@
|
||||
<meta http-equiv="Pragma" content="no-cache">
|
||||
<meta http-equiv="Expires" content="0">
|
||||
<title>AI助手</title>
|
||||
<link rel="stylesheet" href="style.css?v=2.7.5">
|
||||
<link rel="stylesheet" href="style.css?v=2.7.7">
|
||||
<link rel="manifest" href="manifest.json">
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
<script src="marked.min.js?v=2.7.5"></script>
|
||||
<script src="app.js?v=2.7.5"></script>
|
||||
<script src="marked.min.js?v=2.7.7"></script>
|
||||
<script src="app.js?v=2.7.7"></script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user