Skip to content

Commit 34ea962

Browse files
newfish-cmykc121914yu
authored andcommitted
change doc & fix prompt editor (#90)
1 parent f5da7c4 commit 34ea962

File tree

5 files changed

+143
-154
lines changed

5 files changed

+143
-154
lines changed
-43.4 KB
Loading
-50.1 KB
Loading

docSite/content/docs/workflow/examples/google_search.md

Lines changed: 135 additions & 150 deletions
Original file line numberDiff line numberDiff line change
@@ -541,122 +541,6 @@ export default async function (ctx: FunctionContext) {
541541
}
542542
]
543543
},
544-
{
545-
"nodeId": "hgDD87USKMBN",
546-
"name": "文本内容提取",
547-
"intro": "可从文本中提取指定的数据,例如:sql语句、搜索关键词、代码等",
548-
"avatar": "/imgs/workflow/extract.png",
549-
"flowNodeType": "contentExtract",
550-
"showStatus": true,
551-
"position": {
552-
"x": 509.12056995756654,
553-
"y": -486.9601529132095
554-
},
555-
"inputs": [
556-
{
557-
"key": "model",
558-
"renderTypeList": [
559-
"selectLLMModel",
560-
"reference"
561-
],
562-
"label": "core.module.input.label.aiModel",
563-
"required": true,
564-
"valueType": "string",
565-
"llmModelType": "extractFields",
566-
"value": "gpt-3.5-turbo"
567-
},
568-
{
569-
"key": "description",
570-
"renderTypeList": [
571-
"textarea",
572-
"reference"
573-
],
574-
"valueType": "string",
575-
"label": "提取要求描述",
576-
"description": "给AI一些对应的背景知识或要求描述,引导AI更好的完成任务。\n该输入框可使用全局变量。",
577-
"placeholder": "例如: \n1. 当前时间为: {{cTime}}。你是一个实验室预约助手,你的任务是帮助用户预约实验室,从文本中获取对应的预约信息。\n2. 你是谷歌搜索助手,需要从文本中提取出合适的搜索词。",
578-
"value": "你是谷歌搜索机器人,根据当前问题和对话记录生成搜索词。你需要自行判断是否需要进行网络实时查询:\n- 如果需查询则生成搜索词。\n- 如果不需要查询则不返回字段。"
579-
},
580-
{
581-
"key": "history",
582-
"renderTypeList": [
583-
"numberInput",
584-
"reference"
585-
],
586-
"valueType": "chatHistory",
587-
"label": "core.module.input.label.chat history",
588-
"required": true,
589-
"min": 0,
590-
"max": 30,
591-
"value": 6
592-
},
593-
{
594-
"key": "content",
595-
"renderTypeList": [
596-
"reference",
597-
"textarea"
598-
],
599-
"label": "需要提取的文本",
600-
"required": true,
601-
"valueType": "string",
602-
"toolDescription": "需要检索的内容",
603-
"value": [
604-
"448745",
605-
"userChatInput"
606-
]
607-
},
608-
{
609-
"key": "extractKeys",
610-
"renderTypeList": [
611-
"custom"
612-
],
613-
"label": "",
614-
"valueType": "any",
615-
"description": "由 '描述' 和 'key' 组成一个目标字段,可提取多个目标字段",
616-
"value": [
617-
{
618-
"required": false,
619-
"defaultValue": "",
620-
"desc": "搜索词",
621-
"key": "searchKey",
622-
"enum": ""
623-
}
624-
]
625-
}
626-
],
627-
"outputs": [
628-
{
629-
"id": "success",
630-
"key": "success",
631-
"label": "字段完全提取",
632-
"valueType": "boolean",
633-
"type": "source"
634-
},
635-
{
636-
"id": "failed",
637-
"key": "failed",
638-
"label": "提取字段缺失",
639-
"description": "存在一个或多个字段未提取成功。尽管使用了默认值也算缺失。",
640-
"valueType": "boolean",
641-
"type": "source"
642-
},
643-
{
644-
"id": "fields",
645-
"key": "fields",
646-
"label": "完整提取结果",
647-
"description": "一个 JSON 字符串,例如:{\"name:\":\"YY\",\"Time\":\"2023/7/2 18:00\"}",
648-
"valueType": "string",
649-
"type": "static"
650-
},
651-
{
652-
"id": "CMRsZ6QGaxtV",
653-
"key": "searchKey",
654-
"label": "提取结果-搜索词",
655-
"valueType": "string",
656-
"type": "static"
657-
}
658-
]
659-
},
660544
{
661545
"nodeId": "TWD5BAqIIFaj",
662546
"name": "判断器",
@@ -665,8 +549,8 @@ export default async function (ctx: FunctionContext) {
665549
"flowNodeType": "ifElseNode",
666550
"showStatus": true,
667551
"position": {
668-
"x": 1217.046640238617,
669-
"y": 340.6565333440734
552+
"x": 1187.4821088468154,
553+
"y": -143.83989103517257
670554
},
671555
"inputs": [
672556
{
@@ -689,11 +573,11 @@ export default async function (ctx: FunctionContext) {
689573
"value": [
690574
{
691575
"variable": [
692-
"hgDD87USKMBN",
693-
"failed"
576+
"lG52GzzMm65z",
577+
"6yF19MRD3nuB"
694578
],
695-
"condition": "equalTo",
696-
"value": "true"
579+
"condition": "isEmpty",
580+
"value": ""
697581
}
698582
]
699583
}
@@ -723,8 +607,8 @@ export default async function (ctx: FunctionContext) {
723607
"flowNodeType": "httpRequest468",
724608
"showStatus": true,
725609
"position": {
726-
"x": 1217.6049019178688,
727-
"y": -597.3778323414249
610+
"x": 1992.0328696814468,
611+
"y": 127.08080019458595
728612
},
729613
"inputs": [
730614
{
@@ -755,8 +639,8 @@ export default async function (ctx: FunctionContext) {
755639
"valueType": true
756640
},
757641
"value": [
758-
"hgDD87USKMBN",
759-
"CMRsZ6QGaxtV"
642+
"lG52GzzMm65z",
643+
"6yF19MRD3nuB"
760644
]
761645
},
762646
{
@@ -865,8 +749,8 @@ export default async function (ctx: FunctionContext) {
865749
"flowNodeType": "chatNode",
866750
"showStatus": true,
867751
"position": {
868-
"x": 1955.2635939402003,
869-
"y": 168.4419404219916
752+
"x": 1982.442841318768,
753+
"y": -664.9716343803625
870754
},
871755
"inputs": [
872756
{
@@ -1011,8 +895,8 @@ export default async function (ctx: FunctionContext) {
1011895
"flowNodeType": "pluginModule",
1012896
"showStatus": false,
1013897
"position": {
1014-
"x": 1945.2841684646087,
1015-
"y": -618.5686416627316
898+
"x": 2479.5913201989906,
899+
"y": 288.52613614690904
1016900
},
1017901
"inputs": [
1018902
{
@@ -1113,8 +997,8 @@ export default async function (ctx: FunctionContext) {
1113997
"flowNodeType": "chatNode",
1114998
"showStatus": true,
1115999
"position": {
1116-
"x": 2703.883899404409,
1117-
"y": -607.9682060622981
1000+
"x": 3199.17223136331,
1001+
"y": -100.06379812849427
11181002
},
11191003
"inputs": [
11201004
{
@@ -1245,27 +1129,110 @@ export default async function (ctx: FunctionContext) {
12451129
"type": "static"
12461130
}
12471131
]
1132+
},
1133+
{
1134+
"nodeId": "lG52GzzMm65z",
1135+
"name": "文本内容提取",
1136+
"intro": "可从文本中提取指定的数据,例如:sql语句、搜索关键词、代码等",
1137+
"avatar": "/imgs/workflow/extract.png",
1138+
"flowNodeType": "contentExtract",
1139+
"showStatus": true,
1140+
"position": {
1141+
"x": 535.331344778598,
1142+
"y": -437.1382636373696
1143+
},
1144+
"inputs": [
1145+
{
1146+
"key": "model",
1147+
"renderTypeList": [
1148+
"selectLLMModel",
1149+
"reference"
1150+
],
1151+
"label": "core.module.input.label.aiModel",
1152+
"required": true,
1153+
"valueType": "string",
1154+
"llmModelType": "extractFields",
1155+
"value": "gpt-3.5-turbo"
1156+
},
1157+
{
1158+
"key": "description",
1159+
"renderTypeList": [
1160+
"textarea",
1161+
"reference"
1162+
],
1163+
"valueType": "string",
1164+
"label": "提取要求描述",
1165+
"description": "给AI一些对应的背景知识或要求描述,引导AI更好的完成任务。\n该输入框可使用全局变量。",
1166+
"placeholder": "例如: \n1. 当前时间为: {{cTime}}。你是一个实验室预约助手,你的任务是帮助用户预约实验室,从文本中获取对应的预约信息。\n2. 你是谷歌搜索助手,需要从文本中提取出合适的搜索词。",
1167+
"value": "你是谷歌搜索机器人,根据当前问题和对话记录生成搜索词。你需要自行判断是否需要进行网络实时查询:\n- 如果需查询则生成搜索词。\n- 如果不需要查询则不返回字段。"
1168+
},
1169+
{
1170+
"key": "history",
1171+
"renderTypeList": [
1172+
"numberInput",
1173+
"reference"
1174+
],
1175+
"valueType": "chatHistory",
1176+
"label": "core.module.input.label.chat history",
1177+
"required": true,
1178+
"min": 0,
1179+
"max": 30,
1180+
"value": 6
1181+
},
1182+
{
1183+
"key": "content",
1184+
"renderTypeList": [
1185+
"reference",
1186+
"textarea"
1187+
],
1188+
"label": "需要提取的文本",
1189+
"required": true,
1190+
"valueType": "string",
1191+
"toolDescription": "需要检索的内容",
1192+
"value": [
1193+
"448745",
1194+
"userChatInput"
1195+
]
1196+
},
1197+
{
1198+
"key": "extractKeys",
1199+
"renderTypeList": [
1200+
"custom"
1201+
],
1202+
"label": "",
1203+
"valueType": "any",
1204+
"description": "由 '描述' 和 'key' 组成一个目标字段,可提取多个目标字段",
1205+
"value": [
1206+
{
1207+
"required": false,
1208+
"defaultValue": "",
1209+
"desc": "搜索词",
1210+
"key": "searchKey",
1211+
"enum": ""
1212+
}
1213+
]
1214+
}
1215+
],
1216+
"outputs": [
1217+
{
1218+
"id": "fields",
1219+
"key": "fields",
1220+
"label": "完整提取结果",
1221+
"description": "一个 JSON 字符串,例如:{\"name:\":\"YY\",\"Time\":\"2023/7/2 18:00\"}",
1222+
"valueType": "string",
1223+
"type": "static"
1224+
},
1225+
{
1226+
"id": "6yF19MRD3nuB",
1227+
"key": "searchKey",
1228+
"label": "提取结果-搜索词",
1229+
"valueType": "string",
1230+
"type": "static"
1231+
}
1232+
]
12481233
}
12491234
],
12501235
"edges": [
1251-
{
1252-
"source": "448745",
1253-
"target": "hgDD87USKMBN",
1254-
"sourceHandle": "448745-source-right",
1255-
"targetHandle": "hgDD87USKMBN-target-left"
1256-
},
1257-
{
1258-
"source": "hgDD87USKMBN",
1259-
"target": "TWD5BAqIIFaj",
1260-
"sourceHandle": "hgDD87USKMBN-source-failed",
1261-
"targetHandle": "TWD5BAqIIFaj-target-left"
1262-
},
1263-
{
1264-
"source": "hgDD87USKMBN",
1265-
"target": "1ljV0oTq4zeC",
1266-
"sourceHandle": "hgDD87USKMBN-source-success",
1267-
"targetHandle": "1ljV0oTq4zeC-target-left"
1268-
},
12691236
{
12701237
"source": "TWD5BAqIIFaj",
12711238
"target": "Nc6hBdb3l9Pe",
@@ -1283,6 +1250,24 @@ export default async function (ctx: FunctionContext) {
12831250
"target": "EX0g9oK3sCOC",
12841251
"sourceHandle": "FYLw1BokYUad-source-right",
12851252
"targetHandle": "EX0g9oK3sCOC-target-left"
1253+
},
1254+
{
1255+
"source": "448745",
1256+
"target": "lG52GzzMm65z",
1257+
"sourceHandle": "448745-source-right",
1258+
"targetHandle": "lG52GzzMm65z-target-left"
1259+
},
1260+
{
1261+
"source": "lG52GzzMm65z",
1262+
"target": "TWD5BAqIIFaj",
1263+
"sourceHandle": "lG52GzzMm65z-source-right",
1264+
"targetHandle": "TWD5BAqIIFaj-target-left"
1265+
},
1266+
{
1267+
"source": "TWD5BAqIIFaj",
1268+
"target": "1ljV0oTq4zeC",
1269+
"sourceHandle": "TWD5BAqIIFaj-source-ELSE",
1270+
"targetHandle": "1ljV0oTq4zeC-target-left"
12861271
}
12871272
]
12881273
}

packages/web/components/common/Input/HttpInput/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const HttpInput = ({
3434

3535
const onChangeInput = useCallback((editorState: EditorState, editor: LexicalEditor) => {
3636
const text = editorStateToText(editor).replaceAll('}}{{', '}} {{');
37+
setCurrentValue(text);
3738
onChange?.(text);
3839
}, []);
3940
const onBlurInput = useCallback((editor: LexicalEditor) => {
@@ -42,9 +43,6 @@ const HttpInput = ({
4243
onBlur?.(text);
4344
});
4445
}, []);
45-
useEffect(() => {
46-
setCurrentValue(value);
47-
}, [value]);
4846

4947
return (
5048
<>

packages/web/components/common/Textarea/PromptEditor/index.module.scss

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,13 @@
2626
outline: none;
2727
border: 1px solid;
2828
border-color: var(--chakra-colors-primary-600);
29-
background: #fff;
29+
box-shadow: 0px 0px 0px 2.4px rgba(51, 112, 255, 0.15);
30+
}
31+
32+
.contentEditable_isFlow:focus {
33+
outline: none;
34+
border: 1px solid;
35+
border-color: var(--chakra-colors-primary-600);
3036
box-shadow: 0px 0px 0px 2.4px rgba(51, 112, 255, 0.15);
3137
}
3238

0 commit comments

Comments
 (0)