feat: 对话总结标题改为不超过20字
This commit is contained in:
@@ -1010,7 +1010,7 @@ async function generateConversationTitle() {
|
|||||||
`${m.role === 'user' ? '用户' : 'AI'}: ${m.content.slice(0, 200)}`
|
`${m.role === 'user' ? '用户' : 'AI'}: ${m.content.slice(0, 200)}`
|
||||||
).join('\n');
|
).join('\n');
|
||||||
|
|
||||||
const titlePrompt = `请用不超过10个字总结以下对话的主题,只输出标题,不要其他内容:
|
const titlePrompt = `请用不超过20个字总结以下对话的主题,只输出标题,不要其他内容:
|
||||||
${conversationText}`;
|
${conversationText}`;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@@ -1039,7 +1039,7 @@ ${conversationText}`;
|
|||||||
if (newTitle && newTitle.length > 0) {
|
if (newTitle && newTitle.length > 0) {
|
||||||
// 去掉可能的引号和多余符号
|
// 去掉可能的引号和多余符号
|
||||||
const cleanTitle = newTitle.replace(/^["'"']+|["'"']+$/g, '').trim();
|
const cleanTitle = newTitle.replace(/^["'"']+|["'"']+$/g, '').trim();
|
||||||
if (cleanTitle.length > 0 && cleanTitle.length <= 20) {
|
if (cleanTitle.length > 0 && cleanTitle.length <= 30) {
|
||||||
currentConversation.title = cleanTitle;
|
currentConversation.title = cleanTitle;
|
||||||
currentConversation.updatedAt = Date.now();
|
currentConversation.updatedAt = Date.now();
|
||||||
saveConversations();
|
saveConversations();
|
||||||
|
|||||||
@@ -8,12 +8,12 @@
|
|||||||
<meta http-equiv="Pragma" content="no-cache">
|
<meta http-equiv="Pragma" content="no-cache">
|
||||||
<meta http-equiv="Expires" content="0">
|
<meta http-equiv="Expires" content="0">
|
||||||
<title>AI助手</title>
|
<title>AI助手</title>
|
||||||
<link rel="stylesheet" href="style.css?v=2.7.6">
|
<link rel="stylesheet" href="style.css?v=2.7.7">
|
||||||
<link rel="manifest" href="manifest.json">
|
<link rel="manifest" href="manifest.json">
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script src="marked.min.js?v=2.7.6"></script>
|
<script src="marked.min.js?v=2.7.7"></script>
|
||||||
<script src="app.js?v=2.7.6"></script>
|
<script src="app.js?v=2.7.7"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user