feat(workflow): add unit tests for conversation & message nodes (#1976)
This commit is contained in:
@ -4969,6 +4969,44 @@ func TestMessageNodes(t *testing.T) {
|
||||
assert.Equal(t, strconv.FormatInt(mID, 10), result["mID"])
|
||||
})
|
||||
|
||||
mockey.PatchConvey("create assistant message", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
|
||||
cID := time.Now().Unix()
|
||||
r.conversation.EXPECT().CreateConversation(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
}, nil).AnyTimes()
|
||||
mID := time.Now().Unix()
|
||||
r.message.EXPECT().Create(gomock.Any(), gomock.Any()).Return(&message.Message{
|
||||
ID: mID,
|
||||
}, nil).AnyTimes()
|
||||
rID := time.Now().UnixNano()
|
||||
r.agentRun.EXPECT().Create(gomock.Any(), gomock.Any()).Return(&agententity.RunRecordMeta{
|
||||
ID: rID,
|
||||
}, nil).AnyTimes()
|
||||
r.message.EXPECT().GetLatestRunIDs(gomock.Any(), gomock.Any()).Return([]int64{rID}, nil).AnyTimes()
|
||||
sID := time.Now().UnixNano()
|
||||
r.conversation.EXPECT().GetByID(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
SectionID: sID,
|
||||
}, nil).AnyTimes()
|
||||
idStr := r.load("message/create_assistant_message.json")
|
||||
r.publish(idStr, "v0.0.1", true)
|
||||
|
||||
ret, _ := r.openapiSyncRun(idStr, map[string]string{
|
||||
"CONVERSATION_NAME": "name" + strconv.FormatInt(cID, 10),
|
||||
}, withRunProjectID(123))
|
||||
assert.Equal(t, true, ret["output"])
|
||||
assert.Equal(t, strconv.FormatInt(mID, 10), ret["mID"])
|
||||
r.message.EXPECT().GetLatestRunIDs(gomock.Any(), gomock.Any()).Return([]int64{}, nil).AnyTimes()
|
||||
ret, _ = r.openapiSyncRun(idStr, map[string]string{
|
||||
"CONVERSATION_NAME": "name" + strconv.FormatInt(cID, 10),
|
||||
}, withRunProjectID(123))
|
||||
assert.Equal(t, true, ret["output"])
|
||||
assert.Equal(t, strconv.FormatInt(mID, 10), ret["mID"])
|
||||
})
|
||||
|
||||
mockey.PatchConvey("create message in Bot scene", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
@ -5238,7 +5276,7 @@ func TestMessageNodes(t *testing.T) {
|
||||
assert.Contains(t, e.reason, "Message node operation failure: message not found")
|
||||
})
|
||||
|
||||
mockey.PatchConvey("delete message", t, func() {
|
||||
mockey.PatchConvey("delete message in dynamic conversation", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
cID := time.Now().Unix()
|
||||
@ -5269,6 +5307,70 @@ func TestMessageNodes(t *testing.T) {
|
||||
|
||||
assert.Equal(t, true, ret["isSuccess"])
|
||||
})
|
||||
|
||||
mockey.PatchConvey("delete message in static conversation", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
cID := time.Now().Unix()
|
||||
r.conversation.EXPECT().CreateConversation(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
}, nil).AnyTimes()
|
||||
createReq := &workflow.CreateProjectConversationDefRequest{
|
||||
ProjectID: "123",
|
||||
ConversationName: "name" + strconv.FormatInt(cID, 10),
|
||||
SpaceID: "123",
|
||||
}
|
||||
post[workflow.CreateProjectConversationDefResponse](r, createReq)
|
||||
mID := time.Now().Unix()
|
||||
r.message.EXPECT().Create(gomock.Any(), gomock.Any()).Return(&message.Message{
|
||||
ID: mID,
|
||||
}, nil).AnyTimes()
|
||||
rID := time.Now().UnixNano()
|
||||
r.agentRun.EXPECT().Create(gomock.Any(), gomock.Any()).Return(&agententity.RunRecordMeta{
|
||||
ID: rID,
|
||||
}, nil).AnyTimes()
|
||||
sID := time.Now().UnixNano()
|
||||
r.conversation.EXPECT().GetByID(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
SectionID: sID,
|
||||
}, nil).AnyTimes()
|
||||
r.message.EXPECT().Delete(gomock.Any(), gomock.Any()).Return(nil).AnyTimes()
|
||||
|
||||
idStr := r.load("message/delete_message.json")
|
||||
testInput := map[string]string{
|
||||
"USER_INPUT": "hello",
|
||||
"CONVERSATION_NAME": "name" + strconv.FormatInt(cID, 10),
|
||||
}
|
||||
exeID := r.testRun(idStr, testInput, withRunProjectID(123))
|
||||
e := r.getProcess(idStr, exeID)
|
||||
e.assertSuccess()
|
||||
output := e.output
|
||||
var result map[string]any
|
||||
err := sonic.Unmarshal([]byte(output), &result)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.Equal(t, true, result["isSuccess"])
|
||||
})
|
||||
|
||||
mockey.PatchConvey("create, edit, delete message in agent default conversation", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
idStr := r.load("message/agent_message.json")
|
||||
|
||||
testInput := map[string]string{
|
||||
"CONVERSATION_NAME": "Default",
|
||||
}
|
||||
exeID := r.testRun(idStr, testInput)
|
||||
e := r.getProcess(idStr, exeID)
|
||||
output := e.output
|
||||
var result map[string]any
|
||||
err := sonic.Unmarshal([]byte(output), &result)
|
||||
assert.NoError(t, err, "Failed to unmarshal output JSON")
|
||||
|
||||
assert.Equal(t, false, result["create_success"])
|
||||
assert.Equal(t, false, result["edit_success"])
|
||||
assert.Equal(t, false, result["delete_success"])
|
||||
})
|
||||
}
|
||||
|
||||
func TestChatFlowRoleAPI(t *testing.T) {
|
||||
@ -5534,3 +5636,355 @@ func TestConversationOfChatFlow(t *testing.T) {
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
func TestConversationNodes(t *testing.T) {
|
||||
mockey.PatchConvey("create conversation", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
cID := time.Now().Unix()
|
||||
r.conversation.EXPECT().CreateConversation(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
}, nil).AnyTimes()
|
||||
sID := time.Now().UnixNano()
|
||||
r.conversation.EXPECT().GetByID(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
SectionID: sID,
|
||||
}, nil).AnyTimes()
|
||||
|
||||
idStr := r.load("conversation_manager/create_conversation.json")
|
||||
r.publish(idStr, "v0.0.1", true)
|
||||
|
||||
ret, _ := r.openapiSyncRun(idStr, map[string]string{
|
||||
"input": "name" + strconv.FormatInt(cID, 10),
|
||||
}, withRunProjectID(123))
|
||||
assert.Equal(t, strconv.FormatInt(cID, 10), ret["output"])
|
||||
})
|
||||
|
||||
mockey.PatchConvey("update template conversation name", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
cID := time.Now().Unix()
|
||||
r.conversation.EXPECT().CreateConversation(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
}, nil).AnyTimes()
|
||||
|
||||
// update template name
|
||||
createReq := &workflow.CreateProjectConversationDefRequest{
|
||||
ProjectID: "123",
|
||||
ConversationName: "template_v1",
|
||||
SpaceID: "123",
|
||||
}
|
||||
post[workflow.CreateProjectConversationDefResponse](r, createReq)
|
||||
idStr := r.load("conversation_manager/update_conversation.json")
|
||||
|
||||
execID := r.testRun(idStr, map[string]string{}, withRunProjectID(123))
|
||||
|
||||
e := r.getProcess(idStr, execID)
|
||||
|
||||
assert.Equal(t, workflow.WorkflowExeStatus_Fail, e.status)
|
||||
assert.Contains(t, e.reason, "Only conversation created through nodes are allowed to be modified or deleted")
|
||||
})
|
||||
|
||||
mockey.PatchConvey("update & delete dynamic conversation name", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
cID := time.Now().Unix()
|
||||
appID := time.Now().Unix()
|
||||
r.conversation.EXPECT().CreateConversation(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
}, nil).AnyTimes()
|
||||
|
||||
// create conversation and update conversation name
|
||||
idStr := r.load("conversation_manager/update_dynamic_conversation.json")
|
||||
execID := r.testRun(idStr, map[string]string{
|
||||
"input": "v1",
|
||||
"new_name": "v2",
|
||||
}, withRunProjectID(appID))
|
||||
|
||||
e := r.getProcess(idStr, execID)
|
||||
|
||||
output := map[string]any{}
|
||||
err := sonic.UnmarshalString(e.output, &output)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, map[string]any{"conversationId": strconv.FormatInt(cID, 10), "isExisted": false, "isSuccess": true}, output["obj"])
|
||||
|
||||
execID = r.testRun(idStr, map[string]string{
|
||||
"input": "v1",
|
||||
"new_name": "v2",
|
||||
}, withRunProjectID(appID))
|
||||
e = r.getProcess(idStr, execID)
|
||||
output = map[string]any{}
|
||||
err = sonic.UnmarshalString(e.output, &output)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, map[string]any{"conversationId": strconv.FormatInt(cID, 10), "isExisted": true, "isSuccess": false}, output["obj"])
|
||||
|
||||
// create template conversation & delete conversation
|
||||
createReq := &workflow.CreateProjectConversationDefRequest{
|
||||
ProjectID: strconv.FormatInt(appID, 10),
|
||||
ConversationName: "template_v1",
|
||||
SpaceID: "123",
|
||||
}
|
||||
_ = post[workflow.CreateProjectConversationDefResponse](r, createReq)
|
||||
|
||||
deleteIDStr := r.load("conversation_manager/delete_conversation.json")
|
||||
|
||||
execID = r.testRun(deleteIDStr, map[string]string{
|
||||
"input": "template_v1",
|
||||
}, withRunProjectID(appID))
|
||||
|
||||
e = r.getProcess(idStr, execID)
|
||||
assert.Equal(t, workflow.WorkflowExeStatus_Fail, e.status)
|
||||
assert.Contains(t, e.reason, "Only conversation created through nodes are allowed to be modified or deleted")
|
||||
|
||||
//delete dynamic conversation
|
||||
execID = r.testRun(deleteIDStr, map[string]string{
|
||||
"input": "v1",
|
||||
}, withRunProjectID(appID))
|
||||
|
||||
e = r.getProcess(idStr, execID)
|
||||
assert.Equal(t, workflow.WorkflowExeStatus_Success, e.status)
|
||||
|
||||
//delete dynamic conversation
|
||||
execID = r.testRun(deleteIDStr, map[string]string{
|
||||
"input": "v2",
|
||||
}, withRunProjectID(appID))
|
||||
|
||||
e = r.getProcess(idStr, execID)
|
||||
assert.Equal(t, workflow.WorkflowExeStatus_Success, e.status)
|
||||
|
||||
execID = r.testRun(idStr, map[string]string{
|
||||
"input": "v1",
|
||||
"new_name": "v2",
|
||||
}, withRunProjectID(appID))
|
||||
e = r.getProcess(idStr, execID)
|
||||
output = map[string]any{}
|
||||
err = sonic.UnmarshalString(e.output, &output)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, map[string]any{"conversationId": strconv.FormatInt(cID, 10), "isExisted": false, "isSuccess": true}, output["obj"])
|
||||
})
|
||||
}
|
||||
|
||||
func TestConversationListNodes(t *testing.T) {
|
||||
mockey.PatchConvey("list dynamic conversation", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
cID := time.Now().UnixNano()
|
||||
appID := cID
|
||||
r.conversation.EXPECT().CreateConversation(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: appID,
|
||||
}, nil).AnyTimes()
|
||||
idStr := r.load("conversation_manager/conversation_list.json")
|
||||
execID := r.testRun(idStr, map[string]string{
|
||||
"CONVERSATION_NAME": "name" + strconv.FormatInt(cID, 10),
|
||||
}, withRunProjectID(appID))
|
||||
e := r.getProcess(idStr, execID)
|
||||
type conversationInfo struct {
|
||||
ConversationName string `json:"conversationName"`
|
||||
ConversationId string `json:"conversationId"`
|
||||
}
|
||||
var output []conversationInfo
|
||||
err := sonic.UnmarshalString(e.output, &output)
|
||||
assert.Nil(t, err)
|
||||
expected := []conversationInfo{
|
||||
{
|
||||
ConversationId: strconv.FormatInt(cID, 10),
|
||||
ConversationName: "name" + strconv.FormatInt(cID, 10),
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expected, output)
|
||||
})
|
||||
|
||||
mockey.PatchConvey("list static conversation", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
cID := time.Now().UnixNano()
|
||||
appID := cID
|
||||
r.conversation.EXPECT().CreateConversation(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: appID,
|
||||
}, nil).AnyTimes()
|
||||
createReq := &workflow.CreateProjectConversationDefRequest{
|
||||
ProjectID: strconv.FormatInt(appID, 10),
|
||||
ConversationName: "name" + strconv.FormatInt(cID, 10),
|
||||
SpaceID: "123",
|
||||
}
|
||||
post[workflow.CreateProjectConversationDefResponse](r, createReq)
|
||||
idStr := r.load("conversation_manager/conversation_list.json")
|
||||
execID := r.testRun(idStr, map[string]string{
|
||||
"CONVERSATION_NAME": "name" + strconv.FormatInt(cID, 10),
|
||||
}, withRunProjectID(appID))
|
||||
e := r.getProcess(idStr, execID)
|
||||
type conversationInfo struct {
|
||||
ConversationName string `json:"conversationName"`
|
||||
ConversationId string `json:"conversationId"`
|
||||
}
|
||||
var output []conversationInfo
|
||||
err := sonic.UnmarshalString(e.output, &output)
|
||||
assert.Nil(t, err)
|
||||
expected := []conversationInfo{
|
||||
{
|
||||
ConversationId: strconv.FormatInt(cID, 10),
|
||||
ConversationName: "name" + strconv.FormatInt(cID, 10),
|
||||
},
|
||||
}
|
||||
assert.Equal(t, expected, output)
|
||||
})
|
||||
}
|
||||
|
||||
func TestConversationHistoryNodes(t *testing.T) {
|
||||
mockey.PatchConvey("conversation_history & clear conversation_history for dynamic conversation", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
cID := time.Now().UnixNano()
|
||||
appID := cID
|
||||
r.conversation.EXPECT().CreateConversation(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: appID,
|
||||
}, nil).AnyTimes()
|
||||
mID := time.Now().Unix()
|
||||
r.message.EXPECT().Create(gomock.Any(), gomock.Any()).Return(&message.Message{
|
||||
ID: mID,
|
||||
}, nil).AnyTimes()
|
||||
rID := time.Now().UnixNano()
|
||||
r.agentRun.EXPECT().Create(gomock.Any(), gomock.Any()).Return(&agententity.RunRecordMeta{
|
||||
ID: rID,
|
||||
}, nil).AnyTimes()
|
||||
sID := time.Now().UnixNano()
|
||||
r.conversation.EXPECT().GetByID(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
SectionID: sID,
|
||||
}, nil).AnyTimes()
|
||||
r.message.EXPECT().GetLatestRunIDs(gomock.Any(), gomock.Any()).Return([]int64{rID}, nil).AnyTimes()
|
||||
r.message.EXPECT().GetMessagesByRunIDs(gomock.Any(), gomock.Any()).Return(&message0.GetMessagesByRunIDsResponse{
|
||||
Messages: []*message0.WfMessage{
|
||||
{
|
||||
ID: mID,
|
||||
Role: schema.User,
|
||||
Text: ptr.Of("你好"),
|
||||
},
|
||||
},
|
||||
}, nil).AnyTimes()
|
||||
r.conversation.EXPECT().ClearConversationHistory(gomock.Any(), gomock.Any()).Return(&conventity.NewConversationCtxResponse{
|
||||
ID: cID,
|
||||
}, nil).AnyTimes()
|
||||
|
||||
idStr := r.load("conversation_manager/conversation_history.json")
|
||||
execID := r.testRun(idStr, map[string]string{
|
||||
"CONVERSATION_NAME": "name" + strconv.FormatInt(cID, 10),
|
||||
}, withRunProjectID(appID))
|
||||
e := r.getProcess(idStr, execID)
|
||||
e.assertSuccess()
|
||||
output := e.output
|
||||
var outputMap map[string]any
|
||||
err := sonic.Unmarshal([]byte(output), &outputMap)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, true, outputMap["isSuccess"])
|
||||
var messageList []any
|
||||
msg := map[string]any{
|
||||
"role": "user",
|
||||
"content": "你好",
|
||||
}
|
||||
messageList = append(messageList, msg)
|
||||
assert.Equal(t, messageList, outputMap["history_list"])
|
||||
})
|
||||
|
||||
mockey.PatchConvey("conversation_history & clear conversation_history for static conversation", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
cID := time.Now().UnixNano()
|
||||
appID := cID
|
||||
r.conversation.EXPECT().CreateConversation(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: appID,
|
||||
}, nil).AnyTimes()
|
||||
createReq := &workflow.CreateProjectConversationDefRequest{
|
||||
ProjectID: strconv.FormatInt(appID, 10),
|
||||
ConversationName: "name" + strconv.FormatInt(cID, 10),
|
||||
SpaceID: "123",
|
||||
}
|
||||
post[workflow.CreateProjectConversationDefResponse](r, createReq)
|
||||
mID := time.Now().Unix()
|
||||
r.message.EXPECT().Create(gomock.Any(), gomock.Any()).Return(&message.Message{
|
||||
ID: mID,
|
||||
}, nil).AnyTimes()
|
||||
rID := time.Now().UnixNano()
|
||||
r.agentRun.EXPECT().Create(gomock.Any(), gomock.Any()).Return(&agententity.RunRecordMeta{
|
||||
ID: rID,
|
||||
}, nil).AnyTimes()
|
||||
sID := time.Now().UnixNano()
|
||||
r.conversation.EXPECT().GetByID(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
SectionID: sID,
|
||||
}, nil).AnyTimes()
|
||||
r.message.EXPECT().GetLatestRunIDs(gomock.Any(), gomock.Any()).Return([]int64{rID}, nil).AnyTimes()
|
||||
r.message.EXPECT().GetMessagesByRunIDs(gomock.Any(), gomock.Any()).Return(&message0.GetMessagesByRunIDsResponse{
|
||||
Messages: []*message0.WfMessage{
|
||||
{
|
||||
ID: mID,
|
||||
Role: schema.Assistant,
|
||||
Text: ptr.Of("你好, 我是coze"),
|
||||
},
|
||||
},
|
||||
}, nil).AnyTimes()
|
||||
r.conversation.EXPECT().ClearConversationHistory(gomock.Any(), gomock.Any()).Return(&conventity.NewConversationCtxResponse{
|
||||
ID: cID,
|
||||
}, nil).AnyTimes()
|
||||
|
||||
idStr := r.load("conversation_manager/conversation_history.json")
|
||||
execID := r.testRun(idStr, map[string]string{
|
||||
"CONVERSATION_NAME": "name" + strconv.FormatInt(cID, 10),
|
||||
}, withRunProjectID(appID))
|
||||
e := r.getProcess(idStr, execID)
|
||||
e.assertSuccess()
|
||||
output := e.output
|
||||
var outputMap map[string]any
|
||||
err := sonic.Unmarshal([]byte(output), &outputMap)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, true, outputMap["isSuccess"])
|
||||
var messageList []any
|
||||
msg := map[string]any{
|
||||
"role": "assistant",
|
||||
"content": "你好, 我是coze",
|
||||
}
|
||||
messageList = append(messageList, msg)
|
||||
assert.Equal(t, messageList, outputMap["history_list"])
|
||||
})
|
||||
|
||||
mockey.PatchConvey("conversation_history blank list", t, func() {
|
||||
r := newWfTestRunner(t)
|
||||
defer r.closeFn()
|
||||
cID := time.Now().UnixNano()
|
||||
appID := cID
|
||||
r.conversation.EXPECT().CreateConversation(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: appID,
|
||||
}, nil).AnyTimes()
|
||||
mID := time.Now().Unix()
|
||||
r.message.EXPECT().Create(gomock.Any(), gomock.Any()).Return(&message.Message{
|
||||
ID: mID,
|
||||
}, nil).AnyTimes()
|
||||
rID := time.Now().UnixNano()
|
||||
r.agentRun.EXPECT().Create(gomock.Any(), gomock.Any()).Return(&agententity.RunRecordMeta{
|
||||
ID: rID,
|
||||
}, nil).AnyTimes()
|
||||
sID := time.Now().UnixNano()
|
||||
r.conversation.EXPECT().GetByID(gomock.Any(), gomock.Any()).Return(&conventity.Conversation{
|
||||
ID: cID,
|
||||
SectionID: sID,
|
||||
}, nil).AnyTimes()
|
||||
r.message.EXPECT().GetLatestRunIDs(gomock.Any(), gomock.Any()).Return([]int64{}, nil).AnyTimes()
|
||||
r.message.EXPECT().GetMessagesByRunIDs(gomock.Any(), gomock.Any()).Return(&message0.GetMessagesByRunIDsResponse{}, nil).AnyTimes()
|
||||
r.conversation.EXPECT().ClearConversationHistory(gomock.Any(), gomock.Any()).Return(&conventity.NewConversationCtxResponse{
|
||||
ID: cID,
|
||||
}, nil).AnyTimes()
|
||||
|
||||
idStr := r.load("conversation_manager/conversation_history.json")
|
||||
execID := r.testRun(idStr, map[string]string{
|
||||
"CONVERSATION_NAME": "name" + strconv.FormatInt(cID, 10),
|
||||
}, withRunProjectID(appID))
|
||||
e := r.getProcess(idStr, execID)
|
||||
e.assertSuccess()
|
||||
output := e.output
|
||||
var outputMap map[string]any
|
||||
err := sonic.Unmarshal([]byte(output), &outputMap)
|
||||
assert.Nil(t, err)
|
||||
assert.Equal(t, true, outputMap["isSuccess"])
|
||||
assert.Equal(t, []any{}, outputMap["history_list"])
|
||||
})
|
||||
}
|
||||
|
||||
@ -0,0 +1,403 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"nodeMeta": {
|
||||
"description": "工作流的起始节点,用于设定启动工作流需要的信息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Start-v2.jpg",
|
||||
"subTitle": "",
|
||||
"title": "开始"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "USER_INPUT",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"defaultValue": "Default",
|
||||
"description": "本次请求绑定的会话,会自动写入消息、会从该会话读对话历史。",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"trigger_parameters": []
|
||||
},
|
||||
"edges": null,
|
||||
"id": "100001",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": -93,
|
||||
"y": 13
|
||||
}
|
||||
},
|
||||
"type": "1"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"schema": {
|
||||
"schema": [
|
||||
{
|
||||
"name": "role",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "content",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"type": "list",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "110278",
|
||||
"name": "messageList",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 103
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "history_list"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "boolean",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "180461",
|
||||
"name": "isSuccess",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 3
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "isSuccess"
|
||||
}
|
||||
],
|
||||
"terminatePlan": "returnVariables"
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "工作流的最终节点,用于返回工作流运行后的结果信息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-End-v2.jpg",
|
||||
"subTitle": "",
|
||||
"title": "结束"
|
||||
}
|
||||
},
|
||||
"edges": null,
|
||||
"id": "900001",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1000,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"type": "2"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于创建会话",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Conversation-Create.jpeg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "创建会话",
|
||||
"title": "创建会话"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "isExisted",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "conversationId",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "101365",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 96,
|
||||
"y": -266.5
|
||||
}
|
||||
},
|
||||
"type": "39"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "user",
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "role"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "你好",
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "content"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于创建消息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-创建消息.jpg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "创建消息",
|
||||
"title": "创建消息"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"schema": [
|
||||
{
|
||||
"name": "messageId",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "role",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "contentType",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "content",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "136078",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 576,
|
||||
"y": -266.5
|
||||
}
|
||||
},
|
||||
"type": "55"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "integer",
|
||||
"value": {
|
||||
"content": 3,
|
||||
"rawMeta": {
|
||||
"type": 2
|
||||
},
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "rounds"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于查询会话历史,返回LLM可见的会话消息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-查询会话历史.jpg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "查询会话历史",
|
||||
"title": "查询会话历史"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "messageList",
|
||||
"schema": {
|
||||
"schema": [
|
||||
{
|
||||
"name": "role",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "content",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"type": "object"
|
||||
},
|
||||
"type": "list"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "110278",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 444,
|
||||
"y": -38.5
|
||||
}
|
||||
},
|
||||
"type": "54"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于清空会话历史,清空后LLM看到的会话历史为空",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Conversation-Delete.jpeg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "清空会话历史",
|
||||
"title": "清空会话历史"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "180461",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 459,
|
||||
"y": 193.5
|
||||
}
|
||||
},
|
||||
"type": "38"
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"sourceNodeID": "100001",
|
||||
"targetNodeID": "101365",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "180461",
|
||||
"targetNodeID": "900001",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "101365",
|
||||
"targetNodeID": "136078",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "136078",
|
||||
"targetNodeID": "110278",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "110278",
|
||||
"targetNodeID": "180461",
|
||||
"sourcePortID": ""
|
||||
}
|
||||
],
|
||||
"versions": {
|
||||
"loop": "v2"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,367 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"nodeMeta": {
|
||||
"description": "工作流的起始节点,用于设定启动工作流需要的信息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Start-v2.jpg",
|
||||
"subTitle": "",
|
||||
"title": "开始"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "USER_INPUT",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"defaultValue": "Default",
|
||||
"description": "本次请求绑定的会话,会自动写入消息、会从该会话读对话历史。",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"trigger_parameters": []
|
||||
},
|
||||
"edges": null,
|
||||
"id": "100001",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": -222,
|
||||
"y": 48.72071651807994
|
||||
}
|
||||
},
|
||||
"type": "1"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "boolean",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "128683",
|
||||
"name": "isSuccess",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 3
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "create_success"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "boolean",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "166060",
|
||||
"name": "isSuccess",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 3
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "edit_success"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "boolean",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "194802",
|
||||
"name": "isSuccess",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 3
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "delete_success"
|
||||
}
|
||||
],
|
||||
"terminatePlan": "returnVariables"
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "工作流的最终节点,用于返回工作流运行后的结果信息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-End-v2.jpg",
|
||||
"subTitle": "",
|
||||
"title": "结束"
|
||||
}
|
||||
},
|
||||
"edges": null,
|
||||
"id": "900001",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1092.75,
|
||||
"y": 46.510710144593645
|
||||
}
|
||||
},
|
||||
"type": "2"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "user",
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "role"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "123",
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "content"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于创建消息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-创建消息.jpg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "创建消息",
|
||||
"title": "创建消息"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"schema": [
|
||||
{
|
||||
"name": "messageId",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "role",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "contentType",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "content",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "128683",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 272.375,
|
||||
"y": -62.38428666866321
|
||||
}
|
||||
},
|
||||
"type": "55"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "128683",
|
||||
"name": "message.messageId",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "messageId"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "456",
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "newContent"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于修改消息的内容",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-修改消息.jpg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "修改消息",
|
||||
"title": "修改消息"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "166060",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 195.375,
|
||||
"y": 229.6157133313368
|
||||
}
|
||||
},
|
||||
"type": "56"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "128683",
|
||||
"name": "message.messageId",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "messageId"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于删除消息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-删除消息.jpg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "删除消息",
|
||||
"title": "删除消息"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "194802",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 612.375,
|
||||
"y": 83.61571333133679
|
||||
}
|
||||
},
|
||||
"type": "57"
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"sourceNodeID": "100001",
|
||||
"targetNodeID": "128683",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "194802",
|
||||
"targetNodeID": "900001",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "128683",
|
||||
"targetNodeID": "166060",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "166060",
|
||||
"targetNodeID": "194802",
|
||||
"sourcePortID": ""
|
||||
}
|
||||
],
|
||||
"versions": {
|
||||
"loop": "v2"
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,267 @@
|
||||
{
|
||||
"nodes": [
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"nodeMeta": {
|
||||
"description": "工作流的起始节点,用于设定启动工作流需要的信息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Start-v2.jpg",
|
||||
"subTitle": "",
|
||||
"title": "开始"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "USER_INPUT",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"defaultValue": "Default",
|
||||
"description": "本次请求绑定的会话,会自动写入消息、会从该会话读对话历史。",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"trigger_parameters": []
|
||||
},
|
||||
"edges": null,
|
||||
"id": "100001",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"type": "1"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "boolean",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "195185",
|
||||
"name": "isSuccess",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 3
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "output"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "195185",
|
||||
"name": "message.messageId",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "mID"
|
||||
}
|
||||
],
|
||||
"terminatePlan": "returnVariables"
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "工作流的最终节点,用于返回工作流运行后的结果信息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-End-v2.jpg",
|
||||
"subTitle": "",
|
||||
"title": "结束"
|
||||
}
|
||||
},
|
||||
"edges": null,
|
||||
"id": "900001",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1000,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"type": "2"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "assistant",
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "role"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "1",
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "content"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于创建消息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-创建消息.jpg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "创建消息",
|
||||
"title": "创建消息"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"schema": [
|
||||
{
|
||||
"name": "messageId",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "role",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "contentType",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "content",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "195185",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 482,
|
||||
"y": -13
|
||||
}
|
||||
},
|
||||
"type": "55"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于创建会话",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Conversation-Create.jpeg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "创建会话",
|
||||
"title": "创建会话"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "isExisted",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "conversationId",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "121849",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 302,
|
||||
"y": -236
|
||||
}
|
||||
},
|
||||
"type": "39"
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"sourceNodeID": "100001",
|
||||
"targetNodeID": "121849",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "195185",
|
||||
"targetNodeID": "900001",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "121849",
|
||||
"targetNodeID": "195185",
|
||||
"sourcePortID": ""
|
||||
}
|
||||
],
|
||||
"versions": {
|
||||
"loop": "v2"
|
||||
}
|
||||
}
|
||||
@ -1,234 +1,267 @@
|
||||
{
|
||||
"nodes": [{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"nodeMeta": {
|
||||
"description": "工作流的起始节点,用于设定启动工作流需要的信息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Start-v2.jpg",
|
||||
"subTitle": "",
|
||||
"title": "开始"
|
||||
},
|
||||
"outputs": [{
|
||||
"name": "USER_INPUT",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}, {
|
||||
"defaultValue": "Default",
|
||||
"description": "本次请求绑定的会话,会自动写入消息、会从该会话读对话历史。",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}],
|
||||
"trigger_parameters": []
|
||||
},
|
||||
"edges": null,
|
||||
"id": "100001",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"type": "1"
|
||||
}, {
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [{
|
||||
"input": {
|
||||
"type": "boolean",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "195185",
|
||||
"name": "isSuccess",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 3
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "output"
|
||||
}, {
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "195185",
|
||||
"name": "message.messageId",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "mID"
|
||||
}],
|
||||
"terminatePlan": "returnVariables"
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "工作流的最终节点,用于返回工作流运行后的结果信息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-End-v2.jpg",
|
||||
"subTitle": "",
|
||||
"title": "结束"
|
||||
}
|
||||
},
|
||||
"edges": null,
|
||||
"id": "900001",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1000,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"type": "2"
|
||||
}, {
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
}, {
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "user",
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "role"
|
||||
}, {
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "1",
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "content"
|
||||
}]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于创建消息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-创建消息.jpg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "创建消息",
|
||||
"title": "创建消息"
|
||||
},
|
||||
"outputs": [{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
}, {
|
||||
"name": "message",
|
||||
"schema": [{
|
||||
"name": "messageId",
|
||||
"type": "string"
|
||||
}, {
|
||||
"name": "role",
|
||||
"type": "string"
|
||||
}, {
|
||||
"name": "contentType",
|
||||
"type": "string"
|
||||
}, {
|
||||
"name": "content",
|
||||
"type": "string"
|
||||
}],
|
||||
"type": "object"
|
||||
}]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "195185",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 482,
|
||||
"y": -13
|
||||
}
|
||||
},
|
||||
"type": "55"
|
||||
}, {
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
}]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于创建会话",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Conversation-Create.jpeg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "创建会话",
|
||||
"title": "创建会话"
|
||||
},
|
||||
"outputs": [{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
}, {
|
||||
"name": "isExisted",
|
||||
"type": "boolean"
|
||||
}, {
|
||||
"name": "conversationId",
|
||||
"type": "string"
|
||||
}]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "121849",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 302,
|
||||
"y": -236
|
||||
}
|
||||
},
|
||||
"type": "39"
|
||||
}],
|
||||
"edges": [{
|
||||
"sourceNodeID": "100001",
|
||||
"targetNodeID": "121849",
|
||||
"sourcePortID": ""
|
||||
}, {
|
||||
"sourceNodeID": "195185",
|
||||
"targetNodeID": "900001",
|
||||
"sourcePortID": ""
|
||||
}, {
|
||||
"sourceNodeID": "121849",
|
||||
"targetNodeID": "195185",
|
||||
"sourcePortID": ""
|
||||
}],
|
||||
"versions": {
|
||||
"loop": "v2"
|
||||
}
|
||||
}
|
||||
"nodes": [
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"nodeMeta": {
|
||||
"description": "工作流的起始节点,用于设定启动工作流需要的信息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Start-v2.jpg",
|
||||
"subTitle": "",
|
||||
"title": "开始"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "USER_INPUT",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"defaultValue": "Default",
|
||||
"description": "本次请求绑定的会话,会自动写入消息、会从该会话读对话历史。",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"required": false,
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"trigger_parameters": []
|
||||
},
|
||||
"edges": null,
|
||||
"id": "100001",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 0,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"type": "1"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "boolean",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "195185",
|
||||
"name": "isSuccess",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 3
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "output"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "195185",
|
||||
"name": "message.messageId",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "mID"
|
||||
}
|
||||
],
|
||||
"terminatePlan": "returnVariables"
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "工作流的最终节点,用于返回工作流运行后的结果信息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-End-v2.jpg",
|
||||
"subTitle": "",
|
||||
"title": "结束"
|
||||
}
|
||||
},
|
||||
"edges": null,
|
||||
"id": "900001",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 1000,
|
||||
"y": 0
|
||||
}
|
||||
},
|
||||
"type": "2"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "user",
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "role"
|
||||
},
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": "1",
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "literal"
|
||||
}
|
||||
},
|
||||
"name": "content"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于创建消息",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-创建消息.jpg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "创建消息",
|
||||
"title": "创建消息"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "message",
|
||||
"schema": [
|
||||
{
|
||||
"name": "messageId",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "role",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "contentType",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "content",
|
||||
"type": "string"
|
||||
}
|
||||
],
|
||||
"type": "object"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "195185",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 482,
|
||||
"y": -13
|
||||
}
|
||||
},
|
||||
"type": "55"
|
||||
},
|
||||
{
|
||||
"blocks": [],
|
||||
"data": {
|
||||
"inputs": {
|
||||
"inputParameters": [
|
||||
{
|
||||
"input": {
|
||||
"type": "string",
|
||||
"value": {
|
||||
"content": {
|
||||
"blockID": "100001",
|
||||
"name": "CONVERSATION_NAME",
|
||||
"source": "block-output"
|
||||
},
|
||||
"rawMeta": {
|
||||
"type": 1
|
||||
},
|
||||
"type": "ref"
|
||||
}
|
||||
},
|
||||
"name": "conversationName"
|
||||
}
|
||||
]
|
||||
},
|
||||
"nodeMeta": {
|
||||
"description": "用于创建会话",
|
||||
"icon": "https://lf3-static.bytednsdoc.com/obj/eden-cn/dvsmryvd_avi_dvsm/ljhwZthlaukjlkulzlp/icon/icon-Conversation-Create.jpeg",
|
||||
"mainColor": "#F2B600",
|
||||
"subTitle": "创建会话",
|
||||
"title": "创建会话"
|
||||
},
|
||||
"outputs": [
|
||||
{
|
||||
"name": "isSuccess",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "isExisted",
|
||||
"type": "boolean"
|
||||
},
|
||||
{
|
||||
"name": "conversationId",
|
||||
"type": "string"
|
||||
}
|
||||
]
|
||||
},
|
||||
"edges": null,
|
||||
"id": "121849",
|
||||
"meta": {
|
||||
"position": {
|
||||
"x": 302,
|
||||
"y": -236
|
||||
}
|
||||
},
|
||||
"type": "39"
|
||||
}
|
||||
],
|
||||
"edges": [
|
||||
{
|
||||
"sourceNodeID": "100001",
|
||||
"targetNodeID": "121849",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "195185",
|
||||
"targetNodeID": "900001",
|
||||
"sourcePortID": ""
|
||||
},
|
||||
{
|
||||
"sourceNodeID": "121849",
|
||||
"targetNodeID": "195185",
|
||||
"sourcePortID": ""
|
||||
}
|
||||
],
|
||||
"versions": {
|
||||
"loop": "v2"
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user