open-index/open-npm huggingface dataset:
npm package: @happydl123/vue-chat-utils
Description: Vue 3 composable for managing chat state with SSE streaming and JSON patch synchronization
Author: happydl123
Latest version: 1.0.0

# @happydl123/vue-chat-utils

A TypeScript Vue 3 composable for managing chat state with Server-Sent Events (SSE) streaming and JSON Patch synchronization.

## Features

- 🚀 **Vue 3 Composition API** - Built with modern Vue 3 composables
- 📡 **SSE Streaming** - Real-time chat updates via Server-Sent Events
- 🔄 **JSON Patch Sync** - Efficient state synchronization using JSON Patch operations
- 📘 **TypeScript Support** - Full type safety and IntelliSense
- ⚡ **Reactive State** - Seamless integration with Vue's reactivity system
- 🛡️ **Error Handling** - Comprehensive error handling and recovery
- 🎛️ **Configurable** - Flexible configuration options for different use cases

## Installation

```bash
npm install @happydl123/vue-chat-utils
```

## Usage

### Basic Usage

...


## JSON Patch Support

This library uses JSON Patch operations to synchronize chat state. Currently supports:

- **`add`** - Adds values to objects and arrays

### Expected Server Response Format

The server should send Server-Sent Events with JSON Patch operations:

```
data: {"op": "add", "path": "/messages", "value": []}
data: {"op": "add", "path": "/messages/-", "value": {"id": "msg-1", "role": "user", "contents": []}}
data: {"op": "add", "path": "/messages/0/contents/-", "value": {"id": "content-1", "type": "text", "content": []}}
data: {"op": "add", "path": "/messages/0/contents/0/content/-", "value": "Hello"}
data: [DONE]
```

### Error Handling

For errors, the server should send:

```
event: error
data: {"error": "Error message here"}
```

## TypeScript Support

This package includes full TypeScript definitions. All interfaces and types are exported for use in your application:

```typescript
import { 
  useChat, 
  UseChatOptions, 
  UseChatReturn, 
  ChatStatus, 
  JsonPatchOperation 
} from '@happydl123/vue-chat-utils';
```

## Requirements

- Vue 3.0.0 or higher
- TypeScript support (optional but recommended)

## License

MIT

## Contributing

Issues and pull requests are welcome! Please visit the [GitHub repository](https://github.com/happydl123/vue-chat-utils) to contribute.

## Publish command:

npm publish --access public