feat: projectID设置

This commit is contained in:
2026-02-24 14:28:25 +08:00
parent e12bd75e17
commit 37cedb5272
2 changed files with 9 additions and 3 deletions

View File

@@ -13,8 +13,13 @@ export const useProjectStore = defineStore('project', () => {
}
}
const setId = id=>{
state.value.id = id
}
return {
state,
setProject,
setId
}
})

View File

@@ -20,12 +20,12 @@
import Input from '../../components/Input.vue'
import { fetchAgentReply } from '@/api/agent'
import type { AgentParamsType } from '@/api/agent'
import { useUserInfoStore } from '@/stores'
import { useUserInfoStore,useProjectStore } from '@/stores'
import { useAgentStore } from '@/stores/agent'
const userStore = useUserInfoStore()
const agentStore = useAgentStore()
const projectStore = useProjectStore()
const props = withDefaults(
defineProps<{
title: string
@@ -38,7 +38,7 @@
const messageList = ref([])
const listRef = ref()
const params = reactive<AgentParamsType>({
projectID: '',
projectID: '1',
message: '',
token: userStore.state.token,
versionID: '',
@@ -59,6 +59,7 @@
onMounted(() => {
// 检查 store 中是否有初始项目数据
projectStore.setId('1') // 临时设置项目ID为1实际应用中应根据上下文动态设置
const initialData = agentStore.getInitialProjectData
if (initialData) {
// 等待页面渲染完成后自动发送初始消息