Skip to content

Commit 8e84e67

Browse files
committed
Merge branch '3.5.x'
2 parents d63003d + b695fc2 commit 8e84e67

File tree

8 files changed

+97
-3
lines changed

8 files changed

+97
-3
lines changed

framework/elsa/fit-elsa-react/src/common/Consts.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,4 +250,21 @@ export const DEFAULT_KNOWLEDGE_NODE_RERANK_TOP_N = {
250250
type: DATA_TYPES.INTEGER,
251251
from: FROM_TYPE.INPUT,
252252
value: 3,
253+
};
254+
255+
export const DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_EXTENSIONS = {
256+
id: `knowledgeExtensions_${uuidv4()}`,
257+
name: 'extensions',
258+
type: DATA_TYPES.OBJECT,
259+
from: FROM_TYPE.EXPAND,
260+
value: [{
261+
id: uuidv4(),
262+
name: VIRTUAL_CONTEXT_NODE_VARIABLES.USER_ID,
263+
type: DATA_TYPES.STRING,
264+
from: FROM_TYPE.REFERENCE,
265+
referenceId: VIRTUAL_CONTEXT_NODE_VARIABLES.USER_ID,
266+
referenceKey: VIRTUAL_CONTEXT_NODE_VARIABLES.USER_ID,
267+
referenceNode: VIRTUAL_CONTEXT_NODE.id,
268+
value: [VIRTUAL_CONTEXT_NODE_VARIABLES.USER_ID],
269+
}],
253270
};

framework/elsa/fit-elsa-react/src/components/knowledgeRetrieval/knowledgeRetrievalComponent.jsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
DEFAULT_KNOWLEDGE_REPO_GROUP,
1515
DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_KNOWLEDGE_CONFIG_ID,
1616
FROM_TYPE,
17+
DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_EXTENSIONS,
1718
} from '@/common/Consts.js';
1819
import {
1920
ChangeAccessInfoReducer,
@@ -152,6 +153,7 @@ export const knowledgeRetrievalComponent = (jadeConfig, shape) => {
152153
value: DEFAULT_KNOWLEDGE_REPO_GROUP,
153154
},
154155
JSON.parse(JSON.stringify(DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_KNOWLEDGE_CONFIG_ID)),
156+
JSON.parse(JSON.stringify(DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_EXTENSIONS)),
155157
],
156158
}],
157159
outputParams: [{

framework/elsa/fit-elsa-react/src/flow/compatibility/compatibilityProcessors.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
DEFAULT_KNOWLEDGE_NODE_RERANK_TOP_N,
1414
DEFAULT_KNOWLEDGE_REPO_GROUP_STRUCT,
1515
DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_KNOWLEDGE_CONFIG_ID,
16+
DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_EXTENSIONS,
1617
DEFAULT_LLM_KNOWLEDGE_BASES,
1718
DEFAULT_LLM_REFERENCE_OUTPUT,
1819
DEFAULT_MAX_MEMORY_ROUNDS,
@@ -481,6 +482,10 @@ export const knowledgeRetrievalCompatibilityProcessor = (shapeData, graph, pageH
481482
rerankParamValue.push(DEFAULT_KNOWLEDGE_NODE_RERANK_TOP_N);
482483
}
483484
}
485+
486+
if (Array.isArray(optionValue) && !optionValue.some(v => v.name === 'extensions')) {
487+
optionValue.push(DEFAULT_KNOWLEDGE_RETRIEVAL_NODE_EXTENSIONS);
488+
}
484489
};
485490

