feat: manually mirror opencoze's code from bytedance
Change-Id: I09a73aadda978ad9511264a756b2ce51f5761adf
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import {
|
||||
ImageLocalModule,
|
||||
} from '@coze-data/knowledge-ide-base/features/import-knowledge-sources/menu/image-local';
|
||||
import {
|
||||
createImportKnowledgeMenuSourceFeatureRegistry,
|
||||
type ImportKnowledgeMenuSourceRegistry,
|
||||
} from '@coze-data/knowledge-ide-base/features/import-knowledge-sources/menu';
|
||||
|
||||
export const importKnowledgeSourceMenuContributes: ImportKnowledgeMenuSourceRegistry =
|
||||
(() => {
|
||||
const importKnowledgeMenuSourceFeatureRegistry =
|
||||
createImportKnowledgeMenuSourceFeatureRegistry(
|
||||
'import-knowledge-source-image-menu',
|
||||
);
|
||||
importKnowledgeMenuSourceFeatureRegistry.register({
|
||||
type: 'image-local',
|
||||
module: ImageLocalModule,
|
||||
});
|
||||
return importKnowledgeMenuSourceFeatureRegistry;
|
||||
})();
|
||||
@@ -0,0 +1,55 @@
|
||||
/*
|
||||
* Copyright 2025 coze-dev Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { KnowledgeIDEBaseLayout } from '@coze-data/knowledge-ide-base/layout/base';
|
||||
import { BaseKnowledgeIDENavBar } from '@coze-data/knowledge-ide-base/features/nav-bar/base';
|
||||
import {
|
||||
ImageKnowledgeWorkspace,
|
||||
type ImageKnowledgeWorkspaceProps,
|
||||
} from '@coze-data/knowledge-ide-base/features/image-knowledge-workspace';
|
||||
import { KnowledgeIDERegistryContext } from '@coze-data/knowledge-ide-base/context/knowledge-ide-registry-context';
|
||||
|
||||
import { type BaseKnowledgeIDEProps } from '../types';
|
||||
import { importKnowledgeSourceMenuContributes } from './import-knowledge-source-menu-contributes';
|
||||
|
||||
export interface BaseKnowledgeImgIDEProps extends BaseKnowledgeIDEProps {
|
||||
contentProps?: Partial<ImageKnowledgeWorkspaceProps>;
|
||||
}
|
||||
|
||||
const registryContextValue = {
|
||||
importKnowledgeMenuSourceFeatureRegistry:
|
||||
importKnowledgeSourceMenuContributes,
|
||||
};
|
||||
|
||||
export const BaseKnowledgeImgIDE = (props: BaseKnowledgeImgIDEProps) => (
|
||||
<KnowledgeIDERegistryContext.Provider value={registryContextValue}>
|
||||
<KnowledgeIDEBaseLayout
|
||||
renderNavBar={({ statusInfo }) => (
|
||||
<BaseKnowledgeIDENavBar
|
||||
progressMap={statusInfo.progressMap}
|
||||
{...props.navBarProps}
|
||||
/>
|
||||
)}
|
||||
renderContent={({ statusInfo }) => (
|
||||
<ImageKnowledgeWorkspace
|
||||
progressMap={statusInfo.progressMap}
|
||||
{...props.contentProps}
|
||||
/>
|
||||
)}
|
||||
{...props.layoutProps}
|
||||
/>
|
||||
</KnowledgeIDERegistryContext.Provider>
|
||||
);
|
||||
Reference in New Issue
Block a user