# ldesign-ai **Repository Path**: ldesign-v1/ldesign-ai ## Basic Information - **Project Name**: ldesign-ai - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-10-18 - **Last Updated**: 2026-11-02 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # LDesign AI `@composy/ai-core` 定义与模型供应商无关的聊天、流式输出、取消请求和工具调用协议,并提供 OpenAI-compatible HTTP 适配器。`@composy/ai-vue` 提供轻量的响应式聊天 composable。 ## 安全边界 模型服务密钥应保存在可信服务端。浏览器应用应调用自己的认证后端;HTTP provider 支持按需读取密钥,不会把凭据写入浏览器存储。 ## 安装 ```sh pnpm add @composy/ai-core pnpm add @composy/ai-vue vue ``` ## 流式聊天 ```ts import { createAIClient, createOpenAICompatibleProvider } from '@composy/ai-core' const client = createAIClient([ createOpenAICompatibleProvider({ baseUrl: '/api/ai/v1' }), ]) for await (const event of client.stream('openai-compatible', { model: 'assistant', messages: [{ role: 'user', content: '总结这份文档。' }], })) { if (event.type === 'text-delta') render(event.text) } ``` 编辑器选区、提示词编辑和界面交互仍属于 `libraries/editor`;本包只承载可复用的模型请求协议与传输适配。