Go to file
2025-08-31 10:09:01 +08:00
assets/css feat(init): 初始化远程组件项目 2025-08-19 18:15:28 +08:00
build/vite-plugins feat(AppGuide): 新增应用指南组件 2025-08-30 14:56:20 +08:00
components 优化数据,增加默认的插件前缀 2025-08-31 01:39:07 +08:00
composables 优化数据,增加默认的插件前缀 2025-08-31 01:39:07 +08:00
docs/images 更新使用说明 2025-08-31 10:09:01 +08:00
manifest 优化数据,增加默认的插件前缀 2025-08-31 01:39:07 +08:00
modules fix(manifest): 修改manifest.js文件生成位置,从.nuxt移动至public目录下 2025-08-28 15:21:11 +08:00
public feat(init): 初始化远程组件项目 2025-08-19 18:15:28 +08:00
scripts feat(init): 初始化远程组件项目 2025-08-19 18:15:28 +08:00
server 优化数据,增加默认的插件前缀 2025-08-31 01:39:07 +08:00
types fix(manifest): 新增首页的动态组件 2025-08-29 18:02:27 +08:00
utils feat(manifest): 删除无用文件 2025-08-20 15:15:41 +08:00
.gitignore feat(init): 初始化远程组件项目 2025-08-19 18:15:28 +08:00
app.vue feat(AppGuide): 新增应用引导组件 2025-08-30 15:00:30 +08:00
eslint.config.mjs feat(init): 初始化远程组件项目 2025-08-19 18:15:28 +08:00
nuxt.config.ts 优化数据,增加默认的插件前缀 2025-08-31 01:39:07 +08:00
package.json 优化数据,增加默认的插件前缀 2025-08-31 01:39:07 +08:00
pm2.config.js 优化数据,增加默认的插件前缀 2025-08-31 01:39:07 +08:00
pnpm-lock.yaml feat(remote-ui): 去除远程组件包裹,构建时注入class, 生产环境构建去除主题样式 2025-08-20 12:15:25 +08:00
README.md 更新使用说明 2025-08-31 10:09:01 +08:00
tailwind.config.js feat(remote-ui): 去除远程组件包裹,构建时注入class, 生产环境构建去除主题样式 2025-08-20 12:15:25 +08:00
tsconfig.json feat(init): 初始化远程组件项目 2025-08-19 18:15:28 +08:00

EasyAI 插件开发脚手架

项目介绍

本项目支持以插件的方式为EasyAI平台提供组件服务以实现对EasyAI平台前端组件库进行扩展实现自定义组件以满足业务需求。

功能描述和核心功能

  • 支持扩展AI应用封装组件库。例如提示词、图像上传等各种组件还可以访问自己的私有化数据库等
  • 支持扩展首页组件库。例如设计新的应用展示模块等其他各种功能。
  • 支持应用引导组件库
  • typescript类型支持

组件开发

项目启动

  1. 安装依赖
pnpm install
  1. 启动项目
pnpm dev
  1. 访问地址:http://localhost:3201
  2. 组件目录components
  3. 维护组件信息目录manifest
  4. 组件调试入口: app.vue
  5. EasyAI平台全局注入的数据和方法: types/common.ts
    1. 注入的素材库数据GlobalInjectMaterials
      • mock数据composables/mock/material.data.ts
      • 在组件中使用components/RecommendedImages.vue
        const { materials: materialList } =
            inject<GlobalInjectMaterials>(GlobalInjectKeyConst.AllMaterials, {
            materials: ref<IImageSource>([]),
            }) || {};
        
    2. 注入的上传文件方法GlobalInjectUploadFileToOSS
      • 在组件中使用components/drawPanne/ImageUpload.vue
        const { useUtilsUploadFileToOSS } = inject<GlobalInjectUploadFileToOSS>(
            GlobalInjectKeyConst.UploadFileToOSS,
            {
             useUtilsUploadFileToOSS: async (file: File | Blob, filename?: string) => "",
            },
         );
        
    3. 其他注入数据用户信息、会员信息、具有权限的APP应用信息公开的作品列表等

示例组件 (图片上传组件)

  1. 组件位置components/drawPanne/ImageUpload.vue
    正常的nuxt(vue3)项目组件开发直接在components文件夹下创建即可
  2. 维护组件信息文件manifest/ImageUpload.ts
    需要参照IComponentMateInfo类型约束文件进行定义
export default {
    name: "DrawImageUpload", // 组件名称
    path: "./components/drawPanne/ImageUpload.vue", // 组件路径
    scenes: ComponentSceneConst.DrawPanne, // 组件场景
    description: "A image upload component", // 组件描述
    data: { // 组件数据
        paramName: "upload_image_path", // 参数名称
        label: "图片上传", // 组件标签
        icon: "icon-park:upload-picture", // 组件图标
        group: ComponentGroupConst.IMAGE, // 组件分组
        isRefComponent: true, // 是否为引用组件 (引用组件,在执行绘画的时候会执行参数赋值操作)
    },
} satisfies IComponentMateInfo;
  1. 组件调试入口app.vue
<template>
  <div class="remote-ui">
    <!--    调试对象-->
    <DrawPanneImageUpload />
  </div>
</template>
<script lang="ts" setup>
import {
  GlobalInjectKeyConst,
  type GlobalInjectMaterials,
} from "~/types/common";
import { MockMaterials } from "~/composables/mock/material.data";

const materialData = ref(MockMaterials);
/**
 * EasyAI平台已全局注入素材库库信息这里开发环境使用mock数据用于调试
 */
provide<GlobalInjectMaterials>(GlobalInjectKeyConst.AllMaterials, {
  materials: materialData,
  refreshMaterials: async () => [],
});
</script>

测试环境部署

  1. 打包
pnpm build
  1. 启动项目
pnpm serve
  1. 访问
http://localhost:3200

生产环境部署

  1. 打包
pnpm build
  1. 复制构建产物目录.outputpm2.config.js到服务器
  2. 在服务器上安装node、pm2具体安装方式请自行搜索
  3. 使用nginx代理项目/plugins/ 路由到项目端口3020

使用

  • 在EasyAI平台上使用插件可以在应用设置-高级配置-应用详情页展示,搭建页面和自定义页面样式三个场景下使用插件) 远程组件管理

应用使用指导详情页