feat: 小象助手

This commit is contained in:
2026-03-31 15:53:08 +08:00
parent 383857de2f
commit 76d42b4fb2
5 changed files with 20 additions and 18 deletions

View File

@@ -0,0 +1,3 @@
<svg width="12" height="12" viewBox="0 0 12 12" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M0.263992 0.263993C0.615983 -0.0879974 1.18667 -0.0879971 1.53866 0.263993L6 4.72533L10.4613 0.263993C10.8133 -0.087998 11.384 -0.0879971 11.736 0.263993C12.088 0.615983 12.088 1.18667 11.736 1.53866L7.27467 6L11.736 10.4613C12.088 10.8133 12.088 11.384 11.736 11.736C11.384 12.088 10.8133 12.088 10.4613 11.736L6 7.27467L1.53866 11.736C1.18667 12.088 0.615983 12.088 0.263992 11.736C-0.0879975 11.384 -0.0879975 10.8133 0.263992 10.4613L4.72533 6L0.263992 1.53866C-0.0879975 1.18667 -0.0879975 0.615983 0.263992 0.263993Z" fill="#D58C4D"/>
</svg>

After

Width:  |  Height:  |  Size: 653 B

View File

@@ -23,7 +23,13 @@
@mousedown="handleContainerMouseDown" @mousedown="handleContainerMouseDown"
> >
<div class="assistant-header-title">AI Assistant</div> <div class="assistant-header-title">AI Assistant</div>
<SvgIcon name="canvas-assistant-menu" class="menu-icon" color="#D58C4D" /> <SvgIcon
name="closeAssistant"
class="menu-icon"
size="12"
color="#D58C4D"
@click="showAssistant = false"
/>
</div> </div>
<div class="assistant-body flex-1"> <div class="assistant-body flex-1">
<List :messageList="messageList" /> <List :messageList="messageList" />
@@ -81,7 +87,7 @@
) )
const listenAssistantPushChat = (message: Message) => { const listenAssistantPushChat = (message: Message) => {
// console.log('有新消息--'); console.log('有新消息--');
const exist = messageList.value.find((item: Message) => item.nodeType === message.nodeType) const exist = messageList.value.find((item: Message) => item.nodeType === message.nodeType)
if (!exist) { if (!exist) {
@@ -98,10 +104,10 @@
<style lang="less" scoped> <style lang="less" scoped>
.trigger { .trigger {
position: absolute; position: absolute;
right: 0; right: 3rem;
top: 10.3rem;
width: 5rem; width: 5rem;
height: 5rem; height: 5rem;
bottom: 50%;
background-color: #fff; background-color: #fff;
border-radius: 50%; border-radius: 50%;
cursor: grab; cursor: grab;
@@ -134,8 +140,8 @@
.assistant-container { .assistant-container {
position: absolute; position: absolute;
right: 6.2rem; right: 3rem;
bottom: 13.2rem; top: 16.6rem;
width: 46.69rem; width: 46.69rem;
height: 56.6rem; height: 56.6rem;
flex-shrink: 0; flex-shrink: 0;
@@ -169,7 +175,8 @@
} }
.menu-icon { .menu-icon {
width: 1.8rem; cursor: pointer;
width: initial;
} }
} }

View File

@@ -62,7 +62,6 @@
<threeModel :currentData="currentData" /> <threeModel :currentData="currentData" />
</template> </template>
</baseModal> </baseModal>
<Assistant />
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
@@ -70,7 +69,6 @@
import { computed, ref, watch, onMounted, nextTick, provide, onBeforeUnmount } from 'vue' import { computed, ref, watch, onMounted, nextTick, provide, onBeforeUnmount } from 'vue'
import { useLayout } from '@/utils/treeDiagram' import { useLayout } from '@/utils/treeDiagram'
import { NODE_TYPE, NODE_COMPONENT } from './tools/index.d' import { NODE_TYPE, NODE_COMPONENT } from './tools/index.d'
import Assistant from '@/components/Assistant/assistant.vue'
// 组件 // 组件
import headerTools from './components/header-tools.vue' import headerTools from './components/header-tools.vue'
import zoom from '../components/zoom.vue' import zoom from '../components/zoom.vue'

View File

@@ -11,6 +11,7 @@
> >
<slot></slot> <slot></slot>
<my-info /> <my-info />
<Assistant />
<div class="close-btn" @click="close"> <div class="close-btn" @click="close">
<svg-icon name="back-white" color="#fff" size="18" /> <svg-icon name="back-white" color="#fff" size="18" />
</div> </div>
@@ -20,6 +21,7 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from 'vue' import { ref, watch } from 'vue'
import MyInfo from '@/components/MyInfo.vue' import MyInfo from '@/components/MyInfo.vue'
import Assistant from '@/components/Assistant/assistant.vue'
const props = defineProps({ const props = defineProps({
modelValue: { default: false, type: Boolean }, modelValue: { default: false, type: Boolean },
transitionTime: { default: 300, type: Number }, transitionTime: { default: 300, type: Number },

View File

@@ -345,11 +345,7 @@
if (hasSketch) { if (hasSketch) {
hasSketchEvent = true hasSketchEvent = true
console.log('当前sketchList',sketchList.value);
console.log('当前收到的sketch',jsonData,typeof jsonData);
// Object.keys(jsonData).forEach((key) => {
// sketchList.value.push(jsonData[key])
// })
Object.keys(jsonData).forEach((key) => { Object.keys(jsonData).forEach((key) => {
if (!sketchList.value.some((item) => item[key])) { if (!sketchList.value.some((item) => item[key])) {
sketchList.value.push({ sketchList.value.push({
@@ -357,9 +353,6 @@
}) })
} }
}) })
// sketchList.value.push({
// [Object.keys(jsonData)[0]]: jsonData[Object.keys(jsonData)[0]]
// })
// 通知 Preview 有新 sketch 正在加载,传入 sketch 索引 // 通知 Preview 有新 sketch 正在加载,传入 sketch 索引
MyEvent.emit('loading-sketch', sketchList.value.length - 1) MyEvent.emit('loading-sketch', sketchList.value.length - 1)
MyEvent.emit('OpenSketch') MyEvent.emit('OpenSketch')
@@ -398,7 +391,6 @@
} catch (e) { } catch (e) {
// 检查是否为纯文本 [DONE] // 检查是否为纯文本 [DONE]
if (jsonText.trim() === '[DONE]') { if (jsonText.trim() === '[DONE]') {
console.log('结束-----------------------') console.log('结束-----------------------')
aiMessage.text = contentBody aiMessage.text = contentBody
aiMessage.streaming = false aiMessage.streaming = false