From 86ecd4aa8703665b073cb8d5338899cc4de05d73 Mon Sep 17 00:00:00 2001 From: Baptiste Arnaud Date: Mon, 13 Mar 2023 16:29:24 +0100 Subject: [PATCH] :sparkles: Add basic ChatGPT template Closes #388 --- .../public/templates/basic-chat-gpt.json | 257 ++++++++++++++++++ apps/builder/src/features/templates/data.ts | 6 + 2 files changed, 263 insertions(+) create mode 100644 apps/builder/public/templates/basic-chat-gpt.json diff --git a/apps/builder/public/templates/basic-chat-gpt.json b/apps/builder/public/templates/basic-chat-gpt.json new file mode 100644 index 00000000000..631a68dd4af --- /dev/null +++ b/apps/builder/public/templates/basic-chat-gpt.json @@ -0,0 +1,257 @@ +{ + "id": "clf6ov7hg00001ao6q02sb8re", + "version": "3", + "createdAt": "2023-03-13T10:35:44.933Z", + "updatedAt": "2023-03-13T14:53:00.817Z", + "icon": "🤖", + "name": "Basic ChatGPT", + "folderId": null, + "groups": [ + { + "id": "ewnfbo0exlu7ihfu2lu2lusm", + "title": "Start", + "blocks": [ + { + "id": "igbipfi63m6p9sl2f77uicuv", + "type": "start", + "label": "Start", + "groupId": "ewnfbo0exlu7ihfu2lu2lusm", + "outgoingEdgeId": "sevwpre8fo896btd6xm1e1dv" + } + ], + "graphCoordinates": { "x": -20.9296875, "y": -125.6796875 } + }, + { + "id": "qfrz5nwm63g12dajsjxothb5", + "title": "User input", + "blocks": [ + { + "id": "ovgk70u0kfxrbtz9dy4e040o", + "type": "text input", + "groupId": "qfrz5nwm63g12dajsjxothb5", + "options": { + "isLong": true, + "labels": { + "button": "Send", + "placeholder": "Type your answer..." + }, + "variableId": "vevnx5f5bojz0sv648x6ppcmv", + "isPrefillDisabled": true + }, + "outgoingEdgeId": "kwm65fnel1gddbwdki9rq76v" + } + ], + "graphCoordinates": { "x": 385.59765625, "y": 176 } + }, + { + "id": "a6ymhjwtkqwp8t127plz8qmk", + "title": "ChatGPT reply", + "blocks": [ + { + "id": "xikptnw1lp1qxdqo10qhmwy1", + "type": "OpenAI", + "groupId": "a6ymhjwtkqwp8t127plz8qmk", + "options": { + "task": "Create chat completion", + "model": "gpt-3.5-turbo", + "messages": [ + { + "id": "fxg16pnlnwuhfpz1r51xslbd", + "role": "system", + "content": "You are ChatGPT, a large language model trained by OpenAI." + }, + { + "id": "vexqydoltfc5fkdrcednlvjz", + "role": "Messages sequence ✨", + "content": { + "userMessagesVariableId": "vevnx5f5bojz0sv648x6ppcmv", + "assistantMessagesVariableId": "vni6kwbch8zlq92dclgcivzyr" + } + } + ], + "responseMapping": [ + { + "id": "brb5ccisi1tjiqf3ng0asaiq", + "variableId": "vni6kwbch8zlq92dclgcivzyr", + "valueToExtract": "Message content" + } + ] + } + }, + { + "id": "myldn1l1nfdwwm8qvza71rwv", + "type": "text", + "content": { + "html": "
{{Assistant Messages}}
", + "richText": [ + { + "type": "p", + "children": [{ "text": "{{Assistant Messages}}" }] + } + ], + "plainText": "{{Assistant Messages}}" + }, + "groupId": "a6ymhjwtkqwp8t127plz8qmk", + "outgoingEdgeId": "y8ml9ljnsydol9b42fd9zdve" + } + ], + "graphCoordinates": { "x": 744.05078125, "y": 178.00390625 } + }, + { + "id": "c5f00f3oclwi1srcz10jjt9u", + "title": "Intro", + "blocks": [ + { + "id": "vzcrfk4vl9gy8igu0ysja5nc", + "type": "text", + "content": { + "html": "
Hi there 👋
", + "richText": [ + { "type": "p", "children": [{ "text": "Hi there 👋" }] } + ], + "plainText": "Hi there 👋" + }, + "groupId": "c5f00f3oclwi1srcz10jjt9u" + }, + { + "id": "gphm5wy1md9cunwkdtbzg6nq", + "type": "text", + "content": { + "html": "
How can I help?
", + "richText": [ + { "type": "p", "children": [{ "text": "How can I help?" }] } + ], + "plainText": "How can I help?" + }, + "groupId": "c5f00f3oclwi1srcz10jjt9u", + "outgoingEdgeId": "h5sk58j0ryrxmfv4gmw7r4dw" + } + ], + "graphCoordinates": { "x": 54.7421875, "y": 172.83203125 } + }, + { + "id": "t3tv4dm3khwmiotjle5jb65g", + "title": "", + "blocks": [ + { + "id": "s6eky7dd3md9hto9y4wsuj7h", + "type": "text", + "content": { + "html": "
You need to add your OpenAI credentials to make this bot work. 🪄
", + "richText": [ + { + "type": "p", + "children": [ + { + "text": "You need to add your OpenAI credentials to make this bot work. 🪄" + } + ] + } + ], + "plainText": "You need to add your OpenAI credentials to make this bot work. 🪄" + }, + "groupId": "t3tv4dm3khwmiotjle5jb65g" + }, + { + "id": "nqsu9f13q5j8tt56bcbuto62", + "type": "text", + "content": { + "html": "
Once it's done, delete this group and connect the Start block with Intro 🚀
", + "richText": [ + { + "type": "p", + "children": [ + { + "text": "Once it's done, delete this group and connect the " + }, + { "bold": true, "text": "Start" }, + { "text": " block with " }, + { "bold": true, "text": "Intro" }, + { "text": " 🚀" } + ] + } + ], + "plainText": "Once it's done, delete this group and connect the Start block with Intro 🚀" + }, + "groupId": "t3tv4dm3khwmiotjle5jb65g" + } + ], + "graphCoordinates": { "x": 321.13671875, "y": -121.90234375 } + } + ], + "variables": [ + { "id": "vni6kwbch8zlq92dclgcivzyr", "name": "Assistant Messages" }, + { "id": "vevnx5f5bojz0sv648x6ppcmv", "name": "User Messages" } + ], + "edges": [ + { + "id": "h5sk58j0ryrxmfv4gmw7r4dw", + "to": { "groupId": "qfrz5nwm63g12dajsjxothb5" }, + "from": { + "blockId": "gphm5wy1md9cunwkdtbzg6nq", + "groupId": "c5f00f3oclwi1srcz10jjt9u" + } + }, + { + "id": "kwm65fnel1gddbwdki9rq76v", + "to": { "groupId": "a6ymhjwtkqwp8t127plz8qmk" }, + "from": { + "blockId": "ovgk70u0kfxrbtz9dy4e040o", + "groupId": "qfrz5nwm63g12dajsjxothb5" + } + }, + { + "id": "y8ml9ljnsydol9b42fd9zdve", + "to": { "groupId": "qfrz5nwm63g12dajsjxothb5" }, + "from": { + "blockId": "myldn1l1nfdwwm8qvza71rwv", + "groupId": "a6ymhjwtkqwp8t127plz8qmk" + } + }, + { + "id": "sevwpre8fo896btd6xm1e1dv", + "to": { "groupId": "t3tv4dm3khwmiotjle5jb65g" }, + "from": { + "blockId": "igbipfi63m6p9sl2f77uicuv", + "groupId": "ewnfbo0exlu7ihfu2lu2lusm" + } + } + ], + "theme": { + "chat": { + "inputs": { + "color": "#303235", + "backgroundColor": "#FFFFFF", + "placeholderColor": "#9095A0" + }, + "buttons": { "color": "#FFFFFF", "backgroundColor": "#0042DA" }, + "hostAvatar": { + "isEnabled": true + }, + "hostBubbles": { "color": "#303235", "backgroundColor": "#F7F8FF" }, + "guestBubbles": { "color": "#FFFFFF", "backgroundColor": "#FF8E21" } + }, + "general": { + "font": "Open Sans", + "background": { "type": "Color", "content": "#ffffff" } + } + }, + "settings": { + "general": { + "isBrandingEnabled": true, + "isInputPrefillEnabled": true, + "isHideQueryParamsEnabled": true, + "isNewResultOnRefreshEnabled": true + }, + "metadata": { + "description": "Build beautiful conversational forms and embed them directly in your applications without a line of code. Triple your response rate and collect answers that has more value compared to a traditional form." + }, + "typingEmulation": { "speed": 300, "enabled": true, "maxDelay": 1.5 } + }, + "publicId": null, + "customDomain": null, + "workspaceId": "freeWorkspace", + "resultsTablePreferences": null, + "isArchived": false, + "isClosed": false +} diff --git a/apps/builder/src/features/templates/data.ts b/apps/builder/src/features/templates/data.ts index 6f7a299e61f..9ef28e54ea6 100644 --- a/apps/builder/src/features/templates/data.ts +++ b/apps/builder/src/features/templates/data.ts @@ -33,4 +33,10 @@ export const templates: TemplateProps[] = [ fileName: 'movie-recommendation.json', isNew: true, }, + { + name: 'Basic ChatGPT', + emoji: '🤖', + fileName: 'basic-chat-gpt.json', + isNew: true, + }, ]