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 { return {
state, state,
setProject, setProject,
setId
} }
}) })

View File

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