English | 简体中文
一个轻量级的 Vue.js 插件,用于处理 AI 大模型的流式响应(SSE)。
✨ 流式响应 - 完整的 SSE 支持
💬 实时更新 - 即时获取 AI 回复
🔄 请求管理 - 支持取消请求
🔐 自动认证 - 自动添加 Token
⚡ 轻量高效 - 零依赖
🎯 易于使用 - 简洁的 API
npm install vue-ai-stream-helper// main.js
import Vue from 'vue';
import AIStreamHelper from 'vue-ai-stream-helper';
Vue.use(AIStreamHelper, {
baseURL: 'https://your-api.com',
endpoint: '/api/chat',
getToken: () => localStorage.getItem('token')
});<script>
export default {
methods: {
async chat() {
await this.$aiChat.chat({
content: '你好',
onMessage: ({ fullContent }) => {
console.log(fullContent);
}
});
}
}
}
</script>详细文档请查看 README.md 和 EXAMPLES.md
MIT