This commit is contained in:
hailin 2025-06-23 13:32:21 +08:00
parent 2a36e7e08a
commit 54306ea870
2 changed files with 5 additions and 11 deletions

View File

@ -19,11 +19,11 @@ const initialUIState: {
component: React.ReactNode
}[] = []
const AIProvider = createAI({
export const AI = createAI({
actions: {
submit: async function(formData?: FormData, skip?: boolean) {
'use server'
const aiState = getMutableAIState<typeof AIProvider>()
const aiState = getMutableAIState<typeof AI>()
const uiStream = createStreamableUI()
const isGenerating = createStreamableValue(true)
const messages: ExperimentalMessage[] = aiState.get() as any
@ -92,5 +92,3 @@ const AIProvider = createAI({
initialUIState,
initialAIState
})
export default AIProvider

View File

@ -1,6 +1,6 @@
import type { Metadata, Viewport } from 'next'
import { Inter as FontSans } from 'next/font/google'
import AIProvider from './action' // ✅ default 导入
import { AI } from './action' // 注意,导入的是 { AI },不是 AIProvider
import '../../globals.css'
import { cn } from '@/lib/utils'
import { ThemeProvider } from '@/components/mpv2/theme-provider'
@ -52,10 +52,6 @@ export default function RootLayout({
disableTransitionOnChange
>
{/* <Header /> */}
<AIProvider>
<AI>
{children}
</AIProvider>
{/* <Footer /> */}
</ThemeProvider>
)
}
</AI>