Commit 51762e54 authored by 水玉婷's avatar 水玉婷
Browse files

feat:修复思考模式无法渲染bug

parent 6c6b90e5
# 开发环境配置 # 开发环境配置
VITE_API_BASE_URL=http://peddev.cmic.com.cn # VITE_API_BASE_URL=http://peddev.cmic.com.cn
VITE_API_BASE_URL=http://10.17.86.60:8656
# 应用基础路径 # 应用基础路径
VITE_BASE_PATH=/ai/ VITE_BASE_PATH=/ai/
......
...@@ -3,8 +3,14 @@ import App from './App.vue' ...@@ -3,8 +3,14 @@ import App from './App.vue'
import router from './router' import router from './router'
import { setRouter } from './utils/router-manager' import { setRouter } from './utils/router-manager'
import { initGlobalErrorHandler, handle401Error, is401Error } from './utils/error-handler' import { initGlobalErrorHandler, handle401Error, is401Error } from './utils/error-handler'
// 引入ant-design-vue
import Antd from 'ant-design-vue';
import 'ant-design-vue/dist/antd.css';
const app = createApp(App) const app = createApp(App)
app.use(router) app.use(router)
app.use(Antd)
// 设置全局路由实例 // 设置全局路由实例
setRouter(router) setRouter(router)
......
...@@ -35,9 +35,10 @@ ...@@ -35,9 +35,10 @@
// 使用环境变量代替硬编码 // 使用环境变量代替硬编码
const appCode = import.meta.env.VITE_APP_CODE || 'ped.qywx'; const appCode = import.meta.env.VITE_APP_CODE || 'ped.qywx';
const time = new Date().getTime();
const chatParams = { const chatParams = {
appId: '83b2664019a945d0a438abe6339758d8', appId: '83b2664019a945d0a438abe6339758d8',
stage: 'wechat-demo', stage: 'wechat-demo'+time,
}; };
// const dialogSessionId = '20251127180914709-00043912'; // const dialogSessionId = '20251127180914709-00043912';
......
...@@ -415,21 +415,23 @@ export class ContentTemplateService { ...@@ -415,21 +415,23 @@ export class ContentTemplateService {
updatedIsThinking = true; updatedIsThinking = true;
// 记录思考开始时间 // 记录思考开始时间
this.thinkingStartTime = Date.now(); this.thinkingStartTime = Date.now();
if (updatedResponse) {
if (updatedBlockIndex === -1 && updatedResponse) { // 如果blockIndex为-1或者当前索引对应的内容块不存在,创建新的思考内容块
updatedBlockIndex = updatedResponse.contentBlocks.length; if (updatedBlockIndex === -1 || !updatedResponse.contentBlocks[updatedBlockIndex]) {
updatedResponse.contentBlocks.push({ updatedBlockIndex = updatedResponse.contentBlocks.length;
content: '', updatedResponse.contentBlocks.push({
thinkContent: `${messageContent}`, content: '',
hasThinkBox: true, thinkContent: messageContent ? `${messageContent}` : '正在分析您的问题...',
thinkBoxExpanded: false, hasThinkBox: true,
thinkingTime: 0, thinkBoxExpanded: false,
thinkingTimeText: '正在思考中……', thinkingTime: 0,
}); thinkingTimeText: '正在思考中……',
} else if (updatedResponse && updatedResponse.contentBlocks[updatedBlockIndex]) { });
updatedResponse.contentBlocks[updatedBlockIndex].thinkContent += ``; } else {
updatedResponse.contentBlocks[updatedBlockIndex].hasThinkBox = true; // 如果已有思考内容块,确保hasThinkBox为true
updatedResponse.contentBlocks[updatedBlockIndex].thinkBoxExpanded = defaultThinkBoxExpanded; updatedResponse.contentBlocks[updatedBlockIndex].hasThinkBox = true;
updatedResponse.contentBlocks[updatedBlockIndex].thinkBoxExpanded = defaultThinkBoxExpanded;
}
} }
break; break;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment