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
7837c773
Commit
7837c773
authored
1 month ago
by
ali asaria
Browse files
Options
Downloads
Patches
Plain Diff
improve evals page ui
parent
7bf6671d
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/Eval/Eval.tsx
+7
-103
7 additions, 103 deletions
src/renderer/components/Experiment/Eval/Eval.tsx
src/renderer/components/Experiment/Eval/EvalJobsTable.tsx
+1
-2
1 addition, 2 deletions
src/renderer/components/Experiment/Eval/EvalJobsTable.tsx
with
8 additions
and
105 deletions
src/renderer/components/Experiment/Eval/Eval.tsx
+
7
−
103
View file @
7837c773
...
@@ -32,12 +32,10 @@ import {
...
@@ -32,12 +32,10 @@ import {
FileTextIcon
,
FileTextIcon
,
PlayIcon
,
PlayIcon
,
PlusCircleIcon
,
PlusCircleIcon
,
Trash2Icon
,
XSquareIcon
,
XSquareIcon
,
}
from
'
lucide-react
'
;
}
from
'
lucide-react
'
;
import
{
Editor
}
from
'
@monaco-editor/react
'
;
import
fairyflossTheme
from
'
../../Shared/fairyfloss.tmTheme.js
'
;
import
ResultsModal
from
'
./ResultsModal
'
;
import
DynamicPluginForm
from
'
../DynamicPluginForm
'
;
import
DynamicPluginForm
from
'
../DynamicPluginForm
'
;
import
EvalJobsTable
from
'
./EvalJobsTable.tsx
'
;
import
EvalJobsTable
from
'
./EvalJobsTable.tsx
'
;
const
parseTmTheme
=
require
(
'
monaco-themes
'
).
parseTmTheme
;
const
parseTmTheme
=
require
(
'
monaco-themes
'
).
parseTmTheme
;
...
@@ -50,13 +48,6 @@ function listEvals(evalString) {
...
@@ -50,13 +48,6 @@ function listEvals(evalString) {
return
result
;
return
result
;
}
}
function
setTheme
(
editor
:
any
,
monaco
:
any
)
{
const
themeData
=
parseTmTheme
(
fairyflossTheme
);
monaco
.
editor
.
defineTheme
(
'
my-theme
'
,
themeData
);
monaco
.
editor
.
setTheme
(
'
my-theme
'
);
}
async
function
evaluationRun
(
async
function
evaluationRun
(
experimentId
:
string
,
experimentId
:
string
,
plugin
:
string
,
plugin
:
string
,
...
@@ -102,11 +93,7 @@ export default function Eval({
...
@@ -102,11 +93,7 @@ export default function Eval({
experimentInfoMutate
,
experimentInfoMutate
,
})
{
})
{
const
[
open
,
setOpen
]
=
useState
(
false
);
const
[
open
,
setOpen
]
=
useState
(
false
);
const
[
editModalOpen
,
setEditModalOpen
]
=
useState
(
false
);
const
[
resultsModalOpen
,
setResultsModalOpen
]
=
useState
(
false
);
const
[
selectedPlugin
,
setSelectedPlugin
]
=
useState
(
''
);
const
[
selectedPlugin
,
setSelectedPlugin
]
=
useState
(
''
);
const
[
currentEvaluator
,
setCurrentEvaluator
]
=
useState
(
''
);
const
[
currentEvaluator
,
setCurrentEvaluator
]
=
useState
(
''
);
const
{
const
{
...
@@ -122,25 +109,8 @@ export default function Eval({
...
@@ -122,25 +109,8 @@ export default function Eval({
fetcher
fetcher
);
);
const
editorRef
=
useRef
(
null
);
async
function
handleEditorDidMount
(
editor
,
monaco
)
{
if
(
editor
)
{
editorRef
.
current
=
editor
;
const
response
=
await
fetch
(
chatAPI
.
Endpoints
.
Experiment
.
GetPlugin
(
experimentInfo
.
id
,
selectedPlugin
)
);
const
text
=
await
response
.
json
();
editor
.
setValue
(
text
);
}
setTheme
(
editor
,
monaco
);
}
async
function
saveFile
()
{
async
function
saveFile
()
{
const
value
=
editorRef
?.
current
?.
getValue
();
//
const value = editorRef?.current?.getValue();
if
(
value
)
{
if
(
value
)
{
// Use fetch to post the value to the server
// Use fetch to post the value to the server
...
@@ -175,64 +145,7 @@ export default function Eval({
...
@@ -175,64 +145,7 @@ export default function Eval({
>
>
{
/* Plugins:
{
/* Plugins:
{JSON.stringify(plugins)} */
}
{JSON.stringify(plugins)} */
}
<
ResultsModal
open
=
{
resultsModalOpen
}
setOpen
=
{
setResultsModalOpen
}
experimentInfo
=
{
experimentInfo
}
plugin
=
{
selectedPlugin
}
evaluator
=
{
currentEvaluator
}
></
ResultsModal
>
<
Modal
open
=
{
editModalOpen
}
onClose
=
{
()
=>
setEditModalOpen
(
false
)
}
>
<
ModalDialog
>
<
ModalClose
onClick
=
{
()
=>
setEditModalOpen
(
false
)
}
/>
<
DialogTitle
>
Edit Evaluator Script -
{
currentEvaluator
}
</
DialogTitle
>
<
DialogContent
>
<
Sheet
color
=
"neutral"
sx
=
{
{
p
:
3
,
backgroundColor
:
'
#ddd
'
,
}
}
>
<
Editor
height
=
"600px"
width
=
"60vw"
defaultLanguage
=
"python"
theme
=
"my-theme"
options
=
{
{
minimap
:
{
enabled
:
false
,
},
fontSize
:
18
,
cursorStyle
:
'
block
'
,
wordWrap
:
'
on
'
,
}
}
onMount
=
{
handleEditorDidMount
}
/>
</
Sheet
>
</
DialogContent
>
<
Box
sx
=
{
{
mt
:
1
,
display
:
'
flex
'
,
gap
:
1
,
flexDirection
:
{
xs
:
'
column
'
,
sm
:
'
row-reverse
'
},
}
}
>
{
/* <Button sx={{ width: '120px' }}>Save</Button>
<Button
sx={{ width: '120px' }}
color="danger"
variant="soft"
onClick={() => setEditModalOpen(false)}
>
Cancel
</Button> */
}
</
Box
>
</
ModalDialog
>
</
Modal
>
<
Modal
open
=
{
open
}
onClose
=
{
()
=>
setOpen
(
false
)
}
>
<
Modal
open
=
{
open
}
onClose
=
{
()
=>
setOpen
(
false
)
}
>
<
ModalDialog
>
<
ModalDialog
>
<
ModalClose
onClick
=
{
()
=>
setOpen
(
false
)
}
/>
<
ModalClose
onClick
=
{
()
=>
setOpen
(
false
)
}
/>
...
@@ -333,7 +246,7 @@ export default function Eval({
...
@@ -333,7 +246,7 @@ export default function Eval({
<
tr
key
=
{
evaluations
.
name
}
>
<
tr
key
=
{
evaluations
.
name
}
>
<
td
style
=
{
{
overflow
:
'
hidden
'
}
}
>
{
evaluations
.
name
}
</
td
>
<
td
style
=
{
{
overflow
:
'
hidden
'
}
}
>
{
evaluations
.
name
}
</
td
>
<
td
>
<
td
>
<
Button
{
/*
<Button
variant="soft"
variant="soft"
onClick={() => {
onClick={() => {
setSelectedPlugin(evaluations.plugin);
setSelectedPlugin(evaluations.plugin);
...
@@ -342,7 +255,7 @@ export default function Eval({
...
@@ -342,7 +255,7 @@ export default function Eval({
}}
}}
>
>
Edit
Edit
</
Button
>
</Button>
*/
}
</
td
>
</
td
>
<
td
style
=
{
{
overflow
:
'
hidden
'
}
}
>
<
td
style
=
{
{
overflow
:
'
hidden
'
}
}
>
{
evaluations
?.
script_parameters
?.
task
}
{
evaluations
?.
script_parameters
?.
task
}
...
@@ -354,6 +267,7 @@ export default function Eval({
...
@@ -354,6 +267,7 @@ export default function Eval({
<
Button
<
Button
startDecorator
=
{
<
PlayIcon
/>
}
startDecorator
=
{
<
PlayIcon
/>
}
variant
=
"soft"
variant
=
"soft"
color
=
"success"
onClick
=
{
async
()
=>
onClick
=
{
async
()
=>
await
evaluationRun
(
await
evaluationRun
(
experimentInfo
.
id
,
experimentInfo
.
id
,
...
@@ -367,16 +281,6 @@ export default function Eval({
...
@@ -367,16 +281,6 @@ export default function Eval({
</
td
>
</
td
>
<
td
style
=
{
{
textAlign
:
'
right
'
}
}
>
<
td
style
=
{
{
textAlign
:
'
right
'
}
}
>
<
Stack
direction
=
"row"
>
<
Stack
direction
=
"row"
>
<
Button
variant
=
"plain"
onClick
=
{
()
=>
{
setCurrentEvaluator
(
evaluations
.
name
);
setSelectedPlugin
(
evaluations
.
plugin
);
setResultsModalOpen
(
true
);
}
}
>
View Results
</
Button
>
<
IconButton
<
IconButton
onClick
=
{
async
()
=>
{
onClick
=
{
async
()
=>
{
await
fetch
(
await
fetch
(
...
@@ -388,7 +292,7 @@ export default function Eval({
...
@@ -388,7 +292,7 @@ export default function Eval({
experimentInfoMutate
();
experimentInfoMutate
();
}
}
}
}
>
>
<
XSquare
Icon
/>
<
Trash2
Icon
/>
</
IconButton
>
</
IconButton
>
</
Stack
>
</
Stack
>
</
td
>
</
td
>
...
...
This diff is collapsed.
Click to expand it.
src/renderer/components/Experiment/Eval/EvalJobsTable.tsx
+
1
−
2
View file @
7837c773
...
@@ -67,7 +67,7 @@ const EvalJobsTable = () => {
...
@@ -67,7 +67,7 @@ const EvalJobsTable = () => {
<
td
>
{
String
(
dayjs
(
job
?.
created_at
))
}
</
td
>
<
td
>
{
String
(
dayjs
(
job
?.
created_at
))
}
</
td
>
<
td
>
{
String
(
dayjs
(
job
?.
updated_at
))
}
</
td
>
<
td
>
{
String
(
dayjs
(
job
?.
updated_at
))
}
</
td
>
<
td
>
<
td
>
<
ButtonGroup
>
<
ButtonGroup
variant
=
"soft"
>
<
Button
<
Button
onClick
=
{
()
=>
{
onClick
=
{
()
=>
{
setViewOutputFromJob
(
job
?.
id
);
setViewOutputFromJob
(
job
?.
id
);
...
@@ -75,7 +75,6 @@ const EvalJobsTable = () => {
...
@@ -75,7 +75,6 @@ const EvalJobsTable = () => {
>
>
View Output
View Output
</
Button
>
</
Button
>
<
Button
>
Cancel
</
Button
>
</
ButtonGroup
>
</
ButtonGroup
>
</
td
>
</
td
>
</
tr
>
</
tr
>
...
...
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