Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Transformerlab App
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
mirrored_repos
MachineLearning
TransformerLab
Transformerlab App
Commits
1442476e
Commit
1442476e
authored
1 month ago
by
sanjaycal
Browse files
Options
Downloads
Patches
Plain Diff
add the ability to add nodes(with the json format for now, changing to templates soon)
parent
158f209e
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/renderer/components/Experiment/Workflows/NewNodeModal.tsx
+54
-0
54 additions, 0 deletions
...renderer/components/Experiment/Workflows/NewNodeModal.tsx
src/renderer/components/Experiment/Workflows/index.tsx
+20
-1
20 additions, 1 deletion
src/renderer/components/Experiment/Workflows/index.tsx
with
74 additions
and
1 deletion
src/renderer/components/Experiment/Workflows/NewNodeModal.tsx
0 → 100644
+
54
−
0
View file @
1442476e
import
{
Button
,
DialogContent
,
DialogTitle
,
FormControl
,
FormHelperText
,
FormLabel
,
Input
,
Modal
,
ModalClose
,
ModalDialog
,
Stack
,
Textarea
,
}
from
'
@mui/joy
'
;
import
{
useState
}
from
'
react
'
;
import
*
as
chatAPI
from
'
renderer/lib/transformerlab-api-sdk
'
;
export
default
function
NewNodeModal
({
open
,
onClose
,
workflowId
})
{
const
[
state
,
setState
]
=
useState
(
null
);
return
(
<
Modal
open
=
{
open
}
onClose
=
{
()
=>
onClose
()
}
>
<
ModalDialog
>
<
ModalClose
/>
<
DialogTitle
>
Create new Node
</
DialogTitle
>
<
DialogContent
>
Fill in the information.
</
DialogContent
>
<
form
onSubmit
=
{
async
(
event
:
React
.
FormEvent
<
HTMLFormElement
>
)
=>
{
event
.
preventDefault
();
const
formData
=
new
FormData
(
event
.
currentTarget
);
const
node
=
formData
.
get
(
'
node
'
)
as
string
;
//const nodes = formData.get('nodes') as string;
await
fetch
(
chatAPI
.
Endpoints
.
Workflows
.
AddNode
(
workflowId
,
node
)
);
onClose
();
}
}
>
<
Stack
spacing
=
{
2
}
>
<
FormControl
>
<
FormLabel
>
Nodes
</
FormLabel
>
<
Textarea
minRows
=
{
4
}
autoFocus
required
name
=
"node"
/>
</
FormControl
>
<
Button
type
=
"submit"
>
Submit
</
Button
>
</
Stack
>
</
form
>
</
ModalDialog
>
</
Modal
>
);
}
This diff is collapsed.
Click to expand it.
src/renderer/components/Experiment/Workflows/index.tsx
+
20
−
1
View file @
1442476e
...
@@ -12,18 +12,21 @@ import {
...
@@ -12,18 +12,21 @@ import {
import
{
Background
,
ControlButton
,
Controls
,
ReactFlow
}
from
'
@xyflow/react
'
;
import
{
Background
,
ControlButton
,
Controls
,
ReactFlow
}
from
'
@xyflow/react
'
;
import
'
@xyflow/react/dist/style.css
'
;
import
'
@xyflow/react/dist/style.css
'
;
import
{
PlayIcon
,
PlusCircleIcon
,
WorkflowIcon
}
from
'
lucide-react
'
;
import
{
PlayIcon
,
PlusCircleIcon
,
PlusIcon
,
WorkflowIcon
}
from
'
lucide-react
'
;
import
{
useState
}
from
'
react
'
;
import
{
useState
}
from
'
react
'
;
import
*
as
chatAPI
from
'
../../../lib/transformerlab-api-sdk
'
;
import
*
as
chatAPI
from
'
../../../lib/transformerlab-api-sdk
'
;
import
useSWR
from
'
swr
'
;
import
useSWR
from
'
swr
'
;
import
NewWorkflowModal
from
'
./NewWorkflowModal
'
;
import
NewWorkflowModal
from
'
./NewWorkflowModal
'
;
import
NewNodeModal
from
'
./NewNodeModal
'
;
const
fetcher
=
(
url
:
any
)
=>
fetch
(
url
).
then
((
res
)
=>
res
.
json
());
const
fetcher
=
(
url
:
any
)
=>
fetch
(
url
).
then
((
res
)
=>
res
.
json
());
export
default
function
Workflows
({
experimentInfo
})
{
export
default
function
Workflows
({
experimentInfo
})
{
const
[
selectedWorkflow
,
setSelectedWorkflow
]
=
useState
(
null
);
const
[
selectedWorkflow
,
setSelectedWorkflow
]
=
useState
(
null
);
const
[
newWorkflowModalOpen
,
setNewWorkflowModalOpen
]
=
useState
(
false
);
const
[
newWorkflowModalOpen
,
setNewWorkflowModalOpen
]
=
useState
(
false
);
const
[
newNodeflowModalOpen
,
setNewNodeflowModalOpen
]
=
useState
(
false
);
const
{
const
{
data
:
workflowsData
,
data
:
workflowsData
,
error
:
workflowsError
,
error
:
workflowsError
,
...
@@ -100,6 +103,16 @@ export default function Workflows({ experimentInfo }) {
...
@@ -100,6 +103,16 @@ export default function Workflows({ experimentInfo }) {
}
}
}
}
experimentId
=
{
experimentInfo
?.
id
}
experimentId
=
{
experimentInfo
?.
id
}
/>
/>
{
selectedWorkflow
&&
<
NewNodeModal
open
=
{
newNodeflowModalOpen
}
onClose
=
{
()
=>
{
setNewNodeflowModalOpen
(
false
);
mutateWorkflows
();
}
}
workflowId
=
{
selectedWorkflow
?.
id
}
/>
}
<
Typography
level
=
"h1"
>
Workflows
</
Typography
>
<
Typography
level
=
"h1"
>
Workflows
</
Typography
>
<
Typography
level
=
"body-lg"
mb
=
{
3
}
>
<
Typography
level
=
"body-lg"
mb
=
{
3
}
>
This is where it will all go
This is where it will all go
...
@@ -193,6 +206,12 @@ export default function Workflows({ experimentInfo }) {
...
@@ -193,6 +206,12 @@ export default function Workflows({ experimentInfo }) {
Running
Running
</
Button
>
</
Button
>
)
}
)
}
<
Button
startDecorator
=
{
<
PlusIcon
/>
}
onClick
=
{
()
=>
setNewNodeflowModalOpen
(
true
)
}
>
Add Node
</
Button
>
<
Button
variant
=
"outlined"
>
Edit
</
Button
>
<
Button
variant
=
"outlined"
>
Edit
</
Button
>
<
Button
variant
=
"outlined"
>
Fight
</
Button
>
<
Button
variant
=
"outlined"
>
Fight
</
Button
>
</
Box
>
</
Box
>
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment