Skip to content

Commit be81889

Browse files
committed
Merge branch 'release'
2 parents c479d5e + dfe6472 commit be81889

File tree

625 files changed

+25561
-12529
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

625 files changed

+25561
-12529
lines changed

.github/workflows/app-platform-java-compile.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ on:
44
push:
55
branches:
66
- 'main'
7+
- 'develop'
78
paths:
89
- 'app-builder/**'
910
- '!app-builder/fel/python/**'
@@ -17,6 +18,7 @@ on:
1718
pull_request:
1819
branches:
1920
- 'main'
21+
- 'develop'
2022
paths:
2123
- 'app-builder/**'
2224
- '!app-builder/fel/python/**'

README.md

Lines changed: 83 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# AppPlatform
22

3-
**AppPlatform 是一个前沿的大模型应用工程,旨在通过集成的声明式编程和低代码配置工具,简化和优化大模型的训练与推理应用的开发过程。本工程为软件工程师和产品经理提供一个强大的、可扩展的环境,以支持从概念到部署的全流程 AI 应用开发。**
3+
**AppPlatform 是一个前沿的大模型应用工程,旨在通过集成的声明式编程和低代码配置工具,简化 AI 应用的开发过程。本工程为软件工程师和产品经理提供一个强大的、可扩展的环境,以支持从概念到部署的全流程 AI 应用开发。**
44
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](https://opensource.org/license/MIT)
55
[![JDK](https://img.shields.io/badge/JDK-17-green.svg)](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html)
66
[![Node](https://img.shields.io/badge/node-20-red.svg)](https://nodejs.org/en/download)
@@ -24,6 +24,25 @@
2424
3. **共享与协作**: AppPlatform 的底层包含 Store 模版,用于将所有开发的 AI 应用统一存储,以此支持跨项目的复用和协作。开发者可以根据需要组合这些应用,打造更大的解决方案,或者利用社区提供的工具和模型。在 AppPlatform 中, AI 应用不仅限于传统意义上的 “应用”,它们可以是 “函数”、“RAG”、“智能体”等任何可解释和可执行的组件。这些组件在 Store 中以 “工具” 的形式展现,其元数据不仅提供了必要的解释,还为智能体自动调度这些工具提供了基础。
2525

2626
---------
27+
28+
## 安装数据库
29+
30+
### Windows 系统
31+
32+
- 下载并安装 [PostgresSQL](https://www.postgresql.org/download/)
33+
- 初始化数据。进入 `shell` 目录,使用 `bash` 工具执行 `build_win.sh`(当前不支持 `cmd` 执行,待规划):
34+
35+
```
36+
cd shell
37+
sh build_win.sh ${ip} ${port} ${username} ${password}
38+
```
39+
40+
其中参数 ip、port、username、password 分别指的是数据库主机地址、数据库端口、数据用户名、数据库密码。该文件会初始化数据库内置数据,以及人工表单功能所需的数据。
41+
42+
### Linux 系统
43+
44+
待规划
45+
2746
## 后端环境配置
2847

2948
开发环境配置
@@ -32,7 +51,7 @@
3251
- Java 17
3352
- 代码格式化文件:[CodeFormatterFromIdea.xml](CodeFormatterFromIdea.xml)
3453
- `Maven` 配置:推荐版本 Maven 3.8.8+
35-
- FIT 框架编译产物(链接待补充)
54+
- FIT 框架编译产物:参考 [FIT 框架](https://github.com/ModelEngine-Group/fit-framework)`环境配置`构建编译产物
3655

3756
**构建命令**
3857

@@ -52,6 +71,39 @@ build/
5271

5372
> 后端模块基于 [FIT](https://ModelEngine-Group/fit-framework) 框架,启动方式采用了 [FIT 动态插件](https://github.com/ModelEngine-Group/fit-framework/blob/main/docs/framework/fit/java/quick-start-guide/03.%20%E4%BD%BF%E7%94%A8%E6%8F%92%E4%BB%B6%E7%9A%84%E7%83%AD%E6%8F%92%E6%8B%94%E8%83%BD%E5%8A%9B.md) 方式。
5473
74+
打开框架输出目录的 `conf/fitframework.yml` 文件,找到如下配置项
75+
76+
```yml
77+
fit:
78+
beans:
79+
packages:
80+
- 'modelengine.fitframework'
81+
- 'modelengine.fit'
82+
```
83+
84+
加入数据库配置项,修改后的配置项如下所示:
85+
86+
```yml
87+
fit:
88+
beans:
89+
packages:
90+
- 'modelengine.fitframework'
91+
- 'modelengine.fit'
92+
datasource:
93+
primary: 'sample-datasource' # 表示所选用的示例数据源。
94+
instances:
95+
sample-datasource:
96+
mode: 'shared' # 表示该数据源的模式,可选共享(shared)或独占(exclusive)模式。
97+
url: 'jdbc:postgresql://${ip}:${port}/' # 将 ip 换成数据库服务器的 ip 地址,将 port 换成数据库服务器监听的端口。
98+
username: '${username}' # 将 username 替换为数据库的名称。
99+
password: '${password}' # 将 password 替换为数据库的密码。
100+
druid:
101+
initialSize: ${initialSize} # 将 initialSize 替换为连接池的初始化连接数。
102+
minIdle: ${midIdle} # 将 minIdle 替换为连接池的最小空闲连接数。
103+
maxActive: ${maxActive} # 将 maxActive 替换为数据库连接池的最大活动连接数。
104+
# 可根据具体需求,添加连接池所需配置项。
105+
```
106+
55107
**启动命令**
56108

57109
```
@@ -70,7 +122,22 @@ fit start -Dfit.profiles.active=prod
70122

71123
- 环境要求:node.js >= 20
72124

125+
- ELSA 框架编译产物:参考 [ELSA](https://github.com/ModelEngine-Group/fit-framework/blob/main/framework/elsa/README.md) 的编译构建章节
126+
127+
**修改 ELSA 依赖地址**
128+
129+
进入目录 `app-engine\frontend` ,搜索 `package.json` 文件的 ELSA 依赖地址:
130+
131+
```
132+
"dependencies": {
133+
"@fit-elsa/elsa-core": "file:${fitElsaCoreUrl}",
134+
"@fit-elsa/elsa-react": "file:${fitElsaReactUrl}",
135+
```
136+
137+
`${fitElsaCoreUrl}``${fitElsaReactUrl}` 分别改成 `ELSA` 框架编译产物 `fit-elsa-core``fit-react` 的目录地址即可。
138+
73139
**修改代理文件**
140+
74141
修改 `AppPlatform/frontend` 目录下的 `proxy.config.json` 文件,可以修改需要访问的后端地址。如本地后端地址是 `http://127.0.0.1:8080` 。可以按照如下示例配置:
75142

76143
```json
@@ -89,13 +156,7 @@ fit start -Dfit.profiles.active=prod
89156
**依赖安装**
90157

91158
```
92-
cd framework/elsa/fit-elsa
93-
npm install
94-
npm run build:debug
95-
cd ../fit-elsa-react/
96-
npm install
97-
npm run build
98-
cd ../../../app-engine/frontend/
159+
cd app-engine/frontend/
99160
npm install
100161
```
101162

@@ -113,7 +174,19 @@ npm run start
113174
---------
114175
## 快速开始
115176

116-
**待完善**
177+
**模型配置**
178+
179+
在对话中使用大模型功能,需要对模型进行配置,包括大模型的地址和鉴权信息。
180+
首先在首页的`应用市场`一栏中找到 `模型配置应用`,并点击该应用。点击右上角`创意灵感``开始配置`,如下图所示:
181+
![image-20250508203127410](doc\images\readme\model_config_inspiration.png)
182+
然后点击回答的 `添加模型` 按钮,输入模型名称、API Key 和模型地址,并点击确认。此时模型添加成功。
183+
184+
**应用创建**
185+
186+
在首页的`应用开发`一栏中点击`创建空白应用`。如下所示:
187+
![image-20250508204618312](doc\images\readme\app_create.png)
188+
输入所要创建的应用名称和简介,并点击 `创建`按钮,即可创建 AI 应用。接着在跳转后的应用配置页面上,在 `大模型` 一栏中选择自定义配置的模型。此时即可在对话框进行对话。如下所示:
189+
![image-20250508205124203](doc\images\readme\app_chat.png)
117190

118191
## 文档
119192

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package-lock.json
2+
node_modules/
3+
output/
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
strict-ssl=false
2+
package-lock=true
3+
registry=https://registry.npmjs.org/
Lines changed: 173 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,173 @@
1+
# 画布 # 自定义组件开发说明
2+
3+
## 前提条件
4+
5+
* 开发工具建议使用 VSCode
6+
7+
* 基础环境: Node.js 版本 >= 18, npm 版本 >= 10
8+
9+
* React 组件建议使用 Ant Design (版本: 4.24.13)
10+
11+
## 操作步骤
12+
13+
### 约束条件
14+
15+
上传的组件包必须是 zip 压缩包,解压后文件大小不得超过 5M,且必须包含三部分:
16+
17+
* build 文件夹: 表单代码打包后的静态资源
18+
19+
* config.json: 表单的输入输出参配置文件
20+
21+
* form.jpg/png/jpeg: 表单预览图,大小不得超过 1M
22+
23+
## 开发组件代码
24+
25+
### 创建文件
26+
27+
*`/src/components` 目录下创建 `.tsx` 类型的组件文件
28+
29+
### 表单获取流程数据
30+
31+
用于初始化表单数据:
32+
33+
```tsx
34+
const { data, terminateClick, resumingClick, restartClick } = useContext(DataContext);
35+
```
36+
37+
`data` 为 json 数据,结构与 config.json 的输入参配置一致
38+
39+
### 表单调用内置接口
40+
41+
**1. 终止对话 `terminateClick()`**
42+
43+
```tsx
44+
<Button onClick={onTerminateClick}>终止对话</Button>
45+
46+
const onTerminateClick = () => {
47+
terminateClick({ content: "终止会话" });
48+
}
49+
```
50+
51+
**注意:结束节点不能调用 `terminateClick`**
52+
53+
**2. 继续对话 `resumingClick()`**
54+
55+
```tsx
56+
<Button onClick={onResumeClick}>继续对话</Button>
57+
58+
const onResumeClick = () => {
59+
resumingClick({ params: { a: "hello", b: 1 } });
60+
}
61+
```
62+
63+
**注意:结束节点不能调用 `resumingClick`**
64+
65+
**3. 重新对话 `restartClick()`**
66+
67+
```tsx
68+
<Button onClick={onRestartClick}>重新对话</Button>
69+
70+
const onRestartClick = () => {
71+
restartClick({ params: { a: "hello", b: 1 } });
72+
}
73+
```
74+
75+
**注意:如果在智能表单节点使用,需先调 `terminateClick``restartClick`**
76+
77+
### 调用外部接口
78+
79+
* 要求接口支持跨域
80+
81+
### 使用图片
82+
83+
* 图片文件放在 `/src/assets/images`
84+
85+
* 路径: `./src/assets/images/xxx.png`
86+
87+
```tsx
88+
<img src="./src/assets/images/empty.png" alt="" height="100px" width="100px"/>
89+
```
90+
91+
### 表单样式文件
92+
93+
* 可以在 `/src/styles` 目录下添加 `.scss` 样式文件
94+
95+
### 调试表单
96+
97+
```bash
98+
npm install
99+
npm start
100+
```
101+
102+
* 模拟数据 `app.tsx`:
103+
104+
```ts
105+
receiveData: {
106+
data: { a: "你好", b: "Demo1" },
107+
uniqueId: 10,
108+
origin: "http://127.0.0.1:3350",
109+
tenantId: "fh47kl"
110+
}
111+
```
112+
113+
### 打包
114+
115+
```bash
116+
npm run build
117+
```
118+
119+
## 表单输入输出参 config.json
120+
121+
### 基础规范
122+
123+
* 格式需符合[json schema规范](https://json-schema.apifox.cn/)
124+
125+
* 格式示例:
126+
127+
```json
128+
{
129+
"schema": {
130+
"parameters": {
131+
"type": "object",
132+
"required": ["a", "b"],
133+
"properties": {
134+
"a": { "type": "string", "default": "haha" },
135+
"b": { "type": "string", "default": "heihei" }
136+
}
137+
},
138+
"return": {
139+
"type": "object",
140+
"properties": {
141+
"a": { "type": "string" },
142+
"b": { "type": "string" }
143+
}
144+
}
145+
}
146+
}
147+
```
148+
149+
* 最外层 `parameters` 字段是入参,入参第一层必须 `type``object`
150+
151+
* 必须包含 `name`,支持中文、英文、数字、空格、中划线、下划线组合。
152+
153+
* 可以包含 `description`,对参数进行描述。
154+
155+
* 必须包含 `parameters`
156+
157+
* 必须包含 `required`,内容不可以为 `properties` 下参数名之外的参数名。
158+
159+
* 可以包含 `order`,若写必须为 `properties` 下所有参数名的列表;若不写,则默认按照 `properties` 下所有参数名的顺序。
160+
161+
* 必须包含 `return``return` 字段是出参。
162+
163+
## 表单预览图
164+
165+
* 名称: form.jpg/png/jpeg
166+
167+
* 大小: 不超过 1M
168+
169+
## 打包规则
170+
171+
* 包含 build/、config.json、form.png
172+
173+
* 将build文件夹、config.json、form.png打成zip压缩包,压缩包名称支持大小写英文、中文和数字的字符串,可以包含中划线(-)和下划线(_),但不能以中划线(-)和下划线(_)开头或结尾。
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
{
2+
"schema": {
3+
"name": "模型管理表单",
4+
"parameters": {
5+
"type": "object",
6+
"required": ["models"],
7+
"properties": {
8+
"models": {
9+
"type": "array",
10+
"items": {
11+
"type": "object",
12+
"properties": {
13+
"createdAt": { "type": "string" },
14+
"modelName": { "type": "string" },
15+
"modelId": { "type": "string" },
16+
"baseUrl": { "type": "string" },
17+
"isDefault": { "type": "integer" },
18+
"userId": { "type": "string" }
19+
},
20+
"required": ["modelId", "isDefault", "userId"]
21+
}
22+
}
23+
}
24+
},
25+
"return": {
26+
"type": "object",
27+
"properties": {
28+
"action": {
29+
"type": "string",
30+
"enum": ["add", "delete", "switch", "quit"]
31+
},
32+
"info": {
33+
"type": "object",
34+
"properties": {
35+
"modelName": { "type": "string" },
36+
"modelId": { "type": "string" },
37+
"baseUrl": { "type": "string" },
38+
"isDefault": { "type": "integer" },
39+
"userId": { "type": "string" },
40+
"apiKey": { "type": "string" }
41+
},
42+
"required": ["modelName", "modelId", "baseUrl", "isDefault", "userId", "apiKey"]
43+
}
44+
},
45+
"required": ["action", "info"]
46+
}
47+
}
48+
}
50.7 KB
Loading

0 commit comments

Comments
 (0)