Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev automata validate #238

Merged
merged 50 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
56363e0
add auto update for both stable and preview (#200)
Cherwayway Dec 18, 2024
7e1f935
Prepare a form validate story
shanexi Dec 19, 2024
d6a0956
wip
shanexi Dec 19, 2024
2bd0133
Validation for intro state, note node, optimization and fixes (#214)
tiancheng-myshell Dec 20, 2024
2124b79
Build: make storybook work
shanexi Dec 22, 2024
b2c6ed9
Build: storybook apply @shellagent/ui styles
shanexi Dec 22, 2024
fe3da8d
Merge branch '208-validate-automata' of github.com:myshell-ai/ShellAg…
shanexi Dec 22, 2024
b42d0db
simple demo
shanexi Dec 22, 2024
89f0347
Fix lint
shanexi Dec 22, 2024
fbe6c6d
Fix lint
shanexi Dec 23, 2024
3d01fe9
demo of related fields validate
shanexi Dec 24, 2024
5ea67a3
Add doc
shanexi Dec 24, 2024
62a3d4d
feat: add proconfig zod schema
myshell-joe Dec 27, 2024
62dc006
feat: pull origin
ikun97 Dec 30, 2024
64de8ce
Merge branch 'beta' of github.com:myshell-ai/ShellAgent into dev-auto…
ikun97 Dec 30, 2024
16e1738
feat: customValidateRender (#229)
ikun97 Dec 30, 2024
10affeb
wip
myshell-joe Dec 30, 2024
4bca32e
Merge branch 'dev-automata-validate' of github.com:myshell-ai/ShellAg…
myshell-joe Dec 30, 2024
bfee43f
wip
myshell-joe Dec 30, 2024
54aa8bb
Merge branch 'beta' of github.com:myshell-ai/ShellAgent into dev-auto…
myshell-joe Dec 30, 2024
e454ef3
add customkey schema
myshell-joe Dec 30, 2024
8642d27
feat: validate
ikun97 Dec 31, 2024
c9c6ca4
schema validate
myshell-joe Dec 31, 2024
8bafbb3
Merge branch 'beta' of github.com:myshell-ai/ShellAgent into dev-auto…
myshell-joe Dec 31, 2024
8719f11
feat: ip check
myshell-joe Dec 31, 2024
99a2f60
Merge branch 'beta' of github.com:myshell-ai/ShellAgent into dev-auto…
myshell-joe Dec 31, 2024
8bebfd4
add status boder && customkey validate rewrite
myshell-joe Dec 31, 2024
803abab
fix
myshell-joe Jan 2, 2025
b0117ad
lint
myshell-joe Jan 2, 2025
939bf43
lint
myshell-joe Jan 2, 2025
192debe
fix: node status
myshell-joe Jan 2, 2025
0d72c89
remove gloabl validate render
myshell-joe Jan 2, 2025
2e78359
Merge branch 'beta' of github.com:myshell-ai/ShellAgent into dev-auto…
myshell-joe Jan 2, 2025
7611e7d
feat: inline validator
ikun97 Jan 2, 2025
f3bd786
Merge branch 'dev-automata-validate' of github.com:myshell-ai/ShellAg…
ikun97 Jan 2, 2025
6d63218
fix
myshell-joe Jan 2, 2025
a301cfa
Merge branch 'dev-automata-validate' of github.com:myshell-ai/ShellAg…
myshell-joe Jan 2, 2025
3475eda
feat: ip check done
myshell-joe Jan 2, 2025
7d4c8f7
Merge branch 'beta' of github.com:myshell-ai/ShellAgent into dev-auto…
myshell-joe Jan 2, 2025
aa7000d
fix: custom validator rules
myshell-joe Jan 2, 2025
ffdefe6
lint
myshell-joe Jan 2, 2025
f3d1396
fix form dialog global validation
myshell-joe Jan 3, 2025
3274876
fix form dialog global validation
myshell-joe Jan 3, 2025
59a557e
fix input validate issues update
myshell-joe Jan 3, 2025
2c0c518
lint
myshell-joe Jan 3, 2025
23bd6bf
Merge branch 'beta' of github.com:myshell-ai/ShellAgent into dev-auto…
myshell-joe Jan 6, 2025
4578149
optimize intro validation text
myshell-joe Jan 6, 2025
3d8057a
feat: add button validation
myshell-joe Jan 6, 2025
b74e04f
feat: add button validation
myshell-joe Jan 6, 2025
57255b6
Merge branch 'beta' of github.com:myshell-ai/ShellAgent into dev-auto…
myshell-joe Jan 9, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion web/apps/web/src/app/app/detail/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ import { HTML5Backend } from 'react-dnd-html5-backend';
import { edgeTypes, materialList, nodeTypes } from '@/components/app/constants';
import FlowHeader from '@/components/app/flow-header';
import { Header } from '@/components/app/header';
import { ComfyUIEditorModal } from '@/components/app/plugins/comfyui/widgets/comfyui-editor';
import { ValidationDialog } from '@/components/app/validation-dialog';
import { AppBuilderChatModel } from '@/components/chat/app-builder-chat.model';
import { ListFooterExtra } from '@/components/common/list-footer-extra';
import { ImageCanvasDialog } from '@/components/image-canvas/open-image-canvas';
import { AppBuilderModel } from '@/stores/app/models/app-builder.model';
import { useAppState } from '@/stores/app/use-app-state';
import { ComfyUIEditorModal } from '@/components/app/plugins/comfyui/widgets/comfyui-editor';

enableMapSet();

Expand Down Expand Up @@ -109,6 +110,7 @@ const FlowEngineWrapper = observer(
<FlowHeader appId={appId} versionName={versionName} />
<StateConfigSheet />
<TransitionSheet />
<ValidationDialog />
</div>
}
onDoubleClick={onDoubleClick}
Expand Down
10 changes: 8 additions & 2 deletions web/apps/web/src/app/container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import { ImageCanvasModel } from 'image-canvas/model';
import { Container, ContainerModule, interfaces } from 'inversify';
import * as Mobx from 'mobx';
import { toast } from 'react-toastify';

import { ComfyUIModel } from '@/components/app/plugins/comfyui/comfyui.model';
import { AssistantModel } from '@/components/assistant/model';
import { FeedbackModel } from '@/components/feedback/model';
import { AppBuilderChatModel } from '@/components/chat/app-builder-chat.model';
import { DownloadModel } from '@/components/download/download.model';
import { FeedbackModel } from '@/components/feedback/model';
import { OpenImageCanvasModel } from '@/components/image-canvas/open-image-canvas.model';
import { ModelsCommonModel } from '@/components/manager/manager-content/models/models-common.model';
import { ModelsInstalledModel } from '@/components/manager/manager-content/models/models-installed.model';
Expand Down Expand Up @@ -103,7 +104,8 @@ export const webModule = new ContainerModule(bind => {
bind<ComfyUIModel>('ComfyUIModel').to(ComfyUIModel).inSingletonScope();

// refactor app builder
bind<AppBuilderModel>('AppBuilderModel')
container
.bind<AppBuilderModel>('AppBuilderModel')
.to(AppBuilderModel)
.inSingletonScope()
.onActivation((_ctx: interfaces.Context, model: AppBuilderModel) => {
Expand All @@ -120,6 +122,10 @@ export const webModule = new ContainerModule(bind => {
(window as any)._get_app_builder_scopes = function () {
return model.scopes;
};
/* eslint-disable no-underscore-dangle, func-names */
(window as any)._get_app_builder_validate_issues = function () {
return Mobx.toJS(model.validateIssues);
};
}
return model;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { TValues } from '@shellagent/form-engine';

import NodeForm from '@/components/app/node-form';
import { buttonConfigSchema } from '@/stores/app/schema/button-config';
import { useAppState } from '@/stores/app/use-app-state';
import { buttonConfigSchema } from '@/stores/app/utils/schema';

interface ButtonConfigProps {
values: TValues;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useCallback, useEffect, useMemo } from 'react';

import NodeForm from '@/components/app/node-form';
import { getPlugin } from '@/components/app/plugins';
import { getSchemaByWidget } from '@/stores/app/utils/get-widget-schema';
import { getSchemaByWidget } from '@/stores/app/schema/get-widget-schema';
import { useWorkflowStore } from '@/stores/workflow/workflow-provider';

export interface WidgetConfigProps {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { useCallback, useEffect, useMemo } from 'react';

import NodeForm from '@/components/app/node-form';
import { AppBuilderModel } from '@/stores/app/models/app-builder.model';
import { getWorkflowSchema } from '@/stores/app/utils/get-workflow-schema';
import { getWorkflowSchema } from '@/stores/app/schema/get-workflow-schema';
import { useWorkflowStore } from '@/stores/workflow/workflow-provider';

interface WorkflowConfigProps {
Expand Down
1 change: 1 addition & 0 deletions web/apps/web/src/components/app/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const defaultFlow: IFlow = {
data: {
type: NodeTypeEnum.start,
id: NodeIdEnum.start,
display_name: 'Start',
},
selected: false,
positionAbsolute: {
Expand Down
63 changes: 46 additions & 17 deletions web/apps/web/src/components/app/editable-title/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
'use client';

import { PencilSquare, Heading, Input } from '@shellagent/ui';
import { PencilSquare, Heading, Input, Text } from '@shellagent/ui';
import { debounce } from 'lodash-es';
import { useState, useEffect } from 'react';

import { validateCustomKey } from '@/stores/app/utils/validator';

interface EditableTitleProps {
value: string;
onChange: (value: string) => void;
Expand All @@ -14,15 +17,34 @@ export const EditableTitle: React.FC<EditableTitleProps> = ({
}) => {
const [isEditing, setIsEditing] = useState(false);
const [titleInput, setTitleInput] = useState(value);
const [error, setError] = useState<string | null>(null);

useEffect(() => {
setTitleInput(value);
}, [value]);

const validateDebounced = debounce(async (input: string) => {
try {
await validateCustomKey(input);
} catch (err: any) {
setError(err);
}
}, 300);

useEffect(() => {
if (isEditing && titleInput !== value) {
validateDebounced(titleInput);
}
return () => {
validateDebounced.cancel();
};
}, [titleInput, isEditing]);

const handleTitleChange = () => {
if (titleInput.trim() === '') {
if (titleInput.trim() === '' || error) {
setTitleInput(value);
setIsEditing(false);
setError(null);
return;
}
onChange(titleInput.trim());
Expand All @@ -31,21 +53,28 @@ export const EditableTitle: React.FC<EditableTitleProps> = ({

if (isEditing) {
return (
<div className="flex items-center">
<Input
aria-label="Edit title"
className="max-w-[200px] h-7 rounded-lg border border-default bg-surface-search-field p-1.5 text-sm"
autoFocus
value={titleInput}
onChange={e => setTitleInput(e.target.value)}
onKeyDown={e => {
if (e.key === 'Enter') {
handleTitleChange();
}
}}
onBlur={handleTitleChange}
maxLength={50}
/>
<div className="flex flex-col gap-1">
<div className="flex items-center">
<Input
aria-label="Edit title"
className="max-w-[200px] h-7 rounded-lg border border-default bg-surface-search-field p-1.5 text-sm"
autoFocus
value={titleInput}
onChange={e => setTitleInput(e.target.value)}
onKeyDown={e => {
if (e.key === 'Enter') {
handleTitleChange();
}
}}
onBlur={handleTitleChange}
maxLength={50}
/>
</div>
{error && (
<Text size="sm" color="critical">
{error}
</Text>
)}
</div>
);
}
Expand Down
Loading
Loading