486491
const userIdParamProcess = () => {

framework/fel/java/fel-core/src/main/java/modelengine/fel/core/chat/ChatOption.java

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
package modelengine.fel.core.chat;
88

9-
import modelengine.fel.core.tool.ToolInfo;
109
import modelengine.fel.core.model.http.SecureConfig;
10+
import modelengine.fel.core.tool.ToolInfo;
1111
import modelengine.fitframework.pattern.builder.BuilderFactory;
1212

1313
import java.util.List;
14+
import java.util.Map;
1415

1516
/**
1617
* 表示聊天大模型参数的实体。
@@ -132,6 +133,13 @@ public interface ChatOption {
132133
*/
133134
SecureConfig secureConfig();
134135

136+
/**
137+
* 获取扩展信息。
138+
*
139+
* @return 表示扩展信息的 {@link Map}{@code <}{@link String}{@code , }{@link Object}{@code >}。
140+
*/
141+
Map<String, Object> extensions();
142+
135143
/**
136144
* {@link ChatOption} 的构建器。
137145
*/
@@ -232,6 +240,14 @@ interface Builder {
232240
*/
233241
Builder secureConfig(SecureConfig secureConfig);
234242

243+
/**
244+
* 设置扩展信息。
245+
*
246+
* @param extensions 表示扩展信息的 {@link Map}{@code <}{@link String}{@code , }{@link Object}{@code >}。
247+
* @return 表示当前构建器的 {@link Builder}。
248+
*/
249+
Builder extensions(Map<String, Object> extensions);
250+
235251
/**
236252
* 构建对象。
237253
*

framework/fel/java/fel-core/src/main/java/modelengine/fel/core/embed/EmbedOption.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import modelengine.fitframework.pattern.builder.BuilderFactory;
1010

11+
import java.util.Map;
12+
1113
/**
1214
* 表示嵌入模型参数的实体。
1315
*
@@ -28,6 +30,13 @@ public interface EmbedOption {
2830
*/
2931
String apiKey();
3032

33+
/**
34+
* 获取扩展信息。
35+
*
36+
* @return 表示扩展信息的 {@link Map}{@code <}{@link String}{@code , }{@link Object}{@code >}。
37+
*/
38+
Map<String, Object> extensions();
39+
3140
/**
3241
* 表示 {@link EmbedOption} 的构建器。
3342
*/
@@ -48,6 +57,14 @@ interface Builder {
4857
*/
4958
Builder apiKey(String apiKey);
5059

60+
/**
61+
* 设置扩展信息。
62+
*
63+
* @param extensions 表示扩展信息的 {@link Map}{@code <}{@link String}{@code , }{@link Object}{@code >}。
64+
* @return 表示当前构建器的 {@link Builder}。
65+
*/
66+
Builder extensions(Map<String, Object> extensions);
67+
5168
/**
5269
* 构建 {@link EmbedOption} 实例。
5370
*

framework/fel/java/fel-core/src/main/java/modelengine/fel/core/image/ImageOption.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88

99
import modelengine.fitframework.pattern.builder.BuilderFactory;
1010

11+
import java.util.Map;
12+
1113
/**
1214
* 表示图像生成模型参数的实体。
1315
*
@@ -42,6 +44,13 @@ public interface ImageOption {
4244
*/
4345
String apiKey();
4446

47+
/**
48+
* 获取扩展信息。
49+
*
50+
* @return 表示扩展信息的 {@link Map}{@code <}{@link String}{@code , }{@link Object}{@code >}。
51+
*/
52+
Map<String, Object> extensions();
53+
4554
/**
4655
* 表示 {@link ImageOption} 的构建器。
4756
*/
@@ -78,6 +87,14 @@ interface Builder {
7887
*/
7988
Builder baseUrl(String baseUrl);
8089

90+
/**
91+
* 设置扩展信息。
92+
*
93+
* @param extensions 表示扩展信息的 {@link Map}{@code <}{@link String}{@code , }{@link Object}{@code >}。
94+
* @return 表示当前构建器的 {@link Builder}。
95+
*/
96+
Builder extensions(Map<String, Object> extensions);
97+
8198
/**
8299
* 构建 {@link ImageOption} 实例。
83100
*

framework/fel/java/fel-core/src/main/java/modelengine/fel/core/rerank/RerankOption.java

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
import modelengine.fel.core.model.http.SecureConfig;
1010
import modelengine.fitframework.pattern.builder.BuilderFactory;
1111

12+
import java.util.Map;
13+
1214
/**
1315
* 表示重排模型参数的实体。
1416
*
@@ -57,6 +59,13 @@ public interface RerankOption {
5759
*/
5860
SecureConfig secureConfig();
5961

62+
/**
63+
* 获取扩展信息。
64+
*
65+
* @return 表示扩展信息的 {@link Map}{@code <}{@link String}{@code , }{@link Object}{@code >}。
66+
*/
67+
Map<String, Object> extensions();
68+
6069
/**
6170
* {@link RerankOption} 的构建器。
6271
*/
@@ -109,6 +118,14 @@ interface Builder {
109118
*/
110119
Builder secureConfig(SecureConfig secureConfig);
111120

121+
/**
122+
* 设置扩展信息。
123+
*
124+
* @param extensions 表示扩展信息的 {@link Map}{@code <}{@link String}{@code , }{@link Object}{@code >}。
125+
* @return 表示当前构建器的 {@link Builder}。
126+
*/
127+
Builder extensions(Map<String, Object> extensions);
128+
112129
/**
113130
* 构建对象。
114131
*

framework/fit/java/fit-builtin/plugins/fit-http-server-netty/src/main/java/modelengine/fit/http/server/netty/HttpClassicRequestAssembler.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,11 @@ private void handleHttpRequest(ChannelHandlerContext ctx, HttpRequest request) {
164164
private void doHttpRequest(ChannelHandlerContext ctx, NettyHttpServerRequest request) {
165165
request.setExecuteThread(Thread.currentThread());
166166
try (HttpClassicServerRequest classicRequest = HttpClassicServerRequest.create(this.server, request);
167-
NettyHttpServerResponse response = new NettyHttpServerResponse(ctx, request);
168-
HttpClassicServerResponse classicResponse = HttpClassicServerResponse.create(this.server, response)) {
167+
// Inline Netty response creation to avoid it being managed as a separate
168+
// try-with-resources variable. This prevents premature closure at the end
169+
// of the try block, which would cause write failures when SSE sends data.
170+
HttpClassicServerResponse classicResponse = HttpClassicServerResponse.create(this.server,
171+
new NettyHttpServerResponse(ctx, request))) {
169172
HttpHandler handler = this.server.httpDispatcher().dispatch(classicRequest, classicResponse);
170173
classicRequest.attributes().set(PATH_PATTERN.key(), handler.pathPattern());
171174
classicRequest.attributes().set(HTTP_HANDLER.key(), handler);

0 commit comments

Comments
 (0)