Support simpleApp select workflow (#2772)

* fix: share page id error

* feat: simple workflow support childApp tool

* perf: aichat box animation
This commit is contained in:
Archer
2024-09-23 15:43:57 +08:00
committed by shilin66
parent 66b2eb3a0b
commit 8e0edaace1
14 changed files with 83 additions and 51 deletions

View File

@@ -378,7 +378,23 @@ export function form2AppWorkflow(
y: 545
},
version: tool.version,
inputs: tool.inputs,
inputs: tool.inputs.map((input) => {
// Special key value
if (input.key === NodeInputKeyEnum.forbidStream) {
input.value = true;
}
// Special tool
if (
tool.flowNodeType === FlowNodeTypeEnum.appModule &&
input.key === NodeInputKeyEnum.history
) {
return {
...input,
value: formData.aiSettings.maxHistories
};
}
return input;
}),
outputs: tool.outputs
}
],

View File

@@ -1,25 +1,34 @@
import { create } from 'zustand';
import { devtools, persist } from 'zustand/middleware';
import { immer } from 'zustand/middleware/immer';
import { customAlphabet } from 'nanoid';
const nanoid = customAlphabet(
'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWSYZ1234567890_',
24
);
type State = {
localUId: string;
setLocalUId: (id: string) => void;
loaded: boolean;
};
export const useShareChatStore = create<State>()(
devtools(
persist(
immer((set, get) => ({
localUId: '',
setLocalUId(id) {
set((state) => {
state.localUId = id;
});
}
localUId: `shareChat-${Date.now()}-${nanoid()}`,
loaded: false
})),
{
name: 'shareChatStore'
name: 'shareChatStore',
onRehydrateStorage: () => (state) => {
if (state) {
state.loaded = true;
}
},
partialize: (state) => ({
localUId: state.localUId
})
}
)
)