-
-
Notifications
You must be signed in to change notification settings - Fork 137
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #234 from polterguy/workflows
Started working on Workflows
- Loading branch information
Showing
447 changed files
with
2,616 additions
and
660 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
# Contributon to Magic | ||
|
||
In order to contribute to Magic, we need your employer's consent that you are legally allowed to contribute to open source projects. | ||
This implies at the minimum having your closest upwards _"C level executive"_ send you an email confirming that there it's OK for | ||
you to contribute to Magic, allowing us to sub-license your work any ways we see fit, for then to forward that email to info@aista.com. | ||
We also need your explicit consent, implying you are fine with Aista, Ltd sub-licensing your code, any ways we see fit. | ||
This implies at the minimum having your closest upwards _"C level executive"_ send you an email confirming that it's OK for | ||
you to contribute to Magic, allowing us to sub-license your work any ways we see fit, for then to forward that email to thomas@ainiro.io. | ||
|
||
Hence, if you want to contribute to Magic, you will need to send two emails to info@aista.com as explained further up. Otherwise | ||
Hence, if you want to contribute to Magic, you will need to send two emails to thomas@ainiro.io as explained further up. Otherwise | ||
we cannot for legal reasons accept your contribution. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
signal:magic.http.duckduckgo-and-scrape | ||
query:Who won Eurovision 2023 | ||
max:int:5 | ||
|
||
|
||
signal:magic.http.duckduckgo-search | ||
query:Who won Eurovision 2023 | ||
max:int:5 | ||
|
||
signal:magic.http.scrape-url | ||
url:"https://www.cnn.com/2023/05/13/europe/eurovision-song-contest-2023-winner-intl/index.html" | ||
|
||
signal:magic.http.scrape-url | ||
url:"https://eurovisionworld.com/eurovision/2023" | ||
|
||
signal:magic.http.scrape-url | ||
url:"https://www.nytimes.com/2023/05/13/arts/music/eurovision-2023-final-sweden.html" | ||
|
||
signal:magic.http.scrape-url | ||
url:"https://www.npr.org/2023/05/13/1176049673/loreen-of-sweden-wins-eurovision-song-contest" | ||
|
||
signal:magic.http.scrape-url | ||
url:"https://www.nytimes.com/live/2023/05/13/arts/eurovision-final" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
/* | ||
* Finds all images that are not referenced in any HTML, JS, CSS or | ||
* Markdown file, and returns in [.result]. | ||
*/ | ||
.not-used | ||
.html | ||
.images | ||
io.file.list-recursively:/etc/www/ | ||
for-each:x:-/* | ||
strings.split:x:@.dp/# | ||
.:. | ||
switch:x:-/0/- | ||
case:html | ||
case:md | ||
.html | ||
set-value:x:@.html | ||
io.file.load:x:@.dp/# | ||
if | ||
eq | ||
get-value:x:@strings.split/0/- | ||
.:md | ||
.lambda | ||
markdown2html:x:@.html | ||
set-value:x:@.html | ||
get-value:x:@markdown2html | ||
if | ||
exists:x:@markdown2html/*/image | ||
.lambda | ||
strings.concat | ||
.:/etc/www | ||
get-value:x:@markdown2html/*/image | ||
unwrap:x:+/*/* | ||
add:x:@.html/@.html | ||
. | ||
.:x:@strings.concat | ||
html2lambda:x:@.html | ||
for-each:x:@html2lambda/**/img/*/\@src | ||
if | ||
strings.starts-with:x:@.dp/# | ||
.:/assets/ | ||
.lambda | ||
strings.concat | ||
.:/etc/www | ||
get-value:x:@.dp/# | ||
unwrap:x:+/*/* | ||
add:x:@.html/@.html | ||
. | ||
.:x:@strings.concat | ||
add:x:@.images | ||
io.file.list-recursively:/etc/www/assets/images/ | ||
for-each:x:@.images/* | ||
|
||
if | ||
not | ||
exists:x:@.html/*/={@.dp/#} | ||
.lambda | ||
unwrap:x:+/*/* | ||
add:x:@.not-used | ||
. | ||
.:x:@.dp/# | ||
for-each:x:@.not-used/* | ||
io.file.delete:x:@.dp/# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
# Hyperlambda workflows | ||
|
||
This folder contains your custom Hyperlambda workflows. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
|
||
/* | ||
* Example workflow executing sql-select action, for then | ||
* to return result of invocation. | ||
*/ | ||
|
||
/* | ||
* Execute some select SQL statement specified as [sql]. | ||
* Optionally provide [connection-string], [database-type] and [database]. | ||
*/ | ||
execute:magic.workflows.functions.execute | ||
name:sql-select | ||
filename:/misc/workflows/functions/sql-select.hl | ||
arguments | ||
sql:select name from roles where name like @arg1 limit 2 | ||
@arg1:a% |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
backend/files/misc/templates/angular/templates/main/src/app/pipes/date-since.pipe.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
# Workflow Hyperlambda files | ||
|
||
Supporting Hyperlambda files your workflows. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
|
||
# Hyperlambda functions for workflows | ||
|
||
This folder contains Hyperlambda system functions for your workflows. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
|
||
/* | ||
* Compiles the specified C# code and loads into the AppDomain. | ||
* | ||
* Notice, will not compile the specified code if assembly already exists in | ||
* AppDomain, unless [recompile] is true. | ||
*/ | ||
.arguments | ||
code:string | ||
file:string | ||
references:* | ||
assembly-name:string | ||
recompile:bool | ||
.example | ||
code:@" | ||
using System; | ||
using magic.node; | ||
using magic.node.extensions; | ||
using magic.signals.contracts; | ||
|
||
[Slot(Name = ""get-employee-details"")] | ||
public class Foo : ISlot | ||
{ | ||
public void Signal(ISignaler signaler, Node input) | ||
{ | ||
switch (input.GetEx<string>().ToLower()) | ||
{ | ||
case ""john"": | ||
input.Add(new Node(""title"", ""cmo"")); | ||
input.Add(new Node(""phone"", ""92929292"")); | ||
input.Add(new Node(""email"", ""john@doe.come"")); | ||
break; | ||
} | ||
input.Value = null; | ||
} | ||
}" | ||
references | ||
.:netstandard | ||
.:System.Runtime | ||
.:System.ComponentModel | ||
.:System.Private.CoreLib | ||
.:magic.node | ||
.:magic.node.extensions | ||
.:magic.signals.contracts | ||
assembly-name:employees.dll | ||
recompile:bool:false | ||
.icon:rocket_launch | ||
|
||
// Sanity checking invocation. | ||
validators.mandatory:x:@.arguments/*/code | ||
validators.mandatory:x:@.arguments/*/references | ||
validators.mandatory:x:@.arguments/*/assembly-name | ||
|
||
/* | ||
* We only compile C# code if it does not already exist in AppDomain, | ||
* unless caller explicitly specifies [recompile] as true. | ||
*/ | ||
system.plugin.list | ||
if | ||
or | ||
get-value:x:@.arguments/*/recompile | ||
not-exists:x:@system.plugin.list/*/={@.arguments/*/assembly-name} | ||
.lambda | ||
|
||
// Parametrizing [system.compile] invocation. | ||
add:x:./*/system.compile | ||
get-nodes:x:@.arguments/*/references | ||
get-nodes:x:@.arguments/*/assembly-name | ||
|
||
// Checking if caller provided a [file] argument instead of a [code] argument. | ||
if | ||
and | ||
not-exists:x:@.arguments/*/code | ||
exists:x:@.arguments/*/file | ||
not-null:x:@.arguments/*/file | ||
.lambda | ||
|
||
// We've got a [file] argument instead of a [code] argument. | ||
load-file:x:@.arguments/*/file | ||
add:x:@.lambda/@.lambda/*/system.compile | ||
. | ||
code:x:@load-file | ||
|
||
else | ||
|
||
// Caller provided a [code] argument. | ||
add:x:@.lambda/*/system.compile | ||
get-nodes:x:@.arguments/*/code | ||
|
||
// Compiling C# code. | ||
system.compile | ||
|
||
// Loading assembly into AppDomain. | ||
system.plugin.load:x:@system.compile |
41 changes: 41 additions & 0 deletions
41
backend/files/misc/workflows/functions/context-from-database.hl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
|
||
/* | ||
* Returns context for the specified [query] from the specified [type], | ||
* and returns to caller. | ||
* | ||
* Optionally add [threshold] and [max_tokens] to specify similarity and maximum | ||
* tokens to return. | ||
*/ | ||
.arguments | ||
type:string | ||
query:string | ||
threshold:decimal | ||
max_tokens:int | ||
.example | ||
type:x:@.arguments/*/type | ||
query:x:@.arguments/*/query | ||
threshold:decimal:0.3 | ||
max_tokens:int:2000 | ||
.icon:extension | ||
|
||
// Sanity checking invocation. | ||
validators.mandatory:x:@.arguments/*/type | ||
validators.mandatory:x:@.arguments/*/query | ||
|
||
// Applying default values for optional arguments. | ||
validators.default:x:@.arguments | ||
threshold:decimal:0.3 | ||
max_tokens:int:4000 | ||
|
||
// Retrieving context. | ||
execute:magic.ai.get-context | ||
type:x:@.arguments/*/type | ||
vector_model:text-embedding-ada-002 | ||
prompt:x:@.arguments/*/query | ||
threshold:x:@.arguments/*/threshold | ||
max_tokens:x:@.arguments/*/max_tokens | ||
|
||
// Returning result of invocation to caller. | ||
unwrap:x:./*/return/* | ||
return | ||
result:x:@execute/*/context |
Oops, something went wrong.