Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
myshell-joe committed Jan 16, 2025
1 parent 43fe5e1 commit 8b7bb40
Show file tree
Hide file tree
Showing 17 changed files with 46 additions and 36 deletions.
3 changes: 3 additions & 0 deletions web/apps/web/src/components/app/header/publish/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
} from '@shellagent/ui';
import { Dropdown } from 'antd';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import { useInjection } from 'inversify-react';
import { isEmpty } from 'lodash-es';
import { observer } from 'mobx-react-lite';
Expand All @@ -30,6 +31,8 @@ import { cn } from '@/utils/cn';

import VersionSkeleton from '../skeleton';

dayjs.extend(relativeTime);

interface PublishProps {
app_id: string;
version_name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import { useReactFlowStore, NodeTypeEnum } from '@shellagent/flow-engine';
import { type TransitionData } from '@shellagent/shared/protocol/transition';
import { TransitionTargetEnum } from '@shellagent/shared/protocol/transition';
import { getNewKey } from '@shellagent/shared/utils';
import { Drawer } from '@shellagent/ui';
import { useInjection } from 'inversify-react';
Expand All @@ -14,7 +15,6 @@ import { AppBuilderModel } from '@/stores/app/models/app-builder.model';
import { getXTransitionSchema } from '@/stores/app/schema/get-transition-schema';
import { SchemaProvider } from '@/stores/app/schema-provider';
import { useAppState } from '@/stores/app/use-app-state';
import { TransitionTargetEnum } from '@shellagent/shared/protocol/transition';

const TransitionSheetNew: React.FC<{}> = observer(() => {
const appBuilder = useInjection<AppBuilderModel>('AppBuilderModel');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import { customSnakeCase, getTaskDisplayName } from '@shellagent/shared/utils';
import { Button, useFormContext, Drag } from '@shellagent/ui';
import { useClickAway } from 'ahooks';
import { Dropdown } from 'antd';
import { useInjection } from 'inversify-react';
import { useState, useRef, useCallback } from 'react';
import { useDrag, useDrop } from 'react-dnd';

import { materialList } from '@/components/app/constants';
import { TaskList } from '@/components/app/task-list';
import { useAppState } from '@/stores/app/use-app-state';
import { useInjection } from 'inversify-react';
import { AppBuilderModel } from '@/stores/app/models/app-builder.model';
import { useAppState } from '@/stores/app/use-app-state';

const TaskItem = ({
name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ import {
LOCATION_TIP,
MessageType,
} from '@/components/app/plugins/comfyui/constant';
import {
defaultSchema,
getComfyUISchema,
} from '@/components/app/plugins/comfyui/schema';
import {
checkJsonExist,
getFile,
saveComfy,
getCwdSvc,
updateDependency,
} from '@/components/app/plugins/comfyui/services';
import {
defaultSchema,
getComfyUISchema,
} from '@/components/app/plugins/comfyui/schema';
import {
GetFileResponse,
type SaveRequest,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { APIFetch } from '@/services/base';
import type { Fetcher } from 'swr';

import { APIFetch } from '@/services/base';

import {
GetFileRequest,
GetFileResponse,
Expand Down
5 changes: 2 additions & 3 deletions web/apps/web/src/components/chat/app-builder-chat.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import { action, makeObservable, observable, runInAction } from 'mobx';
import { ButtonFnParams, IMLocalFile } from 'myshell-bundled-chat';
import { JsonSchema7 } from 'node_modules/@shellagent/form-engine/src/types/jsonSchema7';

import { convertXBotSvc } from '@/services/app';
import { convertXBotSvc, initBot } from '@/services/app';
import { baseHeaders } from '@/services/base';
import { upload } from '@/services/common';
import { type AppBuilderModel } from '@/stores/app/models/app-builder.model';

Expand All @@ -22,8 +23,6 @@ import {
import type { ServerMessage } from '../../services/app/message-type';
import { EventStatusEnum, RunAppRequest } from '../../services/app/type';
import { ToastModel } from '../../utils/toast.model';
import { initBot } from '@/services/app';
import { baseHeaders } from '@/services/base';

@injectable()
export class AppBuilderChatModel {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import Audio from '@/components/common/uploader/display/audio';
import Image from '@/components/common/uploader/display/image';
import Other from '@/components/common/uploader/display/other';
import Video from '@/components/common/uploader/display/video';
import { ENABLE_PREVIEW_FILE, getLocalTypeBySuffix } from '@/utils/file-types';
import { getFileUrl } from '@/utils/common-helper';
import { ENABLE_PREVIEW_FILE, getLocalTypeBySuffix } from '@/utils/file-types';

type DisplayType = 'audio' | 'video' | 'image' | 'other';

Expand Down
2 changes: 2 additions & 0 deletions web/apps/web/src/components/home/detail-form/type-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,15 @@ export const TypeSelect: React.FC<TypeSelectProps> = ({
<label
data-value={option.value}
key={option.value}
htmlFor={`type-select-${option.value}`}
className={cn(
'flex h-10 pl-3.5 py-2.5 pr-3 items-center rounded-lg border cursor-pointer',
actualValue === option.value && 'border-[#3E5CFA]',
)}>
<div className="flex items-center justify-center w-full">
{option.label}
<Checkbox
id={`type-select-${option.value}`}
onCheckedChange={() => handleSelect(option.value)}
checked={actualValue === option.value}
className="ml-auto rounded-full"
Expand Down
8 changes: 5 additions & 3 deletions web/apps/web/src/components/home/filter-tabs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ const FilterTabsBase = ({ className }: { className?: string }) => {

const setFilter = (newFilter: AppType) => {
const params = new URLSearchParams(searchParams);
newFilter === 'all'
? params.delete('app_type')
: params.set('app_type', newFilter);
if (newFilter === 'all') {
params.delete('app_type');
} else {
params.set('app_type', newFilter);
}
router.push(`?${params.toString()}`);
};

Expand Down
3 changes: 1 addition & 2 deletions web/apps/web/src/components/home/flow-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
} from '@shellagent/ui';
import { useRequest } from 'ahooks';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import Link from 'next/link';
import { useState } from 'react';
import { toast } from 'react-toastify';
Expand All @@ -37,8 +38,6 @@ import { DeleteDialog } from '../delete-dialog';
import { EditDialog } from '../edit-dialog';
import { SaveTemplateDialog } from '../save-template-dialog';

const relativeTime = require('dayjs/plugin/relativeTime');

dayjs.extend(relativeTime);

interface FlowCardProps {
Expand Down
18 changes: 9 additions & 9 deletions web/apps/web/src/components/settings/settings.model.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,6 @@
import { inject, injectable, postConstruct } from 'inversify';
import { action, makeObservable, observable } from 'mobx';

import { FormikModel } from '@/utils/formik.model';
import { ModalModel } from '@/utils/modal.model';
import { ToastModel } from '@/utils/toast.model';

import {
DefaultEnvs,
DefaultEnvsMap,
SettingEnvFormValue,
} from './settings-definitions';
import {
autoUpdateSvc,
checkRepoStatusSvc,
Expand All @@ -23,6 +14,15 @@ import {
updateChannelSvc,
updateSvc,
} from '@/services/app';
import { FormikModel } from '@/utils/formik.model';
import { ModalModel } from '@/utils/modal.model';
import { ToastModel } from '@/utils/toast.model';

import {
DefaultEnvs,
DefaultEnvsMap,
SettingEnvFormValue,
} from './settings-definitions';

export type SidebarValue = 'Environment' | 'SoftwareUpdate';

Expand Down
3 changes: 3 additions & 0 deletions web/apps/web/src/components/settings/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import {
} from '@shellagent/ui';
import { Button, Card, Divider, Form, Input, Modal, Switch, theme } from 'antd';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import { Field, FieldArray, FieldProps, Formik } from 'formik';
import { useInjection } from 'inversify-react';
import { observer } from 'mobx-react-lite';
Expand All @@ -30,6 +31,8 @@ import {
import { SettingsSideBar } from './settings-sidebar';
import { SettingsModel } from './settings.model';

dayjs.extend(relativeTime);

export const EnvForm = observer(() => {
const model = useInjection(SettingsModel);
useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion web/apps/web/src/components/workflow/flow-header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ const FlowHeader: React.FC<{ flowId: string; version_name?: string }> = ({
onSuccess: result => {
if (result.success) {
setAutoSavedSuccess(true);
setAutoSavedTime(dayjs().valueOf());
setAutoSavedTime(dayjs().valueOf().toString());
} else {
setAutoSavedSuccess(false);
}
Expand Down
9 changes: 4 additions & 5 deletions web/apps/web/src/components/workflow/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
} from '@shellagent/ui';
import { useBoolean, useDebounce, useRequest, useUpdateEffect } from 'ahooks';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import { isEmpty } from 'lodash-es';
import dynamic from 'next/dynamic';
import Link from 'next/link';
Expand All @@ -48,6 +49,8 @@ import { deleteKey } from '@/utils/common-helper';

import VersionSkeleton from './skeleton';

dayjs.extend(relativeTime);

const RunSheet = dynamic(() => import('@/components/workflow/run-sheet'), {
ssr: false,
});
Expand All @@ -59,10 +62,6 @@ const ImportModal = dynamic(
},
);

const relativeTime = require('dayjs/plugin/relativeTime');

dayjs.extend(relativeTime);

export const Header: React.FC<{ container: HTMLElement | null }> = ({
container,
}) => {
Expand Down Expand Up @@ -149,7 +148,7 @@ export const Header: React.FC<{ container: HTMLElement | null }> = ({
manual: true,
onSuccess: result => {
if (result.success) {
setAutoSavedTime(dayjs().valueOf());
setAutoSavedTime(dayjs().valueOf().toString());
}
},
onError: () => {
Expand Down
1 change: 1 addition & 0 deletions web/apps/web/src/services/common/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { toast } from 'react-toastify';

import { APIFetch } from '../base';

export interface UploadResponse {
Expand Down
5 changes: 3 additions & 2 deletions web/apps/web/src/stores/app/models/flow.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import { Edge, Node } from '@shellagent/flow-engine';
import { injectable } from 'inversify';
import { makeAutoObservable } from 'mobx';

import { EdgeDataTypeEnum, CustomEdgeData } from '@/components/app/edges';
import { CustomEdgeData } from '@/components/app/edges';
import { TransitionTargetEnum } from '@shellagent/shared/protocol/transition';

type SheetMode = 'button' | 'workflow' | 'widget' | '';

Expand Down Expand Up @@ -138,7 +139,7 @@ export class FlowModel {
id: '',
custom: true,
event_key: '',
type: EdgeDataTypeEnum.ALWAYS,
type: TransitionTargetEnum.ALWAYS,
target: '',
conditions: [],
};
Expand Down
3 changes: 2 additions & 1 deletion web/apps/web/src/stores/app/utils/validator.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { getFileUrl } from '@/utils/common-helper';
import { IFlow } from '@shellagent/flow-engine';
import { Automata } from '@shellagent/pro-config';
import {
Expand All @@ -8,6 +7,8 @@ import {
import { Issue } from '@shellagent/shared/type';
import { customSnakeCase } from '@shellagent/shared/utils';

import { getFileUrl } from '@/utils/common-helper';

// 整体automata校验
export const validateAutomata = async (
automata: Automata,
Expand Down

0 comments on commit 8b7bb40

Please sign in to comment.