fix: 思考内容正确显示 - 判断thinking字段存在而非值
This commit is contained in:
@@ -1165,9 +1165,10 @@ function renderMessages() {
|
|||||||
|
|
||||||
// 思考内容块(仅AI消息)
|
// 思考内容块(仅AI消息)
|
||||||
let thinkingHtml = '';
|
let thinkingHtml = '';
|
||||||
if (!isUser && msg.thinking) {
|
if (!isUser && 'thinking' in msg) {
|
||||||
// 判断是否是当前正在生成的消息(有thinking且content为空或很短)
|
// 判断是否是当前正在生成的消息(有thinking字段且正在加载)
|
||||||
const isGenerating = index === currentConversation.messages.length - 1 && isLoading && enableThinking;
|
const isGenerating = index === currentConversation.messages.length - 1 && isLoading && enableThinking;
|
||||||
|
// 思考进行中且没有正式内容时展开
|
||||||
const expandedClass = isGenerating && !msg.content ? 'expanded' : '';
|
const expandedClass = isGenerating && !msg.content ? 'expanded' : '';
|
||||||
|
|
||||||
thinkingHtml = `
|
thinkingHtml = `
|
||||||
@@ -1177,7 +1178,7 @@ function renderMessages() {
|
|||||||
<span>思考过程</span>
|
<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>
|
<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>
|
||||||
<div class="thinking-content">${renderMarkdown(msg.thinking)}</div>
|
<div class="thinking-content">${renderMarkdown(msg.thinking || '思考中...')}</div>
|
||||||
</div>`;
|
</div>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.2">
|
<link rel="stylesheet" href="style.css?v=2.7.3">
|
||||||
<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.2"></script>
|
<script src="marked.min.js?v=2.7.3"></script>
|
||||||
<script src="app.js?v=2.7.2"></script>
|
<script src="app.js?v=2.7.3"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
Reference in New Issue
Block a user