Skip to content

Conversation

@wan-kong
Copy link

@wan-kong wan-kong commented Dec 9, 2025

🎯 Changes

βœ… Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm run test:pr.

πŸš€ Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

add docs for @tanstack/ai-vue

<div v-for="part in message.parts" :key="part.id">
<span v-if="part.type === 'text'">{{ part.content }}</span>
<div v-else-if="part.type === 'thinking'">
<div class="text-sm text-gray-500 italic">πŸ’­ Thinking: {{ part.content }}</div>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could potentially be merged with wrapper div

const handleSubmit = (e: Event) => {
const val = input.value.trim()
if (((val ?? '') !== '') && !isLoading) {
sendMessage(input.value);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we would need e.target.reset() as well to clear the form on submit.

const notification = ref<string | null>(null);

// Create client tool implementations,
const updateUI = updateUIDef.client((input) => {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what is the purpose of this tool. Maybe it makes sense in React to set state causing a re-render, but in Vue it would do nothing as notification ref is not used anywhere.

@AlemTuzlak Was original React intention just to cause a re-render?

createChatClientOptions,
type InferChatMessages
} from "@tanstack/ai-client";
import { updateUIDef } from "@/tools/definitions";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This tool def seems to be buried in one of the other pages, maybe in-lining it would be wise?
Or at least a link to this tool definition?
@AlemTuzlak


```typescript
interface UseChatReturn {
messages: UIMessage[];

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is actually a DeepReadonly<ShallowRef<Array<UIMessage>>>

}) => Promise<void>;
reload: () => Promise<void>;
stop: () => void;
isLoading: boolean;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isLoading: DeepReadonly<ShallowRef<boolean>>

reload: () => Promise<void>;
stop: () => void;
isLoading: boolean;
error: Error | undefined;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error: DeepReadonly<ShallowRef<Error | undefined>>

} from "@tanstack/ai-client";
import { updateUIDef, saveToStorageDef } from "@/tools/definitions";

const notification = ref<{message: string; type: 'success' | 'error'}>(null);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure what for notification is used in this example

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

Successfully merging this pull request may close these issues.

2 participants