mirror of
https://github.com/nocobase/nocobase.git
synced 2026-10-24 23:59:02 +08:00
fix: parseWorkContext's changel lost
This commit is contained in:
@@ -40,7 +40,8 @@ const walkthrough = (
|
||||
export const AddContextButton: React.FC<{
|
||||
onAdd: (item: ContextItem) => void;
|
||||
disabled?: boolean;
|
||||
}> = ({ onAdd, disabled }) => {
|
||||
ignore?: (key: string, workContext: WorkContextOptions) => boolean;
|
||||
}> = ({ onAdd, disabled, ignore }) => {
|
||||
const t = useT();
|
||||
const flowEngine = useFlowEngine();
|
||||
const plugin = usePlugin('ai') as PluginAIClient;
|
||||
@@ -56,8 +57,11 @@ export const AddContextButton: React.FC<{
|
||||
if (!contextItem.menu) {
|
||||
return;
|
||||
}
|
||||
|
||||
const key = parent ? `${parent}.${contextItem.name}` : contextItem.name;
|
||||
if (ignore?.(key, contextItem) ?? false) {
|
||||
return;
|
||||
}
|
||||
|
||||
const C = contextItem.menu.Component;
|
||||
const item: MenuProps['items'] = {
|
||||
key,
|
||||
|
||||
+5
-1
@@ -27,7 +27,11 @@ export const SenderFooter: React.FC<{
|
||||
return (
|
||||
<Flex justify="space-between" align="center">
|
||||
<Flex gap="small" align="center">
|
||||
<AddContextButton onAdd={addContextItems} disabled={!currentEmployee} />
|
||||
<AddContextButton
|
||||
onAdd={addContextItems}
|
||||
disabled={!currentEmployee}
|
||||
ignore={(key) => key === 'flow-model.variable'}
|
||||
/>
|
||||
<Divider type="vertical" />
|
||||
<Upload />
|
||||
</Flex>
|
||||
|
||||
@@ -97,7 +97,7 @@ export const parseWorkContext = (app: Application, workContext: ContextItem[]) =
|
||||
parsed.push(context);
|
||||
continue;
|
||||
}
|
||||
const contextOptions = plugin.aiManager.workContext.get(context.type);
|
||||
const contextOptions = plugin.aiManager.getWorkContext(context.type);
|
||||
if (!(contextOptions && contextOptions.getContent)) {
|
||||
parsed.push(context);
|
||||
continue;
|
||||
|
||||
+1
-1
@@ -49,7 +49,7 @@ const toSimplifyForm = (model: FormModel) => {
|
||||
result.fields.push({
|
||||
name: collectionField.name,
|
||||
type: collectionField.type,
|
||||
title: collectionField.title,
|
||||
// title: collectionField.title,
|
||||
enum: collectionField.enum,
|
||||
readonly: collectionField.readonly,
|
||||
defaultValue: collectionField.defaultValue,
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ BlockModel.registerFlow({
|
||||
return;
|
||||
}
|
||||
aiSelection.selector?.onSelect({ uid: ctx.model.uid });
|
||||
ctx.message.info(`Selected Block: ${ctx.model.title}(${ctx.model.uid})`);
|
||||
// ctx.message.info(`Selected Block: ${ctx.model.title}(${ctx.model.uid})`);
|
||||
},
|
||||
onMouseEnter: (e: Event) => {
|
||||
onMouseEnter?.(e);
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
|
||||
import { CollectionBlockModel } from '@nocobase/client';
|
||||
import { FlowModel } from '@nocobase/flow-engine';
|
||||
import _ from 'lodash';
|
||||
|
||||
export class FlowUtils {
|
||||
static getSubModels(model: FlowModel) {
|
||||
|
||||
@@ -154,7 +154,7 @@ export type WorkContextOptions = {
|
||||
menu?: {
|
||||
icon?: React.ReactNode;
|
||||
label?: React.ReactNode;
|
||||
Component?: ComponentType;
|
||||
Component?: ComponentType<{ onAdd?: (item: Omit<ContextItem, 'type'>) => void }>;
|
||||
clickHandler?: (props: { flowEngine: FlowEngine; onAdd: (item: Omit<ContextItem, 'type'>) => void }) => () => void;
|
||||
};
|
||||
tag?: {
|
||||
|
||||
Reference in New Issue
Block a user