Skip to content
Snippets Groups Projects
Commit fb4d2f23 authored by ali asaria's avatar ali asaria
Browse files

render an introduction to a plugin

parent c7be2b56
Branches
Tags
No related merge requests found
...@@ -2,7 +2,8 @@ import { useState, FormEvent, useEffect } from 'react'; ...@@ -2,7 +2,8 @@ import { useState, FormEvent, useEffect } from 'react';
import useSWR from 'swr'; import useSWR from 'swr';
import * as chatAPI from 'renderer/lib/transformerlab-api-sdk'; import * as chatAPI from 'renderer/lib/transformerlab-api-sdk';
import Markdown from 'react-markdown';
import remarkGfm from 'remark-gfm';
import { import {
Button, Button,
FormControl, FormControl,
...@@ -32,9 +33,29 @@ const DefaultLoraConfig = { ...@@ -32,9 +33,29 @@ const DefaultLoraConfig = {
}; };
import { generateFriendlyName } from 'renderer/lib/utils'; import { generateFriendlyName } from 'renderer/lib/utils';
const fetcher = (url) => fetch(url).then((res) => res.json()); const fetcher = (url) => fetch(url).then((res) => res.json());
function PluginIntroduction({ experimentInfo, pluginId }) {
const { data, error, isLoading } = useSWR(
chatAPI.Endpoints.Experiment.ScriptGetFile(
experimentInfo?.id,
pluginId,
'info.md'
),
fetcher
);
return (
<>
<Markdown remarkPlugins={[remarkGfm]} className="editableSheetContent">
{data && data != 'FILE NOT FOUND'
? data
: 'No description for this plugin is availabe.'}
</Markdown>
</>
);
}
export default function TrainingModalLoRA({ export default function TrainingModalLoRA({
open, open,
onClose, onClose,
...@@ -258,15 +279,22 @@ export default function TrainingModalLoRA({ ...@@ -258,15 +279,22 @@ export default function TrainingModalLoRA({
sx={{ borderRadius: 'lg', display: 'flex', overflow: 'hidden' }} sx={{ borderRadius: 'lg', display: 'flex', overflow: 'hidden' }}
> >
<TabList> <TabList>
<Tab>1. Name</Tab> <Tab>Introduction</Tab>
<Tab>2. Data</Tab> <Tab>Name</Tab>
<Tab>3. Plugin Config</Tab> <Tab>Data</Tab>
<Tab>Plugin Config</Tab>
</TabList> </TabList>
<TabPanel value={0} sx={{ p: 2, overflow: 'auto' }} keepMounted> <TabPanel value={0} sx={{ p: 2, overflow: 'auto' }}>
<PluginIntroduction
experimentInfo={experimentInfo}
pluginId={pluginId}
/>
</TabPanel>
<TabPanel value={1} sx={{ p: 2, overflow: 'auto' }} keepMounted>
<TrainingModalFirstTab /> <TrainingModalFirstTab />
</TabPanel> </TabPanel>
<TabPanel value={1} sx={{ p: 2, overflow: 'auto' }} keepMounted> <TabPanel value={2} sx={{ p: 2, overflow: 'auto' }} keepMounted>
<TrainingModalDataTab <TrainingModalDataTab
datasetsIsLoading={datasetsIsLoading} datasetsIsLoading={datasetsIsLoading}
datasets={datasets} datasets={datasets}
...@@ -280,7 +308,7 @@ export default function TrainingModalLoRA({ ...@@ -280,7 +308,7 @@ export default function TrainingModalLoRA({
pluginId={pluginId} pluginId={pluginId}
/> />
</TabPanel> </TabPanel>
<TabPanel value={2} sx={{ p: 2, overflow: 'auto' }} keepMounted> <TabPanel value={3} sx={{ p: 2, overflow: 'auto' }} keepMounted>
<DynamicPluginForm <DynamicPluginForm
experimentInfo={experimentInfo} experimentInfo={experimentInfo}
plugin={pluginId} plugin={pluginId}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment