大量的代码格式化
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 1m10s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
Some checks failed
Docker Build & Deploy / Build Docker Image (push) Failing after 1m10s
Docker Build & Deploy / Deploy to Production (push) Has been skipped
Docker Build & Deploy / Cleanup Dangling Images (push) Successful in 1s
Docker Build & Deploy / WeChat Notification (push) Successful in 1s
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
<!-- eslint-disable vue/no-v-html -->
|
||||
<template>
|
||||
<div class="page-container-flex">
|
||||
<div class="page-container-flex">
|
||||
<!-- 顶部导航栏 -->
|
||||
<van-nav-bar
|
||||
title="智能分析"
|
||||
left-arrow
|
||||
placeholder
|
||||
<van-nav-bar
|
||||
title="智能分析"
|
||||
left-arrow
|
||||
placeholder
|
||||
@click-left="onClickLeft"
|
||||
>
|
||||
<template #right>
|
||||
<van-icon
|
||||
name="setting-o"
|
||||
size="20"
|
||||
style="cursor: pointer; padding-right: 12px;"
|
||||
<van-icon
|
||||
name="setting-o"
|
||||
size="20"
|
||||
style="cursor: pointer; padding-right: 12px"
|
||||
@click="onClickPrompt"
|
||||
/>
|
||||
</template>
|
||||
@@ -31,11 +31,13 @@
|
||||
show-word-limit
|
||||
:disabled="analyzing"
|
||||
/>
|
||||
|
||||
|
||||
<div class="quick-questions">
|
||||
<div class="quick-title">快捷问题</div>
|
||||
<van-tag
|
||||
v-for="(q, index) in quickQuestions"
|
||||
<div class="quick-title">
|
||||
快捷问题
|
||||
</div>
|
||||
<van-tag
|
||||
v-for="(q, index) in quickQuestions"
|
||||
:key="index"
|
||||
type="primary"
|
||||
plain
|
||||
@@ -47,9 +49,9 @@
|
||||
</van-tag>
|
||||
</div>
|
||||
|
||||
<van-button
|
||||
type="primary"
|
||||
block
|
||||
<van-button
|
||||
type="primary"
|
||||
block
|
||||
round
|
||||
:loading="analyzing"
|
||||
loading-text="分析中..."
|
||||
@@ -61,23 +63,32 @@
|
||||
</div>
|
||||
|
||||
<!-- 结果区域 -->
|
||||
<div v-if="showResult" class="result-section">
|
||||
<div
|
||||
v-if="showResult"
|
||||
class="result-section"
|
||||
>
|
||||
<div class="result-header">
|
||||
<h3>分析结果</h3>
|
||||
<van-icon
|
||||
v-if="!analyzing"
|
||||
name="delete-o"
|
||||
<van-icon
|
||||
v-if="!analyzing"
|
||||
name="delete-o"
|
||||
size="18"
|
||||
@click="clearResult"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<div ref="resultContainer" class="result-content rich-html-content">
|
||||
<div v-html="resultHtml"></div>
|
||||
<van-loading v-if="analyzing" class="result-loading">
|
||||
|
||||
<div
|
||||
ref="resultContainer"
|
||||
class="result-content rich-html-content"
|
||||
>
|
||||
<div v-html="resultHtml" />
|
||||
<van-loading
|
||||
v-if="analyzing"
|
||||
class="result-loading"
|
||||
>
|
||||
AI正在分析中...
|
||||
</van-loading>
|
||||
<div ref="scrollAnchor"></div>
|
||||
<div ref="scrollAnchor" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -210,7 +221,7 @@ const startAnalysis = async () => {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
'Authorization': `Bearer ${token}`
|
||||
Authorization: `Bearer ${token}`
|
||||
},
|
||||
body: JSON.stringify({
|
||||
userInput: userInput.value
|
||||
@@ -226,8 +237,10 @@ const startAnalysis = async () => {
|
||||
|
||||
while (true) {
|
||||
const { done, value } = await reader.read()
|
||||
|
||||
if (done) break
|
||||
|
||||
if (done) {
|
||||
break
|
||||
}
|
||||
|
||||
const chunk = decoder.decode(value, { stream: true })
|
||||
const lines = chunk.split('\n')
|
||||
@@ -235,7 +248,7 @@ const startAnalysis = async () => {
|
||||
for (const line of lines) {
|
||||
if (line.startsWith('data: ')) {
|
||||
const data = line.substring(6).trim()
|
||||
|
||||
|
||||
if (data === '[DONE]') {
|
||||
continue
|
||||
}
|
||||
@@ -254,7 +267,6 @@ const startAnalysis = async () => {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.error('分析失败:', error)
|
||||
showToast('分析失败,请重试')
|
||||
|
||||
Reference in New Issue
Block a user