From 785134bd6816e1969c45aab9a0f4c6c7016980f3 Mon Sep 17 00:00:00 2001 From: clay Date: Mon, 5 May 2025 01:55:01 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BF=AE=E6=94=B9=E8=81=8A=E5=A4=A9?= =?UTF-8?q?=E8=A7=92=E8=89=B2=E6=9E=9A=E4=B8=BE=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/metis/enums/ChatRoleType.java | 15 +++++----- metis-starter/src/test/resources/flow.json | 28 +++++++++++++++++-- 2 files changed, 33 insertions(+), 10 deletions(-) diff --git a/metis-starter/src/main/java/com/metis/enums/ChatRoleType.java b/metis-starter/src/main/java/com/metis/enums/ChatRoleType.java index c424635..6e359fb 100644 --- a/metis-starter/src/main/java/com/metis/enums/ChatRoleType.java +++ b/metis-starter/src/main/java/com/metis/enums/ChatRoleType.java @@ -1,22 +1,23 @@ package com.metis.enums; import com.fasterxml.jackson.annotation.JsonValue; +import lombok.AllArgsConstructor; import lombok.Getter; @Getter +@AllArgsConstructor public enum ChatRoleType { - SYSTEM("system"), - USER("user"), - AI("ai"), - TOOL_EXECUTION_RESULT("toolExecutionResult"); + SYSTEM("system", "系统角色"), + USER("user", "用户角色"), + AI("ai", "ai返回"), + TOOL_EXECUTION_RESULT("toolExecutionResult", "工具(函数调用)返回"); @JsonValue private final String value; + private final String desc; + - ChatRoleType(String value) { - this.value = value; - } } diff --git a/metis-starter/src/test/resources/flow.json b/metis-starter/src/test/resources/flow.json index d240146..20acf3e 100644 --- a/metis-starter/src/test/resources/flow.json +++ b/metis-starter/src/test/resources/flow.json @@ -39,9 +39,19 @@ "value": "值" // 值不能为空 }, - "allowedFileUploadMethods": ["localFile","remoteUrl"], // 允许上传方式 - "allowedFileTypes": [""], // 允许文件类型 自定义 - "allowedFileExtensions": [""] // 允许文件扩展名 可以自定义 + "allowedFileUploadMethods": [ + "localFile", + "remoteUrl" + ], + // 允许上传方式 + "allowedFileTypes": [ + "" + ], + // 允许文件类型 自定义 + "allowedFileExtensions": [ + "" + ] + // 允许文件扩展名 可以自定义 }, { "variable": "background", @@ -89,6 +99,10 @@ "promptTemplate": [ { // 角色 + // SYSTEM("system", "系统角色"), + // USER("user", "用户角色"), + // AI("ai", "ai返回"), + // TOOL_EXECUTION_RESULT("toolExecutionResult", "工具(函数调用)返回"); "role": "system", "text": "你的背景是${context}", "id": "1" @@ -99,12 +113,17 @@ "id": "2" } ], + // 模型参数 "model": { + // 模型id, 需要在模型管理中创建, 调用接口返回 "modelId": 1, + // 模型名称, 接口中获取 "modelName": "Qwen/Qwen2.5-Coder-32B-Instruct", + // 模型参数. 与dify保持一致, 默认值也使用dify "completionParams": { "temperature": 0.7, "topP": 0.9, + "topK": 1.1, "maxTokens": 1024, "seed": 1234, "presencePenalty": 0, @@ -144,9 +163,12 @@ "icon": "", "toolbarPosition": "right", "config": { + // 结束节点的返回变量 "variables": [ { + // 返回变量字段名称 "variable": "query", + // 返回变量字段值, 动态模板获取 "variableKey": "node_5.query" }, {