Compare commits

...

2 Commits

2 changed files with 9 additions and 7 deletions

View File

@@ -927,7 +927,8 @@ async function streamGenerate(userMsgIndex) {
// 自动总结标题第一次对话和每隔5次对话
const totalMessages = currentConversation.messages.length;
if (totalMessages === 1 || totalMessages % 5 === 0) {
// 第一次对话(用户+AI=2条或每5次对话10条
if (totalMessages === 2 || totalMessages % 10 === 0) {
await generateConversationTitle();
}
}
@@ -1165,9 +1166,10 @@ function renderMessages() {
// 思考内容块仅AI消息
let thinkingHtml = '';
if (!isUser && msg.thinking) {
// 判断是否是当前正在生成的消息有thinking且content为空或很短
if (!isUser && 'thinking' in msg) {
// 判断是否是当前正在生成的消息有thinking字段且正在加载
const isGenerating = index === currentConversation.messages.length - 1 && isLoading && enableThinking;
// 思考进行中且没有正式内容时展开
const expandedClass = isGenerating && !msg.content ? 'expanded' : '';
thinkingHtml = `
@@ -1177,7 +1179,7 @@ function renderMessages() {
<span>思考过程</span>
<svg class="thinking-arrow" viewBox="0 0 24 24" width="14" height="14"><path fill="currentColor" d="M7 10l5 5 5-5z"/></svg>
</div>
<div class="thinking-content">${renderMarkdown(msg.thinking)}</div>
<div class="thinking-content">${renderMarkdown(msg.thinking || '思考中...')}</div>
</div>`;
}

View File

@@ -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.2">
<link rel="stylesheet" href="style.css?v=2.7.4">
<link rel="manifest" href="manifest.json">
</head>
<body>
<div id="app"></div>
<script src="marked.min.js?v=2.7.2"></script>
<script src="app.js?v=2.7.2"></script>
<script src="marked.min.js?v=2.7.4"></script>
<script src="app.js?v=2.7.4"></script>
</body>
</html>