接口联调树状图节点详情
This commit is contained in:
@@ -8,4 +8,5 @@ export default store
|
|||||||
export * from './global'
|
export * from './global'
|
||||||
export * from './userInfo'
|
export * from './userInfo'
|
||||||
export * from './projectData'
|
export * from './projectData'
|
||||||
export * from './agent'
|
export * from './agent'
|
||||||
|
export * from './versionTree'
|
||||||
@@ -3,11 +3,25 @@ import { ref, computed } from 'vue'
|
|||||||
export const useVersionTreeStore = defineStore('versionTree', () => {
|
export const useVersionTreeStore = defineStore('versionTree', () => {
|
||||||
const state = ref({
|
const state = ref({
|
||||||
nodeDetail: {
|
nodeDetail: {
|
||||||
|
createTime:'',
|
||||||
|
userEndChat:{
|
||||||
|
content:'',
|
||||||
|
createTime:'',
|
||||||
|
image_url:'',
|
||||||
|
},
|
||||||
|
generateEndChat:{
|
||||||
|
content:'',
|
||||||
|
createTime:'',
|
||||||
|
image_url:'',
|
||||||
|
},
|
||||||
},// 节点详情
|
},// 节点详情
|
||||||
})
|
})
|
||||||
|
|
||||||
const setNodeDetail = (v: any) => { state.value.nodeDetail = v }
|
const setNodeDetail = (v: any) => {
|
||||||
|
for(let key in v){
|
||||||
|
state.value.nodeDetail[key] = v[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
state,
|
state,
|
||||||
|
|||||||
@@ -10,6 +10,14 @@ const props = defineProps({
|
|||||||
type: String,
|
type: String,
|
||||||
default: 'user'
|
default: 'user'
|
||||||
},
|
},
|
||||||
|
chatDetail: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({
|
||||||
|
content:'',
|
||||||
|
creatTime:'',
|
||||||
|
image_url:'',
|
||||||
|
})
|
||||||
|
},
|
||||||
})
|
})
|
||||||
//const emit = defineEmits([
|
//const emit = defineEmits([
|
||||||
//])
|
//])
|
||||||
@@ -30,12 +38,13 @@ const {} = toRefs(data);
|
|||||||
<span>{{ type == 'user'? $t('VersionTree.input'): $t('VersionTree.sketch') }}</span>
|
<span>{{ type == 'user'? $t('VersionTree.input'): $t('VersionTree.sketch') }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="time">
|
<div class="time">
|
||||||
<span>12:00:00</span>
|
<span>{{ new Date(chatDetail.createTime * 1000).toLocaleString() }}</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="infoTitle">{{ type == 'user'? $t('VersionTree.userRequest'): $t('VersionTree.generateResult') }}</div>
|
<div class="infoTitle">{{ type == 'user'? $t('VersionTree.userRequest'): $t('VersionTree.generateResult') }}</div>
|
||||||
<div class="history">
|
<div class="history">
|
||||||
Design a modern yellow sofa that combines comfort, elegance, and contemporary aesthetics.
The sofa features a warm, soft yellow tone (mustard or light ochre), with a minimalist silhouette and clean lines.
Upholstered in high-quality fabric with a subtle texture, offering a cozy and inviting feel.
The seat is deep and plush, with generous cushioning for relaxation, while the backrest and armrests are softly rounded to enhance comfort.
|
<span>{{ chatDetail.content }}</span>
|
||||||
|
<img v-if="chatDetail.image_url" :src="chatDetail.image_url" alt="">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -90,6 +99,16 @@ const {} = toRefs(data);
|
|||||||
flex: 1;
|
flex: 1;
|
||||||
overflow-y: auto;
|
overflow-y: auto;
|
||||||
margin-left: 3rem;
|
margin-left: 3rem;
|
||||||
|
> span{
|
||||||
|
|
||||||
|
}
|
||||||
|
> img{
|
||||||
|
width: 100%;
|
||||||
|
height: auto;
|
||||||
|
margin-top: 1.2rem;
|
||||||
|
border-radius: 1.3rem;
|
||||||
|
border: 1px solid #C9C9C9;
|
||||||
|
}
|
||||||
&::-webkit-scrollbar {
|
&::-webkit-scrollbar {
|
||||||
width: 4px;
|
width: 4px;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { ref, onMounted, onUnmounted, reactive, watch } from "vue";
|
import { ref, onMounted, onUnmounted, computed, watch } from "vue";
|
||||||
import VersionDetail from './versionDetail.vue'
|
import VersionDetail from './versionDetail.vue'
|
||||||
import ChatDetail from './chatDetail.vue'
|
import ChatDetail from './chatDetail.vue'
|
||||||
import { useProjectStore } from '@/stores'
|
import { useProjectStore, useVersionTreeStore } from '@/stores'
|
||||||
import { getChatNodeDetail, getNodeAncestors } from '@/api/versitonTree'
|
import { getChatNodeDetail, getNodeAncestors } from '@/api/versitonTree'
|
||||||
|
|
||||||
//const props = defineProps({
|
//const props = defineProps({
|
||||||
@@ -11,35 +11,57 @@ const emit = defineEmits([
|
|||||||
])
|
])
|
||||||
|
|
||||||
const projectStore = useProjectStore()
|
const projectStore = useProjectStore()
|
||||||
|
const versiontreeStore = useVersionTreeStore()
|
||||||
|
|
||||||
const detailData = ref({
|
const detailData = ref({
|
||||||
id:1,
|
chatEndDetail:computed(()=>{
|
||||||
versionDetail:{
|
return versiontreeStore.state.nodeDetail
|
||||||
version:'1.0.0',
|
}),
|
||||||
versionTime:'2023-08-01 10:00:00',
|
loading:false,
|
||||||
versionSketch:'Version 1 - Sketch',
|
|
||||||
versionSketchTime:'2023-08-01 10:00:00',
|
|
||||||
},
|
|
||||||
userChatDetail:{
|
|
||||||
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
watch(()=>projectStore.state.nodeId, (newVal, oldVal) => {
|
watch(()=>projectStore.state.nodeId, (newVal, oldVal) => {
|
||||||
console.log(newVal)
|
|
||||||
if(newVal){
|
if(newVal){
|
||||||
|
detailData.value.loading = true
|
||||||
|
|
||||||
getChatNodeDetail({
|
getChatNodeDetail({
|
||||||
projectId: projectStore.state.id,
|
projectId: projectStore.state.id,
|
||||||
id: newVal
|
id: newVal
|
||||||
}).then(res => {
|
}).then((res:any) => {
|
||||||
console.log(res)
|
let userEndChat = {
|
||||||
})
|
content:'',
|
||||||
getNodeAncestors({
|
createTime:'',
|
||||||
projectId: projectStore.state.id,
|
image_url:'',
|
||||||
id: newVal
|
}
|
||||||
}).then(res => {
|
let generateEndChat = {
|
||||||
console.log(res)
|
content:'',
|
||||||
|
createTime:'',
|
||||||
|
image_url:'',
|
||||||
|
}
|
||||||
|
res.dialogue.forEach(item => {
|
||||||
|
if(item.role == 'user'){
|
||||||
|
if(item.content){
|
||||||
|
userEndChat.content += item.content
|
||||||
|
userEndChat.createTime = item.createTime
|
||||||
|
}
|
||||||
|
}else if(item.role == "assistant"){
|
||||||
|
if(item.content){
|
||||||
|
generateEndChat.content += item.content
|
||||||
|
generateEndChat.createTime = item.createTime
|
||||||
|
if(item.image_url)generateEndChat.image_url = item.image_url
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
versiontreeStore.setNodeDetail({createTime:res.createTime,userEndChat,generateEndChat})
|
||||||
|
detailData.value.loading = false
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// getNodeAncestors({
|
||||||
|
// projectId: projectStore.state.id,
|
||||||
|
// id: newVal
|
||||||
|
// }).then(res => {
|
||||||
|
// console.log(res)
|
||||||
|
// })
|
||||||
}
|
}
|
||||||
},{ immediate: true })
|
},{ immediate: true })
|
||||||
onMounted(()=>{
|
onMounted(()=>{
|
||||||
@@ -53,15 +75,16 @@ defineExpose({})
|
|||||||
<div class="detailBox">
|
<div class="detailBox">
|
||||||
<div class="versionDetail">
|
<div class="versionDetail">
|
||||||
<VersionDetail
|
<VersionDetail
|
||||||
:versionDetail="detailData.versionDetail"
|
:versionDetail="detailData.chatEndDetail"
|
||||||
></VersionDetail>
|
></VersionDetail>
|
||||||
</div>
|
</div>
|
||||||
<div class="useInput">
|
<div class="useInput">
|
||||||
<ChatDetail type="user"></ChatDetail>
|
<ChatDetail type="user" :chatDetail="detailData.chatEndDetail.userEndChat"></ChatDetail>
|
||||||
</div>
|
</div>
|
||||||
<div class="systemInput">
|
<div class="systemInput">
|
||||||
<ChatDetail type="robot"></ChatDetail>
|
<ChatDetail type="robot" :chatDetail="detailData.chatEndDetail.generateEndChat"></ChatDetail>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="loading" v-if="detailData.loading" v-loading="true"></div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
@@ -71,7 +94,15 @@ defineExpose({})
|
|||||||
position: relative;
|
position: relative;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
> div{
|
> .loading{
|
||||||
|
position: absolute;
|
||||||
|
z-index: 999999999;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
|
> .versionDetail,> .useInput,> .systemInput{
|
||||||
border-radius: var(--border-radius, 1rem);
|
border-radius: var(--border-radius, 1rem);
|
||||||
border: 1px solid #D9D9D9;
|
border: 1px solid #D9D9D9;
|
||||||
background-color: #f7f7f7;
|
background-color: #f7f7f7;
|
||||||
|
|||||||
@@ -5,7 +5,12 @@ const { t: $t } = useI18n()
|
|||||||
const props = defineProps({
|
const props = defineProps({
|
||||||
versionDetail: {
|
versionDetail: {
|
||||||
type: Object,
|
type: Object,
|
||||||
default: () => ({})
|
default: () => ({
|
||||||
|
version:'1.0.0',
|
||||||
|
createTime:'',
|
||||||
|
versionSketch:'Version 1 - Sketch',
|
||||||
|
versionSketchTime:'2023-08-01 10:00:00',
|
||||||
|
})
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
const emit = defineEmits([
|
const emit = defineEmits([
|
||||||
@@ -29,10 +34,10 @@ const {} = toRefs(data);
|
|||||||
{{ $t('VersionTree.versionInformation') }}
|
{{ $t('VersionTree.versionInformation') }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="version">{{versionDetail.version}}</div>
|
<div class="version">{{versionDetail.version || '1.0.0'}}</div>
|
||||||
<div class="time marBott1">{{versionDetail.versionTime}}</div>
|
<div class="time marBott1">{{ new Date(versionDetail.createTime * 1000).toLocaleString() }}</div>
|
||||||
<div class="version gray">{{versionDetail.versionSketch}}</div>
|
<div class="version gray">{{versionDetail.versionSketch || 'Version 1 - Sketch'}}</div>
|
||||||
<div class="time gray">{{versionDetail.versionSketchTime}}</div>
|
<div class="time gray">{{versionDetail.versionSketchTime || '2023-08-01 10:00:00'}}</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<style lang="less" scoped>
|
<style lang="less" scoped>
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ const setVersionsList = (res)=>{
|
|||||||
function traverseArray(items,father, callback) {
|
function traverseArray(items,father, callback) {
|
||||||
for (let i = 0; i < items.length; i++) {
|
for (let i = 0; i < items.length; i++) {
|
||||||
const item = items[i]
|
const item = items[i]
|
||||||
if(!item.url)continue
|
// if(!item?.url)continue
|
||||||
callback(item, i,father)
|
callback(item, i,father)
|
||||||
if (item.children && Array.isArray(item.children) && item.children.length > 0) {
|
if (item.children && Array.isArray(item.children) && item.children.length > 0) {
|
||||||
traverseArray(item.children, item, callback)
|
traverseArray(item.children, item, callback)
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ const initialize = ()=>{
|
|||||||
const setSelectItem = (item)=>{
|
const setSelectItem = (item)=>{
|
||||||
if(!item.versionId)return
|
if(!item.versionId)return
|
||||||
console.log(item)
|
console.log(item)
|
||||||
// projectStore.setProject({latestNodeId: item.id})
|
projectStore.setProject({nodeId: item.id})
|
||||||
emit('update:selectItem', {...item})
|
emit('update:selectItem', {...item})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -198,7 +198,10 @@ defineExpose({push})
|
|||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
&.active{
|
&.active{
|
||||||
// background-color: var(--treeItem-active-background);
|
// background-color: var(--treeItem-active-background);
|
||||||
border: 2px solid #000;
|
border: 2px solid #d9d9d9;
|
||||||
|
.mask{
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&.start{
|
&.start{
|
||||||
background-color: #7A7A7A;
|
background-color: #7A7A7A;
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ const props = defineProps<{
|
|||||||
<!-- <div>{{ props.data.id }}</div> -->
|
<!-- <div>{{ props.data.id }}</div> -->
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<!-- {{ props.data.url }} -->
|
<!-- {{ props.data.url }} -->
|
||||||
<img :src="props.data.url" />
|
<img :src="props.data?.url" />
|
||||||
|
<div class="mask"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@@ -35,11 +36,20 @@ const props = defineProps<{
|
|||||||
.item{
|
.item{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
position: relative;
|
||||||
img{
|
img{
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
object-fit: contain;
|
object-fit: contain;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.mask{
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
Reference in New Issue
Block a user