Skip to content

Commit

Permalink
Add subcannoli canvases to cannoli college
Browse files Browse the repository at this point in the history
  • Loading branch information
blindmansion committed Sep 25, 2024
1 parent 0d9976e commit aaaf9ce
Show file tree
Hide file tree
Showing 14 changed files with 106 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,12 @@ export class SubcannoliNode extends ContentNode {
return;
}

const resultsString = JSON.stringify(results, null, 2);
let resultsString = "";

// If results is empty, set results string to empty string
if (Object.keys(results).length > 0) {
resultsString = JSON.stringify(results, null, 2);
}

const outgoingEdges = this.getOutgoingEdges();

Expand Down
Original file line number Diff line number Diff line change
@@ -1 +1,32 @@
{"nodes":[{"id":"167d3b7b2f6f548d","type":"group","x":-460,"y":400,"width":1004,"height":660,"label":"Limiting chat messages"},{"id":"ec1597e4e7f3530c","type":"group","x":-209,"y":-208,"width":290,"height":348,"label":"Chat arrows"},{"id":"09ce49517baf7eda","type":"text","text":"","x":-189,"y":-60,"width":250,"height":60},{"id":"b90c7fbfa70e4300","type":"text","text":"{{NOTE}}","x":-189,"y":60,"width":250,"height":60,"color":"6"},{"id":"4857524edbae8263","type":"text","text":"This chat arrow will parse the contents of the reference node into an array of messages","x":100,"y":-147,"width":380,"height":87},{"id":"ef3cdc2a117f9156","type":"text","text":"{{NOTE}}","x":-330,"y":420,"width":250,"height":60,"color":"6"},{"id":"82ba7993840f1760","type":"text","text":"","x":-330,"y":568,"width":250,"height":60},{"id":"09a9d8dd0741d74b","type":"text","text":"","x":163,"y":568,"width":250,"height":60},{"id":"9a309223d6ce3931","type":"text","text":"","x":-440,"y":680,"width":471,"height":360,"color":"6"},{"id":"f2d8da368e1c51b6","type":"text","text":"","x":53,"y":680,"width":471,"height":360,"color":"6"},{"id":"cd757b7484ffd798","type":"text","text":"{{NOTE}}","x":163,"y":420,"width":250,"height":60,"color":"6"},{"id":"d9739a4acdf10a34","type":"text","text":"This chat node is empty, so it will just send the previous messages it was given to the LLM","x":-610,"y":-86,"width":343,"height":106},{"id":"2b08e45e39b8eb39","type":"text","text":"This chat arrow will append the content of the response to the same note, as a stream.","x":100,"y":-30,"width":380,"height":120},{"id":"ce80fff3047872f3","type":"text","text":"The final chat arrow only sends the final response, so you can do anything you like with the space between the two chat arrows. \n\nUse this flexibility to build chatbots that send http requests, make decisions, edit notes, or gather relevant context.","x":-717,"y":60,"width":459,"height":200},{"id":"1097b1b80a3abe81","type":"text","text":"{{NOTE}}","x":-189,"y":-188,"width":250,"height":60,"color":"6"},{"id":"a8e6750d3ca80fff","type":"text","text":"This is a special reference node that references the note that was active when the cannoli was run.","x":-717,"y":-211,"width":450,"height":83},{"id":"2d01d9688ecbe4da","type":"text","text":"Green arrows are chat arrows. They can be used to build custom chatbots within obsidian using Cannoli.\n\nTry this by moving to a note, then running this cannoli using the \"4. Chat arrows\" command.","x":-277,"y":-440,"width":427,"height":180},{"id":"6ff1bc87ce822f42","x":-890,"y":489,"width":403,"height":218,"type":"text","text":"You can limit the number of messages parsed from a note by adding a number to the label.\n\nJust a number will limit the number of messages, and adding a \"#\" to the beginning of the label will limit based on an approximation of tokens. "},{"id":"2213c3caec2e3835","x":-800,"y":804,"width":315,"height":96,"type":"text","text":"The example on the left will send the most recent two messages from the note"},{"id":"fd4602caf5adb9bc","x":560,"y":508,"width":440,"height":90,"type":"text","text":"This chat arrow will send messages not exceeding the estimated token limit (but at least 1 message)"}],"edges":[{"id":"dddd3b587c8b7340","fromNode":"1097b1b80a3abe81","fromSide":"bottom","toNode":"09ce49517baf7eda","toSide":"top","color":"4"},{"id":"847946cb0fc14d7a","fromNode":"09ce49517baf7eda","fromSide":"bottom","toNode":"b90c7fbfa70e4300","toSide":"top","color":"4"},{"id":"8cc7de72b0881d19","fromNode":"ef3cdc2a117f9156","fromSide":"bottom","toNode":"82ba7993840f1760","toSide":"top","color":"4","label":"2"},{"id":"a738da5d15aa4bd8","fromNode":"82ba7993840f1760","fromSide":"bottom","toNode":"9a309223d6ce3931","toSide":"top","color":"2"},{"id":"b2376898a9f7d1f1","fromNode":"09a9d8dd0741d74b","fromSide":"bottom","toNode":"f2d8da368e1c51b6","toSide":"top","color":"2"},{"id":"9406dd17d5c41032","fromNode":"cd757b7484ffd798","fromSide":"bottom","toNode":"09a9d8dd0741d74b","toSide":"top","color":"4","label":"#500"}]}
{
"nodes":[
{"id":"167d3b7b2f6f548d","type":"group","x":-460,"y":400,"width":1004,"height":660,"label":"Limiting chat messages"},
{"id":"ec1597e4e7f3530c","type":"group","x":-209,"y":-208,"width":290,"height":348,"label":"Chat arrows"},
{"id":"09ce49517baf7eda","type":"text","text":"","x":-189,"y":-60,"width":250,"height":60},
{"id":"b90c7fbfa70e4300","type":"text","text":"{{NOTE}}","x":-189,"y":60,"width":250,"height":60,"color":"6"},
{"id":"4857524edbae8263","type":"text","text":"This chat arrow will parse the contents of the reference node into an array of messages","x":100,"y":-147,"width":380,"height":87},
{"id":"ef3cdc2a117f9156","type":"text","text":"{{NOTE}}","x":-330,"y":420,"width":250,"height":60,"color":"6"},
{"id":"82ba7993840f1760","type":"text","text":"","x":-330,"y":568,"width":250,"height":60},
{"id":"09a9d8dd0741d74b","type":"text","text":"","x":163,"y":568,"width":250,"height":60},
{"id":"9a309223d6ce3931","type":"text","text":"","x":-440,"y":680,"width":471,"height":360,"color":"6"},
{"id":"f2d8da368e1c51b6","type":"text","text":"","x":53,"y":680,"width":471,"height":360,"color":"6"},
{"id":"cd757b7484ffd798","type":"text","text":"{{NOTE}}","x":163,"y":420,"width":250,"height":60,"color":"6"},
{"id":"d9739a4acdf10a34","type":"text","text":"This chat node is empty, so it will just send the previous messages it was given to the LLM","x":-610,"y":-86,"width":343,"height":106},
{"id":"2b08e45e39b8eb39","type":"text","text":"This chat arrow will append the content of the response to the same note, as a stream.","x":100,"y":-30,"width":380,"height":120},
{"id":"ce80fff3047872f3","type":"text","text":"The final chat arrow only sends the final response, so you can do anything you like with the space between the two chat arrows. \n\nUse this flexibility to build chatbots that send http requests, make decisions, edit notes, or gather relevant context.","x":-717,"y":60,"width":459,"height":200},
{"id":"1097b1b80a3abe81","type":"text","text":"{{NOTE}}","x":-189,"y":-188,"width":250,"height":60,"color":"6"},
{"id":"a8e6750d3ca80fff","type":"text","text":"This is a special reference node that references the note that was active when the cannoli was run.","x":-717,"y":-211,"width":450,"height":83},
{"id":"2d01d9688ecbe4da","type":"text","text":"Green arrows are chat arrows. They can be used to build custom chatbots within obsidian using Cannoli.\n\nTry this by moving to a note, then running this cannoli using the \"4. Chat arrows\" command.","x":-277,"y":-440,"width":427,"height":180},
{"id":"6ff1bc87ce822f42","x":-890,"y":489,"width":403,"height":218,"type":"text","text":"You can limit the number of messages parsed from a note by adding a number to the label.\n\nJust a number will limit the number of messages, and adding a \"#\" to the beginning of the label will limit based on an approximation of tokens. "},
{"id":"2213c3caec2e3835","x":-800,"y":804,"width":315,"height":96,"type":"text","text":"The example on the left will send the most recent two messages from the note"},
{"id":"fd4602caf5adb9bc","x":560,"y":508,"width":440,"height":90,"type":"text","text":"This chat arrow will send messages not exceeding the estimated token limit (but at least 1 message)"}
],
"edges":[
{"id":"dddd3b587c8b7340","fromNode":"1097b1b80a3abe81","fromSide":"bottom","toNode":"09ce49517baf7eda","toSide":"top","color":"4"},
{"id":"847946cb0fc14d7a","fromNode":"09ce49517baf7eda","fromSide":"bottom","toNode":"b90c7fbfa70e4300","toSide":"top","color":"4"},
{"id":"8cc7de72b0881d19","fromNode":"ef3cdc2a117f9156","fromSide":"bottom","toNode":"82ba7993840f1760","toSide":"top","color":"4","label":"2"},
{"id":"a738da5d15aa4bd8","fromNode":"82ba7993840f1760","fromSide":"bottom","toNode":"9a309223d6ce3931","toSide":"top","color":"2"},
{"id":"b2376898a9f7d1f1","fromNode":"09a9d8dd0741d74b","fromSide":"bottom","toNode":"f2d8da368e1c51b6","toSide":"top","color":"2"},
{"id":"9406dd17d5c41032","fromNode":"cd757b7484ffd798","fromSide":"bottom","toNode":"09a9d8dd0741d74b","toSide":"top","color":"4","label":"#500"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
{"type":"text","text":"Field arrows can help get good formatting for notes. Use \"content\" and \"title\" field names to keep the LLM from writing the title of the note into the content.","id":"5943bd16d1a71072","x":440,"y":506,"width":357,"height":119},
{"type":"text","text":"Ok, now respond with just the article\n\nThere should be nothing in your response other than the article","id":"94567e5a2b31c42b","x":-315,"y":475,"width":255,"height":180},
{"id":"9fa03f1308317478","type":"text","text":"To allow the edit to overwrite the properties (YAML frontmatter) in the note, reference it like this:\n{{[[Note]]^}}\n\nIf your default setting is to include (overwrite) the properties, you can remove them like this:\n{{[[Note]]!^}}","x":48,"y":-122,"width":420,"height":229},
{"type":"text","text":"{{[[Lemons for Cleaning]]!^}}","id":"6c3aaf24c1410da5","x":-309,"y":77,"width":274,"height":60,"color":"6"},
{"type":"text","text":"{{[[Meeting Notes]]!^}}","id":"6c3aaf24c1410da5","x":-309,"y":77,"width":274,"height":60,"color":"6"},
{"type":"file","file":"Cannoli College/Example notes/Walking Poem.md","text":"{{[[Apple Trees]]}}","id":"5e54d6df61248d37","x":8,"y":715,"width":255,"height":189},
{"id":"fe4f45ec55ab88f8","type":"text","text":"You can use arrows that start with \":\" to edit the property in the arrow label.\n\nThis also works for list format properties.","x":-678,"y":1020,"width":318,"height":189},
{"id":"ae32c84e56f650cb","type":"text","text":"{{[[Meeting Notes]]}}","x":-310,"y":1179,"width":250,"height":60,"color":"6"},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"nodes":[
{"id":"6bee83c618f78ec5","type":"group","x":-150,"y":-306,"width":409,"height":556,"label":"Input and output nodes"},
{"id":"6bb11822c098ccb1","type":"text","text":"Write a sentence using these two words:\n{{a}}\n{{b}}","x":-80,"y":-96,"width":250,"height":142,"color":"0"},
{"id":"f067631823623c56","type":"text","text":"[anotherInput]\nIcosahedron","x":60,"y":-286,"width":179,"height":90,"color":"6"},
{"id":"a8a224d1d5f64c1a","type":"text","text":"[anInput]\nPajamas","x":-130,"y":-283,"width":161,"height":92,"color":"6"},
{"id":"8ba395f1998b606d","type":"text","text":"[anOutput]\n","x":-80,"y":105,"width":250,"height":125,"color":"6"},
{"id":"83e5ea326aa3a1f9","type":"text","text":"Because these names can be used as variables when baking a cannoli to code, they must be valid javascript variable names:\n\nVariable names must start with a letter, underscore, or dollar sign, and can only contain letters, numbers, underscores, or dollar signs.","x":275,"y":-295,"width":489,"height":221},
{"id":"2b8d9df0da25a55c","type":"text","text":"Input nodes are named content nodes with no incoming arrows\n\nOutput nodes are named content nodes with no outgoing arrows","x":274,"y":82,"width":383,"height":165},
{"id":"b31e6235e7f3d953","type":"text","text":"Input and output nodes are used to define inputs and outputs for baked cannolis and subcannolis.","x":-468,"y":-225,"width":303,"height":120},
{"id":"5951d7529cd75816","type":"text","text":"Input/output nodes are simply named content nodes. They are named the same way floating nodes are named, using single square brackets on the first line.","x":-526,"y":-16,"width":365,"height":142},
{"id":"96a04622c1426d0c","x":-261,"y":-542,"width":628,"height":181,"type":"text","text":"Input and output nodes allow you to explicitly define inputs an outputs of a cannoli. \n\nThis enables a cannoli to be used with arguments as a sub-cannoli or baked to code (using the \"Bake\" or \"Bake to Val Town\" commands) with explicitly defined parameters and returns."}
],
"edges":[
{"id":"c9de0bf84a78600f","fromNode":"a8a224d1d5f64c1a","fromSide":"bottom","toNode":"6bb11822c098ccb1","toSide":"top","label":"a"},
{"id":"ca384210d5b575f9","fromNode":"f067631823623c56","fromSide":"bottom","toNode":"6bb11822c098ccb1","toSide":"top","label":"b"},
{"id":"efeeacc5c3428321","fromNode":"6bb11822c098ccb1","fromSide":"bottom","toNode":"8ba395f1998b606d","toSide":"top"}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"nodes":[
{"id":"c0a71176b04a13c6","type":"group","x":-289,"y":-325,"width":720,"height":1011,"label":"Sub-cannolis"},
{"id":"2dcf15ce79b828d8","type":"file","file":"Cannoli College/6. Sub-cannolis/1. Input and output nodes.canvas","x":-139,"y":-108,"width":400,"height":400,"color":"2"},
{"id":"c18fc5b1f7bb37e5","type":"text","text":"frog","x":-215,"y":-301,"width":250,"height":60,"color":"6"},
{"id":"6c52ad5b31b27f43","type":"text","text":"rubiks cube","x":79,"y":-305,"width":250,"height":60,"color":"6"},
{"id":"5264695914078a98","type":"text","text":"","x":-269,"y":385,"width":306,"height":281,"color":"6"},
{"id":"0c96fa7eee85ae17","type":"text","text":"","x":99,"y":380,"width":312,"height":281,"color":"6"},
{"id":"992c754b9fbeb13a","type":"text","text":"A sub-cannoli is an orange file node which references another canvas in your vault.\n\nYou can create a file node by dragging a file from the obsidian side-bar onto the canvas, or right clicking on the canvas and selecting \"add note from vault\"","x":-701,"y":-292,"width":383,"height":217},
{"id":"dcd181bb6d0417ae","type":"text","text":"The arrows pointing to a sub-cannoli must be named based on the input nodes in that cannoli.\n\nIn this example these are \"anInput\" and \"anotherInput\".\n\nInputs are not required for sub-cannolis. If no input is given, the cannoli will run as normal. This could be useful when the sub-cannoli gets its context from a note in your vault or an action node.","x":-741,"y":39,"width":426,"height":291},
{"id":"eacd89f861e65d30","type":"text","text":"Outgoing arrows from sub-cannolis can reference specific output nodes of the cannoli. If they do not, all of the output nodes results will be given as a JSON object.","x":-697,"y":434,"width":391,"height":150},
{"id":"33853a4dc679c6f2","type":"text","text":"Sub-cannolis are cannolis which can be included within other cannolis as nodes.\n\nThey can be useful for reusing common prompt patterns without cluttering up your canvas.","x":-238,"y":-534,"width":602,"height":158},
{"id":"dc25151c0c905405","type":"text","text":"Currently, when a sub-cannoli is run, it will not make changes to the canvas it references.\n\nFor this reason, it's best to test the sub-cannoli on its own canvas for debugging purposes. Another strategy would be to add output nodes that contain useful debug information where needed.","x":449,"y":-152,"width":435,"height":216},
{"id":"30426566f403a181","type":"text","text":"Sub-cannolis can be nested.\n\nErrors that occur in a sub-cannoli will bubble up to the top level.","x":450,"y":261,"width":343,"height":122}
],
"edges":[
{"id":"0bd5ed15122bff0a","fromNode":"c18fc5b1f7bb37e5","fromSide":"bottom","toNode":"2dcf15ce79b828d8","toSide":"top","label":"anInput"},
{"id":"710ae77b6549b368","fromNode":"6c52ad5b31b27f43","fromSide":"bottom","toNode":"2dcf15ce79b828d8","toSide":"top","label":"anotherInput"},
{"id":"7704e3a36e0d076c","fromNode":"2dcf15ce79b828d8","fromSide":"bottom","toNode":"5264695914078a98","toSide":"top"},
{"id":"36d3df7134384f1c","fromNode":"2dcf15ce79b828d8","fromSide":"bottom","toNode":"0c96fa7eee85ae17","toSide":"top","label":"anOutput"}
]
}
Loading

0 comments on commit aaaf9ce

Please sign in to comment.