@@ -186,7 +186,7 @@ export default {
186186 }
187187 },
188188 emits: [' close-chat' ],
189- setup() {
189+ setup(props ) {
190190 const {
191191 getBlockContent,
192192 initBlockList,
@@ -261,16 +261,20 @@ export default {
261261 // 在每一次发送请求之前,都把提示词,给放到第一条消息中
262262 // 为了不污染存储在localstorage里的用户的原始消息,这里进行了简单的对象拷贝
263263 // 引入区块不存放在localstorage的原因:因为区块是可以变化的,用户可能在同一个会话中,对区块进行了删除和创建。那么存放的数据就不是即时数据了。
264- const getSendSeesionProcess = () => {
264+ const getSendSeesionProcess = async () => {
265265 const sendProcess = { ... sessionProcess }
266266 const firstMessage = sendProcess .messages [0 ]
267267 let firstContent = firstMessage .content
268268 if (aiType .value === AI_MODES [' Builder' ]) {
269+ const res = await getMetaApi (META_SERVICE .Http ).get (' /material-center/api/resource/list' )
270+ const imageArr = res .map ((item ) => item .resourceUrl )
271+ const imageStr = imageArr .length ? ` [图片资源] ${imageArr } ` : ' '
272+
269273 firstContent = firstMessage .content .map ((item ) => {
270274 if (item .type === ' text' ) {
271- item .text = ` [指令] ${PROMPTS }\n [知识] ${searchContent . value } \n [当前schema] ${ JSON . stringify (
272- pageState . pageSchema
273- ) } `
275+ item .text = ` [指令] ${props . options ?. prompts ? props . options ?. prompts : PROMPTS }\n [知识] ${
276+ searchContent . value
277+ } \n [当前schema] ${ JSON . stringify ( pageState . pageSchema )} \n ${ imageStr } `
274278 }
275279 return item
276280 })
@@ -326,6 +330,7 @@ export default {
326330 const newValue = JSON .parse (match [1 ])
327331 // 使用 applyPatch 修改 Schema
328332 const result = newValue .reduce (jsonpatch .applyReducer , currentJson )
333+ setSchema (result )
329334 useHistory ().addHistory ()
330335
331336 sessionProcess .messages .push (getAiRespMessage (JSON .stringify (result , null , 2 ), chatMessage .role ))
@@ -357,7 +362,7 @@ export default {
357362 const requestLoading = ref (false )
358363 // 发送流式请求
359364 const sendStreamRequest = async () => {
360- const requestData = getSendSeesionProcess ()
365+ const requestData = await getSendSeesionProcess ()
361366 if (useMcpServer ().isToolsEnabled && aiType .value === AI_MODES [' Chat' ]) {
362367 try {
363368 requestLoading .value = true
0 commit comments