This commit is contained in:
X1627315083
2025-05-21 20:05:08 +08:00
parent 2487e3dbbc
commit 7ba4c70baf
8 changed files with 333 additions and 52 deletions

View File

@@ -1,6 +1,9 @@
<template>
<div class="chat" :class="{active:!openChat}" @click.stop="">
<div v-show="!openChat" class="left" @click="()=>{openChat = !openChat;isChattingRecords=false}">
<div class="top" :class="{active:!isChattingRecords}" @click="()=>{isChattingRecords=!isChattingRecords}">
<i class="fi fi-br-angle-small-down"></i>
</div>
<div v-show="!openChat" class="left" @click="()=>{openChat = !openChat;isChattingRecords=true}">
<i class="fi fi-br-angle-small-down"></i>
</div>
<div class="chatBox">
@@ -9,8 +12,15 @@
<div class="item" v-for="item in chatList" :class="{user:item.role == 'user'}">
<div class="textBox">
<div class="icon">ICON</div>
<div class="text" v-show="item.content.message || item.content.img || item.content.color">
<span>{{item.content.message}}</span>
<div class="text" v-show="item.content.think || item.content.message || item.content.img || item.content.color">
<span class="content">
<div class="showThink" :class="{active:item.content?.isThink}" v-show="item.content.think" @click="()=>item.content?.isThink?(item.content.isThink = false):(item.content.isThink = true)">
<div>已深度思考</div>
<i class="fi fi-br-angle-small-down"></i>
</div>
<div class="think" v-show="item.content?.isThink">{{item.content.think}}</div>
<div class="txt">{{item.content.message}}</div>
</span>
<div class="fileBox">
<div v-if="item?.fileList?.length > 0" class="item" v-for="fileItem in item.fileList">
<div>{{fileItem.name}}</div>
@@ -26,7 +36,7 @@
</div>
</div>
</div>
<i class="fi fi-br-loading" v-if="!item.content.message && !item.content.img && !item.content.color"></i>
<i class="fi fi-br-loading" v-if="!item.content.think && !item.content.message && !item.content.img && !item.content.color"></i>
</div>
</div>
</div>
@@ -41,7 +51,7 @@
<span class="icon iconfont icon-shanchu" @click="deleteFile(item,index)"></span>
</div>
</div>
<i class="fi fi-br-upload">
<i class="fi fi-rs-paperclip-vertical">
<input type="file" @change="handleFileUpload($event)">
</i>
</div>
@@ -111,12 +121,13 @@ export default defineComponent({
let fileList = JSON.parse(JSON.stringify(data.filList))
let fileUrl = (fileList.filter((item:any)=>item.type == 'file').length > 0) ? fileList.filter((item:any)=>item.type == 'file')[0].minioPath : ''
let imageUrlList = (fileList.filter((item:any)=>item.type == 'image').length > 0)? fileList.filter((item:any)=>item.type == 'image').map((item:any)=>item.minioPath).join(',') : ''
data.chatList.push({content:{message:data.chatContent},role:'user',fileList:fileList})
data.chatList.push({content:{message:''},role:'system'})
data.chatList.push({content:{message:data.chatContent,think:''},role:'user',fileList:fileList})
data.chatList.push({content:{message:'',think:''},role:'system'})
const eventSource = new EventSource(`${process.env.VUE_APP_BASE_URL}${Https.httpUrls.llmStream}?token=${getCookie('token')}&prompt=${data.chatContent}&projectId=${data.selectObject.id}&fileUrl=${fileUrl}&imageUrlList=${imageUrlList}&enableThinking=${data.enableThinking}`);
data.chatContent = ''
dataDom.textarea.value = ''
data.filList = []
let isText = !data.enableThinking
eventSource.onmessage = function(event) {
data.isFinish = false
// console.log('收到数据:', JSON.parse(event.data));
@@ -128,7 +139,14 @@ export default defineComponent({
const container = dataDom.chatBox;
container.scrollTop = container.scrollHeight;
if(JSON.parse(event.data).status == "[RUNNING]"){
data.chatList[data.chatList.length-1].content.message+=JSON.parse(event.data).content
if(/\[TEXT\]/.test(JSON.parse(event.data).content)){
isText = true
}
if(isText){
data.chatList[data.chatList.length-1].content.message+=JSON.parse(event.data).content
}else{
data.chatList[data.chatList.length-1].content.think+=JSON.parse(event.data).content
}
}else{
if(JSON.parse(event.data).status == "[DESIGN_SIGNAL]"){
@@ -141,13 +159,11 @@ export default defineComponent({
data.chatList[data.chatList.length-1].content.img = JSON.parse(JSON.parse(event.data).tools_data).receiveCollectionElementList
data.chatList.push({content:{message:''},role:'system'})
}
console.log(data.chatList[data.chatList.length-1].content)
emit('chatChange',{type:JSON.parse(event.data).status})
}
};
eventSource.onerror = function(error) {
console.log(error,EventSource.CLOSED,eventSource.readyState)
if (eventSource.readyState === EventSource.CLOSED) {
data.chatList[data.chatList.length-1].content.message='服务器繁忙,请稍后再试。'
@@ -168,17 +184,29 @@ export default defineComponent({
rv.content.forEach((item:any,index:number) => {
if(rv.content[rv.content.length - index -1].role == 'system'){
let text = rv.content[rv.content.length - index -1].content
if(rv.content[rv.content.length - index -1].isImage == 1){
if(rv.content[rv.content.length - index -1].isImage == 2){
rv.content[rv.content.length - index -1].content={
img : JSON.parse(rv.content[rv.content.length - index -1].content)
}
}else if(rv.content[rv.content.length - index -1].isImage==2){
}else if(rv.content[rv.content.length - index -1].isImage==1){
rv.content[rv.content.length - index -1].content={
color : JSON.parse(rv.content[rv.content.length - index -1].content)
}
}else{
let think = ''
let message = ''
if(text.split('[TEXT]').length > 1){
think = text.split('[TEXT]')[0]
text.split('[TEXT]').forEach((text:any,index:number) => {
if(index == 0)return
message += ('[TEXT]'+text)
});
}else{
message = text
}
rv.content[rv.content.length - index -1].content = {
message:text
message:message,
think:think,
}
}
}else{
@@ -209,11 +237,11 @@ export default defineComponent({
}
const openChattingRecords = ()=>{
data.isChattingRecords = true
let setRecords = ()=>{
data.isChattingRecords = false
document.removeEventListener('click',setRecords)
}
document.addEventListener('click',setRecords)
// let setRecords = ()=>{
// data.isChattingRecords = false
// document.removeEventListener('click',setRecords)
// }
// document.addEventListener('click',setRecords)
}
const handleFileUpload = (event:any)=>{
if (event.target.files[0].size > 5 * 1024 * 1024) { // 5MB
@@ -313,6 +341,14 @@ export default defineComponent({
background: #f5f5f5;
max-width: 60%;
> .text{
> .content{
> .txt{
}
> .showThink{
display: none;
}
}
> .fileBox{
> .item{
height: 3rem;
@@ -343,7 +379,8 @@ export default defineComponent({
display: flex;
padding: 1.2rem 2rem;
border-radius: 2.4rem;
-webkit-user-select: none;
> .text{
// display: inline-block;
// width: min-content;
@@ -351,6 +388,40 @@ export default defineComponent({
width: 100%;
// width: min-content;
// word-wrap: break-word;
> .content{
> .txt{
}
> .showThink{
cursor: pointer;
display: flex;
padding: .7rem 1.4rem;
margin-bottom: 1.2rem;
background: rgb(237 237 237);
border-radius: 1rem;
align-items: center;
&.active{
>i{
transform: rotate(180deg);
}
}
> i{
display: flex;
transition: all .3s;
}
}
> .think{
margin-bottom: 2rem;
padding-left: 2rem;
color: #8b8b8b;
white-space: pre-wrap;
border-left: 2px solid #e5e5e5;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
}
> .imgBox{
display: flex;
flex-wrap: wrap;
@@ -503,7 +574,7 @@ export default defineComponent({
}
}
}
> .right,> .left{
> .right,> .left,>.top{
display: flex;
align-items: center;
cursor: pointer;
@@ -515,6 +586,18 @@ export default defineComponent({
transition: all .3s;
}
}
> .top{
width: 100%;
margin: 0 3rem;
height: 3rem;
&.active{
> i{
transform: rotate(180deg);
}
}
> i{
}
}
> .right{
border-left: 1px solid #e5e5e5;
> i{
@@ -527,5 +610,6 @@ export default defineComponent({
transform: rotate(90deg);
}
}
flex-wrap: wrap;
}
</style>

View File

@@ -10,7 +10,7 @@
<design ref="design"></design>
</div>
<div v-else class="function">
<newPorject ref="newPorject"></newPorject>
<newPorject ref="newPorject" @newProject=newProject></newPorject>
</div>
</div>
</div>
@@ -25,14 +25,16 @@ import { useI18n } from 'vue-i18n'
import { useRouter,useRoute } from 'vue-router'
import design from "./design/index.vue"
import newPorject from "./newProject/index.vue"
import router from '@/router';
import chat from "./chat/index.vue"
export default defineComponent({
components:{
design,newPorject,chat
},
props:{
settingGetHistory:{type:Function,default:()=>{}},
},
emits:['setTask'],
emits:['setTask','newProject'],
setup(props,{emit}) {
const store = useStore();
const route = useRoute()
@@ -124,7 +126,7 @@ export default defineComponent({
let storeData = {
name:rv.name,
id:rv.id,
type:rv.type,
type:rv.process == 'SERIES_DESIGN'?'seriesDesign':'singleProductDesign',
httpType:rv.process,//项目类型
ageGroup:rv.workspaceVO.ageGroup,
style:rv.workspaceVO.style,
@@ -357,18 +359,22 @@ export default defineComponent({
return colorList;
}
const chatChange = (value:any)=>{
console.log(value)
if(value.type == '[DESIGN_SIGNAL]' && dataDom.design){
dataDom.design.designNewCollection()
}else{
getCollection()
}
}
const newProject = (id:any)=>{
props.settingGetHistory()
router.push(`home?history=${id}`)
}
return{
...toRefs(dataDom),
...toRefs(data),
setTask,
chatChange,
newProject,
}
},
provide() {

View File

@@ -27,7 +27,7 @@
<span class="icon iconfont icon-shanchu" @click="deleteFile(item,index)"></span>
</div>
</div>
<i class="fi fi-br-upload">
<i class="fi fi-rs-paperclip-vertical">
<input type="file" @change="handleFileUpload($event)">
</i>
</div>
@@ -39,13 +39,12 @@
</div>
</div>
</div>
<div v-show="chatOrSetting != 'chat'">
<div v-show="chatOrSetting != 'chat'" class="workspaceBox">
<workspace @setProject="setProject" :httpWorkflowType="selectFlow.value"></workspace>
</div>
<div class="hint" v-show="chatOrSetting == 'chat'">
<div class="item" v-for="item in hintList" @click="addChatContent(item)">{{ item }}</div>
</div>
{{ text }}
</div>
</div>
<div class="mark_loading" v-show="loadingShow">
@@ -54,7 +53,7 @@
</div>
</template>
<script lang="ts">
import { defineComponent,computed,ref,provide,nextTick,createVNode,toRefs, reactive} from 'vue'
import { defineComponent,computed,ref,provide,nextTick,createVNode,toRefs, reactive, onMounted} from 'vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { Https } from "@/tool/https";
import { useStore } from "vuex";
@@ -69,7 +68,7 @@ export default defineComponent({
},
props:{
},
emits:[],
emits:['newProject'],
setup(props,{emit}) {
const store = useStore();
const data = reactive({
@@ -78,16 +77,14 @@ export default defineComponent({
title:'Series Design',
value:'SERIES_DESIGN',
describe:[
'12312312',
'12312312',
'Series Design focuses on the coordinated design of multi-category clothing, ideal for creating a unified fashion collection. You can use the Moodboard, Printboard, Colorboard, Sketchboard, and Mannequin sections in the Design Assests panel to organize your inspiration and design complementary clothing combinations. Finally, refine your designs in the Draft and Collection panels using tools like To Product Image, Relight, and Transfer Pose, then export to the Canvas to showcase your complete series design.',
]
},
{
title:'Single Design',
value:'SINGLE_DESIGN',
describe:[
'12312312',
'12312312',
'Single Design centers on the independent design of a single clothing category, such as a T-shirt, dress, or jacket, without considering coordination with other items. Use the Moodboard, Printboard, Colorboard, and Sketchboard in the Design Assests panel to gather inspiration and focus on crafting a unique piece. Once completed, optimize your design in the Draft and Collection panels with tools like To Product Image, Relight, and Transfer Pose, then export to the Canvas to display your individual creation.',
]
},
],
@@ -95,8 +92,7 @@ export default defineComponent({
title:'Series Design',
value:'SERIES_DESIGN',
describe:[
'12312312',
'12312312',
'Series Design focuses on the coordinated design of multi-category clothing, ideal for creating a unified fashion collection. You can use the Moodboard, Printboard, Colorboard, Sketchboard, and Mannequin sections in the Design Assests panel to organize your inspiration and design complementary clothing combinations. Finally, refine your designs in the Draft and Collection panels using tools like To Product Image, Relight, and Transfer Pose, then export to the Canvas to showcase your complete series design.',
]
},
chatContent:'',
@@ -140,7 +136,7 @@ export default defineComponent({
Https.axiosGet(Https.httpUrls.chatCreateProject, {params:{prompt:data.chatContent,process:data.selectFlow.value,fileUrl:fileUrl,imageUrlList}}).then((rv)=>{
if(rv){
data.loadingShow = false
router.push(`home?history=${rv}`)
emit('newProject',rv)
}
}).catch(()=>{
data.loadingShow = false
@@ -213,6 +209,9 @@ export default defineComponent({
const setProject = (item:any)=>{
router.push(`home?history=${item.id}`)
}
onMounted(()=>{
store.commit('createProbject')
})
return{
...toRefs(dataDom),
...toRefs(data),
@@ -252,6 +251,11 @@ export default defineComponent({
font-weight: 600;
text-align: center;
}
> .workspaceBox{
:deep(.workspace){
border: 1px solid #0000001a;
}
}
> .selectFlow{
margin-top: 4.8rem;
width: 100%;
@@ -288,7 +292,7 @@ export default defineComponent({
margin: 0;
color: #71717a;
font-weight: 400;
font-size: 1.2rem;
}
}
}

View File

@@ -0,0 +1,160 @@
<template>
<div class="projectSettingModal" ref="projectSettingModal"></div>
<a-modal
class="projectSetting generalModel"
v-model:visible="habitSetStyle"
:footer="null"
width="50%"
:get-container="() => $refs.projectSettingModal"
:maskClosable="false"
:centered="true"
:closable="false"
:mask="true"
:keyboard="false"
:destroyOnClose="true"
:zIndex="1000"
>
<div class="generalModel_btn">
<div class="generalModel_closeIcon" @click.stop="cleardata()">
<svg width="46" height="46" viewBox="0 0 46 46" fill="none" xmlns="http://www.w3.org/2000/svg">
<circle cx="23" cy="23" r="23" fill="white" fill-opacity="0.3"/>
<rect x="32.5063" y="12" width="3" height="29" rx="1.5" transform="rotate(45 32.5063 12)" fill="white"/>
<rect x="34.6274" y="32.5059" width="3" height="29" rx="1.5" transform="rotate(135 34.6274 32.5059)" fill="white"/>
</svg>
</div>
</div>
<div class="designOpenrtion_content">
<div class="modal_title_text">
<div>Setting</div>
</div>
<div class="workspaceBox">
<workspace ref="workspace" @setProject="setProject" :httpWorkflowType="projectData.process"></workspace>
</div>
</div>
<div class="mark_loading" v-show="isShowMark">
<a-spin size="large" />
</div>
</a-modal>
</template>
<script lang="ts">
import { defineComponent,computed,ref,provide,nextTick,createVNode,toRefs, reactive} from 'vue'
import { ExclamationCircleOutlined } from '@ant-design/icons-vue';
import { Https } from "@/tool/https";
import { useStore } from "vuex";
import { useI18n } from 'vue-i18n'
import workspace from './workspace.vue'
import { init } from 'echarts/core';
export default defineComponent({
components:{
workspace,
},
props:{
},
emits:['getHistory'],
setup(props,{emit}) {
const store = useStore();
const data = reactive({
habitSetStyle:false,
isShowMark:false,
projectData:{} as any,
})
const dataDom = reactive({
workspace:null as any,
})
const setIsShowMark = (boolean:boolean)=>{
data.isShowMark = boolean
}
const init = (value:any)=>{
console.log(value)
data.projectData = value
data.habitSetStyle = true
getHistory(value.id)
}
provide('setIsShowMark',setIsShowMark)
let cleardata = ()=>{
data.habitSetStyle = false
}
const getHistory = (id:any)=>{
let value = {
id,
}
if(!id)return
Https.axiosPost(Https.httpUrls.selectHistoryProject,value).then((rv: any) => {
setProjectData(rv)
}).catch((res)=>{
data.isShowMark = false
})
}
const setProjectData = (rv:any)=>{
let storeData = {
name:rv.name,
id:rv.id,
type:rv.process == 'SERIES_DESIGN'?'seriesDesign':'singleProductDesign',
httpType:rv.process,//项目类型
ageGroup:rv.workspaceVO.ageGroup,
style:rv.workspaceVO.style,
styleId:rv.workspaceVO.styleId,
styleName:rv.workspaceVO.styleName,
sex:rv.workspaceVO.sex,
systemDesignerPercentage:rv.workspaceVO.systemDesignerPercentage,
position:{
label:rv.workspaceVO.positionEnum.value,
value:rv.workspaceVO.positionEnum.name
},
positionList:[],
publishData:{
id:rv.portfolioDTO.id?rv.portfolioDTO.id:'',
portfolioDes:rv.portfolioDTO.portfolioDes?rv.portfolioDTO.portfolioDes:'',
portfolioName:rv.portfolioDTO.portfolioName?rv.portfolioDTO.portfolioName:'',
tagsDTO:rv.portfolioDTO.tagsDTO?rv.portfolioDTO.tagsDTO:[],
},
model:{}
}
let model:any = {}
let position = []
if(storeData.sex == "Female"){
model = {
id:rv.workspaceVO.mannequinFemaleId,
type:rv.workspaceVO.mannequinFemaleType,
url:rv.workspaceVO.femalePresignedUrl,
}
position = store.state.UserHabit.FemalePosition
}else{
model = {
id:rv.workspaceVO.mannequinMaleId,
type:rv.workspaceVO.mannequinMaleType,
url:rv.workspaceVO.malePresignedUrl,
}
position = store.state.UserHabit.MalePosition
}
storeData.model = model
storeData.positionList = position
dataDom.workspace.init(storeData)
}
const setProject = ()=>{
cleardata()
emit('getHistory')
}
return{
...toRefs(dataDom),
...toRefs(data),
cleardata,
init,
setProject,
}
},
provide() {
return {
}
},
})
</script>
<style lang="less" scoped>
.projectSettingModal{
:deep(.designOpenrtion_content){
display: flex;
flex-direction: column;
}
}
</style>

View File

@@ -55,7 +55,7 @@
</div>
</div>
</div>
<div class="position marginBottom" style="display: flex; align-items: center;justify-content: space-between;" v-show="show.position">
<div class="position marginBottom" style="display: flex; align-items: center;justify-content: space-between;" v-show="show.position" v-if="httpWorkflowType == 'SINGLE_DESIGN'">
<div class="text">
Category:
</div>
@@ -128,9 +128,12 @@ export default defineComponent({
},
setIsShowMark:inject('setIsShowMark') as any,
})
watch(()=>data.selectObject_,(newVal)=>{
data.selectObject = JSON.parse(JSON.stringify(newVal))
})
// watch(()=>data.selectObject_,(newVal)=>{
// data.selectObject = JSON.parse(JSON.stringify(newVal))
// })
const init = (storeData:any)=>{
data.selectObject = JSON.parse(JSON.stringify(storeData))
}
const dataDom = reactive({
habitSetStyle:null as any,
})
@@ -244,6 +247,7 @@ export default defineComponent({
projectList,
...toRefs(dataDom),
...toRefs(data),
init,
setStyle,
setWorkspaceStyle,
setprintModel,
@@ -270,7 +274,6 @@ export default defineComponent({
align-items: center;
font-weight: 600;
font-size: 1.8rem;
border: 1px solid #0000001a;
padding: 1.2rem;
border-radius: 2.4rem;
> .workspaceBox{