Skip to content

Commit

Permalink
fix: ci
Browse files Browse the repository at this point in the history
  • Loading branch information
BroKun committed Sep 8, 2024
1 parent d48687c commit 413b252
Show file tree
Hide file tree
Showing 11 changed files with 51 additions and 39 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ pnpm-lock.yaml
**/dist
**/coverage
**/es
packages/**/static

# generated code
**/.dumi/tmp
Expand Down
2 changes: 1 addition & 1 deletion web-packages/magent-core/jest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import configs from '../../../jest.config.mjs';
import configs from '../../jest.config.mjs';

export default {
...configs,
Expand Down
22 changes: 11 additions & 11 deletions web-packages/magent-flow/.eslintrc.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ module.exports = {
curly: 'error',

// stricter type correctness
// 'no-unused-vars': [
// 'warn',
// {
// vars: 'local',
// args: 'none',
// destructuredArrayIgnorePattern: '^_',
// ignoreRestSiblings: true,
// argsIgnorePattern: '^_',
// caughtErrors: 'none',
// },
// ],
'no-unused-vars': [
'warn',
{
vars: 'local',
args: 'none',
destructuredArrayIgnorePattern: '^_',
ignoreRestSiblings: true,
argsIgnorePattern: '^_',
caughtErrors: 'none',
},
],
'@typescript-eslint/no-namespace': 'off',
'@typescript-eslint/no-explicit-any': ['warn', { ignoreRestArgs: true }],
'@typescript-eslint/no-shadow': [
Expand Down
2 changes: 1 addition & 1 deletion web-packages/magent-flow/jest.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import configs from '../../../jest.config.mjs';
import configs from '../../jest.config.mjs';

export default {
...configs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import ReactDOM from 'react-dom';

import { useBasicTypeaheadTriggerMatch } from '../../hooks.js';
import type { ExternalToolBlockType, VariableBlockType } from '../../types.js';
import { $splitNodeContainingQuery } from '../../utils.js';
// import { $splitNodeContainingQuery } from '../../utils.js';
import { INSERT_VARIABLE_VALUE_BLOCK_COMMAND } from '../variable-block/index.js';

import { useOptions } from './hooks.js';
Expand Down Expand Up @@ -70,19 +70,19 @@ const ComponentPicker = ({
[editor],
);

const handleSelectWorkflowVariable = useCallback(
(variables: string[]) => {
editor.update(() => {
const needRemove = $splitNodeContainingQuery(
checkForTriggerMatch(triggerString, editor)!,
);
if (needRemove) {
needRemove.remove();
}
});
},
[editor, checkForTriggerMatch, triggerString],
);
// const handleSelectWorkflowVariable = useCallback(
// (variables: string[]) => {
// editor.update(() => {
// const needRemove = $splitNodeContainingQuery(
// checkForTriggerMatch(triggerString, editor)!,
// );
// if (needRemove) {
// needRemove.remove();
// }
// });
// },
// [editor, checkForTriggerMatch, triggerString],
// );

const renderMenu = useCallback<MenuRenderFn<PickerBlockMenuOption>>(
(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { classNames } from '@flow/utils/basic.js';
import { Popover, Tag } from 'antd';

export type RunStatus = 'success' | 'processing' | 'warning' | 'error';
export type RunStatusTypes = 'success' | 'processing' | 'warning' | 'error';

export const RunStatusMap = {
['success']: {
Expand All @@ -27,7 +27,7 @@ export const RunStatusMap = {
};

export interface RunResStatus {
status: keyof RunStatus;
status: RunStatusTypes;
runDuration: number;
runInput?: Record<string, string>;
runOutput?: Record<string, string>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ export const NodesPanel = (props: NodesPanelProps) => {
<Input.Search
placeholder="Search"
onChange={(e) => {
nodes.filter((node) => node.name.includes(e.target.value));
nodes.filter((node) => node.name?.includes(e.target.value));
}}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { SchemaValueType, ValueType } from '@flow/interfaces/flow.js';
import { Input } from 'antd';
import type { DefaultOptionType } from 'antd/es/cascader';

import type { SchemaValueType, ValueType } from '@flow/interfaces/flow.js';

import { CascaderInNode } from '../AIBasic/CascaderInNode/index.js';
import { SelectInNode } from '../AIBasic/SelectInNode/index.js';

Expand Down Expand Up @@ -43,10 +42,10 @@ export const ReferenceSelect = (props: {
<CascaderInNode
style={{ width: 120 }}
value={value?.content || []}
onChange={(val: [string, string]) =>
onChange={(val: (string | number | null)[]) =>
onChange?.({
type: value?.type || 'reference',
content: val,
content: val as [string, string],
})
}
options={refOptions}
Expand Down
8 changes: 8 additions & 0 deletions web-packages/magent-flow/src/index.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import 'reflect-metadata';
import assert from 'assert';

describe('magent-core', () => {
it('#import', () => {
assert(true);
});
});
13 changes: 9 additions & 4 deletions web-packages/magent-flow/src/stores/useFlowStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { cloneDeep } from 'lodash';
import { create } from 'zustand';

interface AdjacencyList {
[key: number]: number[];
[key: string]: string[];
}

interface FlowStoreType {
Expand Down Expand Up @@ -98,6 +98,10 @@ export const useFlowStore = create<FlowStoreType>((set, get) => {
nodes: graph.nodes,
edges: graph.edges,
});
return {
nodes: graph.nodes,
edges: graph.edges,
};
},
reactFlowInstance: null,
setReactFlowInstance: (newState) => {
Expand Down Expand Up @@ -271,14 +275,14 @@ export const useFlowStore = create<FlowStoreType>((set, get) => {

selection.nodes.forEach((node: Node) => {
// Generate a unique node ID
const newId = getNodeId(node.data.type as string);
const newId = getNodeId(node.data['type'] as string);

// idsMap[node.id] = newId;

// Create a new node object
const newNode: NodeType = {
id: newId,
type: node.data.type,
type: node.data['type'] as string,
position: {
x: insidePosition.x + node.position!.x - minimumX,
y: insidePosition.y + node.position!.y - minimumY,
Expand All @@ -297,7 +301,8 @@ export const useFlowStore = create<FlowStoreType>((set, get) => {

// Add the new node to the list of nodes in state
newNodes = newNodes
.map((node) => ({ ...node, selected: false }))
// eslint-disable-next-line @typescript-eslint/no-shadow
.map((node) => ({ ...node, selected: false }) as any)
.concat({ ...newNode, selected: false });
});
get().setNodes(newNodes);
Expand Down
1 change: 0 additions & 1 deletion web-packages/magent-flow/src/stores/useModelStore.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { BasicSchema } from '@flow/interfaces/flow.js';
import type React from 'react';
import { create } from 'zustand';

// 注册 模型选择和配置组件 提供onChange事件
Expand Down

0 comments on commit 413b252

Please sign in to comment.