
Company News
Socket Named Top Sales Organization by RepVue
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.
@hd-front-end/ai-assistant-sdk-vue2
Advanced tools
AI助手SDK的Vue 2版本,提供完整的AI对话、数据可视化和页面交互能力。
$_hdAiCommands选项优雅地注册AI命令pnpm add @hd-front-end/ai-assistant-sdk-vue2
pnpm add @vue/composition-api
Vue 2.7已内置Composition API。
适用于TypeScript 4.0+、vue-class-component v7+的项目。
// main.ts - 注册插件
import Vue from 'vue';
import { AIAssistantPlugin } from '@hd-front-end/ai-assistant-sdk-vue2';
Vue.use(AIAssistantPlugin, {
apiUrl: 'http://localhost:8080/api/chat',
botId: 'your-bot-id'
});
// 组件中使用Composable API
import { useAIChat } from '@hd-front-end/ai-assistant-sdk-vue2/composable';
export default {
setup() {
const { chatList, isLoading, sendMessage } = useAIChat();
return {
chatList,
isLoading,
sendMessage
};
}
};
适用于TypeScript 3.0+、vue-class-component v6的项目。
// main.ts - 注册插件
import Vue from 'vue';
import { AIAssistantPlugin } from '@hd-front-end/ai-assistant-sdk-vue2';
Vue.use(AIAssistantPlugin, {
apiUrl: 'http://localhost:8080/api/chat',
botId: 'your-bot-id'
});
// 组件中使用Mixin API
import { AiChatMixin } from '@hd-front-end/ai-assistant-sdk-vue2/mixin';
export default {
mixins: [AiChatMixin],
// 声明式注册AI命令
$_hdAiCommands: {
'navigation.nextPage': function(params) {
this.$router.push({ name: 'nextPage' });
},
'data.export': function(params) {
this.exportData(params.format);
}
},
methods: {
async handleSend() {
await this.$_hdAi_sendMessage('你好');
}
}
};
通过$_hdAiCommands选项优雅地注册AI命令:
export default {
mixins: [AiChatMixin],
$_hdAiCommands: {
// 命令会自动绑定this到组件实例
'navigation.go': function(params: { page: string }) {
this.$router.push({ name: params.page });
},
'data.refresh': function() {
this.loadData();
}
},
methods: {
loadData() {
// 业务逻辑
}
}
};
优势:
:root {
--hd-ai-primary-color: #1890ff;
--hd-ai-border-radius: 4px;
--hd-ai-spacing-unit: 8px;
}
// 在项目的全局SCSS文件中
$hd-ai-primary-color: $--color-primary; // 映射到Element UI主色
@import "~@hd-front-end/ai-assistant-sdk-vue2/src/assets/styles/variables";
详细API文档请参考:API Documentation
MIT
FAQs
AI Assistant SDK for Vue 2 with TypeScript
We found that @hd-front-end/ai-assistant-sdk-vue2 demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 4 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Socket won two 2026 Reppy Awards from RepVue, ranking in the top 5% of all sales orgs. AE Alexandra Lister shares what it's like to grow a sales career here.

Security News
NIST will stop enriching most CVEs under a new risk-based model, narrowing the NVD's scope as vulnerability submissions continue to surge.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.