Skip to content

Commit 61396c6

Browse files
committed
Merge branch '1.2.x'
2 parents e6db8a5 + bc1db0c commit 61396c6

File tree

63 files changed

+385
-225
lines changed

Some content is hidden

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

63 files changed

+385
-225
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ fit start -Dfit.profiles.active=prod
112112

113113
> 这里直接使用了 `fit` 命令,该命令请参考 `fit-framework` 项目的[指导手册](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)
114114
>
115-
> 当前,`app-platform` 使用了 `fit` 的 3.5.0-M5 版本,因此,如果采用手动编译,需要在 `fit-framework` 仓库中切换到 `v3.5.0-M5` 标签处进行编译构建操作。
115+
> 当前,`app-platform` 使用了 `fit` 的 3.5.0-M6 版本,因此,如果采用手动编译,需要在 `fit-framework` 仓库中切换到 `v3.5.0-M6` 标签处进行编译构建操作。
116116
117117
---------
118118

app-builder/builtin/form/model-config-form/config.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@
1515
"modelId": { "type": "string" },
1616
"baseUrl": { "type": "string" },
1717
"isDefault": { "type": "integer" },
18-
"userId": { "type": "string" }
18+
"userId": { "type": "string" },
19+
"type": { "type": "string" }
1920
},
2021
"required": ["modelId", "isDefault", "userId"]
2122
}
@@ -37,9 +38,10 @@
3738
"baseUrl": { "type": "string" },
3839
"isDefault": { "type": "integer" },
3940
"userId": { "type": "string" },
40-
"apiKey": { "type": "string" }
41+
"apiKey": { "type": "string" },
42+
"type": { "type": "string" }
4143
},
42-
"required": ["modelName", "modelId", "baseUrl", "isDefault", "userId", "apiKey"]
44+
"required": ["modelName", "modelId", "baseUrl", "isDefault", "userId", "apiKey", "type"]
4345
}
4446
},
4547
"required": ["action", "info"]
-910 Bytes
Loading

