Skip to content

Commit

Permalink
feat: add enableImportFromHuggingFace option
Browse files Browse the repository at this point in the history
  • Loading branch information
agatha197 committed Sep 19, 2024
1 parent 77422f2 commit 3b0ef99
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 3 deletions.
1 change: 1 addition & 0 deletions config.toml.sample
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ eduAppNamePrefix = "" # The prefix of edu applauncher's app na
enableModelStore = false # Enable model store feature. (From Backend.AI 24.03)
enableLLMPlayground = false # Enable LLM Playground feature. (From Backend.AI 24.03)
enableExtendLoginSession = false # If true, enables login session extension UI. (From Backend.AI 24.09)
enableImportFromHuggingFace = false # Enable import from Hugging Face feature. (From Backend.AI 24.09)

[wsproxy]
proxyURL = "[Proxy URL]"
Expand Down
1 change: 1 addition & 0 deletions react/src/hooks/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ type BackendAIConfig = {
ssoRealmName: string;
enableModelStore: boolean;
enableLLMPlayground: boolean;
enableImportFromHuggingFace: boolean;
enableContainerCommit: boolean;
appDownloadUrl: string;
systemSSHImage: string;
Expand Down
7 changes: 4 additions & 3 deletions react/src/pages/VFolderListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ const VFolderListPage: React.FC<VFolderListPageProps> = (props) => {
] = useToggle(false);

const { token } = theme.useToken();
const enableImportFromHuggingFace =
baiClient._config.enableImportFromHuggingFace;

useEffect(() => {
const handler = () => {
Expand Down Expand Up @@ -129,12 +131,11 @@ const VFolderListPage: React.FC<VFolderListPageProps> = (props) => {
}}
tabBarExtraContent={
<Flex gap="xs">
{_.includes(['model', 'model-store'], curTabKey) ? (
{_.includes(['model', 'model-store'], curTabKey) &&
enableImportFromHuggingFace ? (
<Button
icon={<ImportOutlined />}
onClick={toggleImportFromHuggingFaceModal}
// Remove this line to test
style={{ display: 'none' }}
>
{t('data.modelStore.ImportFromHuggingFace')}
</Button>
Expand Down
13 changes: 13 additions & 0 deletions src/components/backend-ai-login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,7 @@ export default class BackendAILogin extends BackendAIPage {
@property({ type: Boolean }) isDirectorySizeVisible = true;
@property({ type: Boolean }) enableModelStore = false;
@property({ type: Boolean }) enableLLMPlayground = false;
@property({ type: Boolean }) enableImportFromHuggingFace = false;
@property({ type: Boolean }) enableExtendLoginSession = false;
@property({ type: Boolean }) showNonInstalledImages = false;
@property({ type: String }) eduAppNamePrefix;
Expand Down Expand Up @@ -859,6 +860,16 @@ export default class BackendAILogin extends BackendAIPage {
value: generalConfig?.enableLLMPlayground,
} as ConfigValueObject) as boolean;

// Enable importing from Hugging Face support
this.enableImportFromHuggingFace = this._getConfigValueByExists(
generalConfig,
{
valueType: 'boolean',
defaultValue: false,
value: generalConfig?.enableImportFromHuggingFace,
} as ConfigValueObject,
) as boolean;

// Enable extend login session
this.enableExtendLoginSession = this._getConfigValueByExists(
generalConfig,
Expand Down Expand Up @@ -1886,6 +1897,8 @@ export default class BackendAILogin extends BackendAIPage {
this.enableModelStore;
globalThis.backendaiclient._config.enableLLMPlayground =
this.enableLLMPlayground;
globalThis.backendaiclient._config.enableImportFromHuggingFace =
this.enableImportFromHuggingFace;
globalThis.backendaiclient._config.enableExtendLoginSession =
this.enableExtendLoginSession;
globalThis.backendaiclient._config.pluginPages = this.pluginPages;
Expand Down

0 comments on commit 3b0ef99

Please sign in to comment.