mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
feat: implement openai integration (#1245)
* feat: implement openai integration * chore: update
This commit is contained in:
@ -66,7 +66,7 @@ const BaseDialog: React.FC<Props> = (props: Props) => {
|
||||
export function generateDialog<T extends DialogProps>(
|
||||
config: DialogConfig,
|
||||
DialogComponent: React.FC<T>,
|
||||
props?: Omit<T, "destroy">
|
||||
props?: Omit<T, "destroy" | "hide">
|
||||
): DialogCallback {
|
||||
const tempDiv = document.createElement("div");
|
||||
const dialog = createRoot(tempDiv);
|
||||
@ -85,17 +85,22 @@ export function generateDialog<T extends DialogProps>(
|
||||
tempDiv.remove();
|
||||
}, ANIMATION_DURATION);
|
||||
},
|
||||
hide: () => {
|
||||
tempDiv.firstElementChild?.classList.remove("showup");
|
||||
tempDiv.firstElementChild?.classList.add("showoff");
|
||||
},
|
||||
};
|
||||
|
||||
const dialogProps = {
|
||||
...props,
|
||||
destroy: cbs.destroy,
|
||||
hide: cbs.hide,
|
||||
} as T;
|
||||
|
||||
const Fragment = (
|
||||
<Provider store={store}>
|
||||
<CssVarsProvider theme={theme}>
|
||||
<BaseDialog destroy={cbs.destroy} clickSpaceDestroy={true} {...config}>
|
||||
<BaseDialog destroy={cbs.destroy} hide={cbs.hide} clickSpaceDestroy={true} {...config}>
|
||||
<DialogComponent {...dialogProps} />
|
||||
</BaseDialog>
|
||||
</CssVarsProvider>
|
||||
|
Reference in New Issue
Block a user