app-builder/builtin/form/model-config-form/src/components/form.tsx

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const SmartForm: React.FC = () => {
1616
const { data, resumingClick } = useContext(DataContext);
1717
const [modelList, setModelList] = useState([]);
1818
const [isModalVisible, setIsModalVisible] = useState(false);
19-
const [newModel, setNewModel] = useState({ modelName: '', baseUrl: '', apiKey: '' });
19+
const [newModel, setNewModel] = useState({ modelName: '', baseUrl: '', apiKey: '', type: '' });
2020

2121
const buildOutputInfo = (partial: Partial<{
2222
modelName: string;
@@ -25,13 +25,15 @@ const SmartForm: React.FC = () => {
2525
userId: string;
2626
isDefault: number;
2727
apiKey: string;
28+
type: string;
2829
}>) => ({
2930
modelName: partial.modelName || '',
3031
modelId: partial.modelId || '',
3132
baseUrl: partial.baseUrl || '',
3233
userId: partial.userId || '',
3334
isDefault: partial.isDefault ?? 0,
34-
apiKey: partial.apiKey || ''
35+
apiKey: partial.apiKey || '',
36+
type: partial.type || ''
3537
});
3638

3739
useEffect(() => {
@@ -48,8 +50,8 @@ const SmartForm: React.FC = () => {
4850
const handleAddCancel = () => setIsModalVisible(false);
4951

5052
const handleAddConfirm = () => {
51-
const { modelName, baseUrl, apiKey } = newModel;
52-
if (!modelName.trim() || !baseUrl.trim() || !apiKey.trim()) {
53+
const { modelName, baseUrl, apiKey, type } = newModel;
54+
if (!modelName.trim() || !baseUrl.trim() || !apiKey.trim() || !type.trim()) {
5355
message.warning('请填写完整模型信息');
5456
return;
5557
}
@@ -60,6 +62,7 @@ const SmartForm: React.FC = () => {
6062
userId,
6163
modelName,
6264
baseUrl,
65+
type,
6366
apiKey
6467
});
6568

@@ -71,7 +74,7 @@ const SmartForm: React.FC = () => {
7174
});
7275

7376
setIsModalVisible(false);
74-
setNewModel({ modelName: '', baseUrl: '', apiKey: '' });
77+
setNewModel({ modelName: '', baseUrl: '', apiKey: '', type: '' });
7578
};
7679

7780
const handleDelete = (record: any) => {
@@ -184,6 +187,27 @@ const SmartForm: React.FC = () => {
184187
</Tooltip>
185188
),
186189
},
190+
{
191+
title: '类型',
192+
dataIndex: 'type',
193+
key: 'type',
194+
align: 'center',
195+
render: (text: string) => (
196+
<Tooltip title={text}>
197+
<div
198+
style={{
199+
maxWidth: '100px',
200+
whiteSpace: 'nowrap',
201+
overflow: 'hidden',
202+
textOverflow: 'ellipsis',
203+
margin: '0 auto',
204+
}}
205+
>
206+
{text}
207+
</div>
208+
</Tooltip>
209+
),
210+
},
187211
{
188212
title: '是否默认',
189213
dataIndex: 'isDefault',
@@ -258,15 +282,15 @@ const SmartForm: React.FC = () => {
258282
maxLength={100}
259283
showCount
260284
value={newModel.modelName}
261-
onChange={(e) => setNewModel({ ...newModel, modelName: e.target.value })}
285+
onChange={(e) => setNewModel({ ...newModel, modelName: e.target.value.trim() })}
262286
placeholder="请输入模型名称"
263287
/>
264288
</div>
265289
<div style={{ marginBottom: 12 }}>
266290
<label>API Key:</label>
267291
<Input
268292
value={newModel.apiKey}
269-
onChange={(e) => setNewModel({ ...newModel, apiKey: e.target.value })}
293+
onChange={(e) => setNewModel({ ...newModel, apiKey: e.target.value.trim() })}
270294
placeholder="请输入 API Key"
271295
/>
272296
</div>
@@ -276,10 +300,20 @@ const SmartForm: React.FC = () => {
276300
maxLength={200}
277301
showCount
278302
value={newModel.baseUrl}
279-
onChange={(e) => setNewModel({ ...newModel, baseUrl: e.target.value })}
303+
onChange={(e) => setNewModel({ ...newModel, baseUrl: e.target.value.trim() })}
280304
placeholder="请输入 Base URL"
281305
/>
282306
</div>
307+
<div>
308+
<label>类型:</label>
309+
<Input
310+
maxLength={50}
311+
showCount
312+
value={newModel.type}
313+
onChange={(e) => setNewModel({ ...newModel, type: e.target.value.trim() })}
314+
placeholder="请输入模型类型 e.g. chat_completions, embeddings, rerank, etc."
315+
/>
316+
</div>
283317
</Modal>
284318
</div>
285319
);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<title>Document</title>
7+
</head>
8+
<body>
9+
<div id="root"></div>
10+
</body>
11+
</html>

app-builder/builtin/form/model-config-form/webpack.prod.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ module.exports = merge(common, {
99
},
1010
output: {
1111
filename: "[name].js",
12-
path: path.resolve(__dirname, "output/build")
12+
path: path.resolve(__dirname, "output/6befc536-7e6d-48b5-8dcb-1c4d04ca4e92/build")
1313
},
1414
plugins: [],
1515
});

app-builder/plugins/aipp-classify-question/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<dependency>
6767
<groupId>org.fitframework.plugin</groupId>
6868
<artifactId>fit-message-serializer-json-jackson</artifactId>
69-
<version>3.5.0-M5</version>
69+
<version>3.5.0-M6</version>
7070
<scope>test</scope>
7171
</dependency>
7272
<dependency>

app-builder/plugins/aipp-classify-question/src/test/java/modelengine/fit/jade/aipp/classify/question/AippClassifyQuestionServiceTest.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
import modelengine.fit.jade.aipp.classify.question.command.ClassifyQuestionCommandHandler;
1818
import modelengine.fit.jade.aipp.classify.question.utils.TestUtils;
1919
import modelengine.fit.jade.aipp.model.dto.ModelAccessInfo;
20+
import modelengine.fit.jade.aipp.model.enums.ModelType;
2021

2122
import org.junit.jupiter.api.AfterEach;
2223
import org.junit.jupiter.api.Assertions;
@@ -63,7 +64,8 @@ void shouldOkWhenInvokeClassifyService() {
6364
param.setTemplate(command.getTemplate());
6465
param.setArgs(command.getArgs());
6566
param.setQuestionTypeList(command.getQuestionTypes());
66-
param.setAccessInfo(new ModelAccessInfo(command.getModel(), command.getModelTag(), null, null));
67+
param.setAccessInfo(new ModelAccessInfo(command.getModel(),
68+
command.getModelTag(), null, null, ModelType.CHAT_COMPLETIONS.value()));
6769
param.setTemperature(command.getTemperature());
6870
String result = this.classifyQuestionService.classifyQuestion(param, command.getMemoryConfig(),
6971
command.getHistories());

app-builder/plugins/aipp-custom-model-center/src/main/java/modelengine/fit/jade/aipp/model/mapper/UserModelMapper.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,25 +25,28 @@ public interface UserModelMapper {
2525
* 根据用户标识获取用户模型关系列表。
2626
*
2727
* @param userId 表示用户标识的 {@link String}。
28+
* @param type 表示模型类型的 {@link String},传入null时将不会使用该字段。
2829
* @return 用户模型关系列表的 {@link List}{@code <}{@link UserModelPo}{@code >}。
2930
*/
30-
List<UserModelPo> listUserModels(String userId);
31+
List<UserModelPo> listUserModels(String userId, String type);
3132

3233
/**
3334
* 根据用户标识获取默认用户模型关系。
3435
*
3536
* @param userId 表示用户标识的 {@link String}。
37+
* @param type 表示模型类型的 {@link String},传入null时将不会使用该字段。
3638
* @return 默认的用户模型关系的 {@link UserModelPo}。
3739
*/
38-
UserModelPo getDefault(String userId);
40+
UserModelPo getDefault(String userId, String type);
3941

4042
/**
4143
* 判断指定用户是否已绑定默认模型。
4244
*
4345
* @param userId 表示用户标识的 {@link String}。
46+
* @param type 表示模型类型的 {@link String},传入null时将不会使用该字段。
4447
* @return 若已绑定默认模型则返回 {@code true},否则返回 {@code false}。
4548
*/
46-
boolean hasDefaultModel(String userId);
49+
boolean hasDefaultModel(String userId, String type);
4750

4851
/**
4952
* 插入用户模型绑定关系。

app-builder/plugins/aipp-custom-model-center/src/main/java/modelengine/fit/jade/aipp/model/repository/UserModelRepo.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,10 @@ public interface UserModelRepo {
2323
* 根据用户标识来查询该用户可用的模型列表。
2424
*
2525
* @param userId 表示用户标识的 {@link String}。
26+
* @param type 表示模型类型的 {@link String},传入null时将不会使用该字段。
2627
* @return 该用户可用的模型列表的 {@link List}{@code <}{@link ModelPo}{@code >}。
2728
*/
28-
List<ModelPo> listModelsByUserId(String userId);
29+
List<ModelPo> listModelsByUserId(String userId, String type);
2930

3031
/**
3132
* 查询特定的模型访问信息。
@@ -41,9 +42,10 @@ public interface UserModelRepo {
4142
* 获取一个用户的默认模型。
4243
*
4344
* @param userId 表示用户标识的 {@link String}。
45+
* @param type 表示模型类型的 {@link String},传入null时将不会使用该字段。
4446
* @return 模型信息的 {@link ModelPo}。
4547
*/
46-
ModelPo getDefaultModel(String userId);
48+
ModelPo getDefaultModel(String userId, String type);
4749

4850
/**
4951
* 根据用户标识来查询该用户可用的用户模型列表。
@@ -65,9 +67,10 @@ public interface UserModelRepo {
6567
* 查询该用户是否存在默认模型。
6668
*
6769
* @param userId 表示用户标识的 {@link String}。
70+
* @param type 表示模型类型的 {@link String},传入null时将不会使用该字段。
6871
* @return 是否存在默认模型的 {@code boolean}。
6972
*/
70-
boolean hasDefaultModel(String userId);
73+
boolean hasDefaultModel(String userId, String type);
7174

7275
/**
7376
* 插入一条模型信息。

0 commit comments

Comments
 (0)