Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nuxt: Updating AI SDK from 3.0.19 to later causes error in useChat #1344

Closed
dosstx opened this issue Apr 14, 2024 · 1 comment
Closed

Nuxt: Updating AI SDK from 3.0.19 to later causes error in useChat #1344

dosstx opened this issue Apr 14, 2024 · 1 comment

Comments

@dosstx
Copy link
Contributor

dosstx commented Apr 14, 2024

Description

Nuxt app works fine with ai@3.0.19 . However, updating to latest AI SDK causes the following browser error (shown via the onError callback in useChat):

Error

Failed to parse stream string. Invalid code

Reverting to ai@3.0.19 is the last version that works before the above error begins to show starting at version 3.0.20.

Code example

const {
	messages,
	input,
	handleSubmit,
	setMessages,
	reload,
	isLoading,
	stop,
	append
} = useChat({
	api: config.public.chatUrl,
	headers: { "Content-Type": "application/json" },
	body: agent,
	onError: (error) => {
		isLoading.value = false
		console.log("onError from useChat: ", error)
		errorMessage.value = error
	}
})

Additional context


  • Operating System: Windows_NT
  • Node Version: v18.18.0
  • Nuxt Version: 3.11.2
  • CLI Version: 3.11.1
  • Nitro Version: 2.9.6
  • Package Manager: npm@9.8.1
  • Builder: -
  • User Config: routeRules, devtools, nitro, modules, eslint, runtimeConfig, vuefire, image
  • Runtime Modules: @nuxt/ui@2.15.2, @nuxt/image@1.5.0, @pinia/nuxt@0.5.1, @pinia-plugin-persistedstate/nuxt@1.2.0, nuxt-vuefire@1.0.2, @vueuse/nuxt@10.9.0, @nuxt/eslint@0.3.6, @nuxt/content@2.12.1, @nuxt/fonts@0.6.1
  • Build Modules: -

@lgrammel
Copy link
Collaborator

Duplicate of #1316

See #1316 (comment) for upgrade instructions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants