feat: align controlled AI sessions and MVP controls

This commit is contained in:
2026-07-21 19:19:36 +08:00
parent 8767446b78
commit 122f5d8c52
18 changed files with 758 additions and 468 deletions

View File

@@ -1,8 +1,9 @@
import { useRef, useState } from 'react'
import { useCallback, useRef, useState } from 'react'
import { ConfigProvider, Message, Spin } from '@arco-design/web-react'
import '@arco-design/web-react/dist/css/arco.css'
import '../App.css'
import { ApiError, login, setApiBaseUrl, type ApiSession } from '../api/client'
import { createAISession, listAISessions, type CreateAISessionInput } from '../api/ai'
import { analyzeInboxItem, confirmInboxItem } from '../api/inbox'
import { mapWorkspace } from '../api/mappers'
import {
@@ -43,6 +44,16 @@ function App() {
const [searchResultPreview, setSearchResultPreview] = useState<SearchResultDTO | null>(null)
const workspaceSearch = useWorkbenchSearch(session)
const handleListAISessions = useCallback((projectId: string) => {
if (!session) return Promise.reject(new Error('未登录'))
return listAISessions(session, projectId)
}, [session])
const handleCreateAISession = useCallback((projectId: string, input: CreateAISessionInput) => {
if (!session) return Promise.reject(new Error('未登录'))
return createAISession(session, projectId, input)
}, [session])
const dark = theme === 'dark'
const activeWorkspace = workspaces.find((workspace) => workspace.project.id === activeProjectID) ?? workspaces[0]
const activeTagOptions = activeWorkspace?.tags.filter((tag) => tag !== 'all' && tag !== '全部') ?? []
@@ -346,6 +357,8 @@ function App() {
onSelectSearchResult={handleSelectSearchResult}
onAnalyzeInbox={handleAnalyzeInbox}
onConfirmInbox={handleConfirmInbox}
onListAISessions={handleListAISessions}
onCreateAISession={handleCreateAISession}
/>
) : (
<Spin loading />