feat: 创建项目ID
This commit is contained in:
@@ -151,12 +151,16 @@
|
||||
<img src="@/assets/images/shining.png" class="shining-icon" alt="" />
|
||||
<span class="create-btn-text">{{ $t('Input.createProject') }}</span>
|
||||
</div>
|
||||
<img
|
||||
v-else
|
||||
src="@/assets/images/sender.png"
|
||||
class="sender-icon"
|
||||
@click="handleSendAgent"
|
||||
/>
|
||||
|
||||
<div v-else class="sender-btn flex flex-center" @click="handleSendAgent">
|
||||
<img
|
||||
v-show="!generating"
|
||||
src="@/assets/images/sender.png"
|
||||
alt=""
|
||||
class="sender-icon"
|
||||
/>
|
||||
<div v-show="generating" class="sender-pause" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="!isAgentMode" class="report-btn flex flex-center" @click="toogltReportTag">
|
||||
@@ -171,24 +175,28 @@
|
||||
import { areaList } from '@/utils/area'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { useRouter } from 'vue-router'
|
||||
import { useAgentStore } from '@/stores/agent'
|
||||
import { useAgentStore, useProjectStore } from '@/stores'
|
||||
import lightIcon from '@/assets/images/light-icon.png'
|
||||
import closeIcon from '@/assets/images/close-icon.png'
|
||||
import { createProject } from '@/api/agent'
|
||||
// import Tag from './Tag.vue'
|
||||
|
||||
const router = useRouter()
|
||||
const agentStore = useAgentStore()
|
||||
const projectStore = useProjectStore()
|
||||
|
||||
const props = withDefaults(
|
||||
defineProps<{
|
||||
isAgentMode?: boolean
|
||||
generating?: boolean
|
||||
}>(),
|
||||
{
|
||||
isAgentMode: false
|
||||
isAgentMode: false,
|
||||
generating: false
|
||||
}
|
||||
)
|
||||
|
||||
const emits = defineEmits(['send'])
|
||||
const emits = defineEmits(['send', 'pause'])
|
||||
|
||||
const { t } = useI18n()
|
||||
|
||||
@@ -424,7 +432,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
const handleSendAgent = () => {
|
||||
const handleSendAgent = async () => {
|
||||
if (props.generating) {
|
||||
emits('pause')
|
||||
return
|
||||
}
|
||||
if (!inputValue.value.trim()) return
|
||||
emits('send', { text: inputValue.value.trim(), images: uploadedImages.value })
|
||||
// 发送后清空输入框
|
||||
@@ -499,21 +511,22 @@
|
||||
}))
|
||||
)
|
||||
|
||||
const handleCreateProject = () => {
|
||||
const handleCreateProject = async () => {
|
||||
// 这里可以添加创建项目的逻辑
|
||||
const params = {
|
||||
type: typeValue.value,
|
||||
area: areaValue.value,
|
||||
style: styleValue.value
|
||||
style: styleValue.value,
|
||||
temperature: 0.7
|
||||
}
|
||||
|
||||
const projectres = await createProject(params)
|
||||
console.log('projectres', projectres)
|
||||
projectStore.setId(projectres)
|
||||
// 保存初始数据到 store
|
||||
agentStore.setInitialProjectData({
|
||||
text: inputValue.value.trim(),
|
||||
images: uploadedImages.value,
|
||||
type: typeValue.value,
|
||||
area: areaValue.value,
|
||||
style: styleValue.value
|
||||
...params
|
||||
})
|
||||
|
||||
console.log('Create project with:', params)
|
||||
@@ -736,10 +749,21 @@
|
||||
.right {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.sender-icon {
|
||||
.sender-btn {
|
||||
width: 3.2rem;
|
||||
height: 3.2rem;
|
||||
cursor: pointer;
|
||||
background-color: #ff7a51;
|
||||
border-radius: 50%;
|
||||
.sender-icon {
|
||||
width: 1.3rem;
|
||||
height: 1.3rem;
|
||||
}
|
||||
.sender-pause {
|
||||
width: 1rem;
|
||||
height: 1rem;
|
||||
background-color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user