hide AI command when needed

This commit is contained in:
tglide committed 2023-08-21 17:22:35 +01:00
1 parent 441fcce7ba
commit e1e4c9292b
4 files changed
+20 -9

No files matched your search

+5 -5
View File
@@ -8,7 +8,7 @@
"dependencies": {
"@analytics/google-analytics": "^1.0.5",
"@analytics/google-tag-manager": "^0.5.3",
"@appwrite.io/console": "npm:bradley-console@^0.1.0",
"@appwrite.io/console": "npm:matej-appwrite-console@7.1.126",
"@appwrite.io/pink": "^0.1.0-next.3",
"@popperjs/core": "^2.11.6",
"@sentry/svelte": "^7.44.2",
@@ -165,10 +165,10 @@
"integrity": "sha512-TD+xbmsBLyYy/IxFimW/YL/9L2IEnM7/EoV9Aeh56U64Ify8o27HJcKjo38XY9Tcn0uOq1AX3thkKgvtWvwFQg=="
},
"node_modules/@appwrite.io/console": {
"name": "bradley-console",
"version": "0.1.0",
"resolved": "https://registry.npmjs.org/bradley-console/-/bradley-console-0.1.0.tgz",
"integrity": "sha512-SKgIz4Tmd0AmL/8darZvu4bNEUZWkINgPpVrXQNRM5YLXq8SV0w0AQDeuvPVkenVbpKwcowr2rS6fEsix8+sXg==",
"name": "matej-appwrite-console",
"version": "7.1.126",
"resolved": "https://registry.npmjs.org/matej-appwrite-console/-/matej-appwrite-console-7.1.126.tgz",
"integrity": "sha512-ulgi17MwokLEG1BF/cmZIHdrv47pj1Hb4TLjEhIt57pMKuLDQ/VnFK6hyIBmD8pvU+wU56zEyFKl0Q+RIzFaow==",
"dependencies": {
"cross-fetch": "3.1.5",
"isomorphic-form-data": "2.0.0"
+1 -1
View File
@@ -19,7 +19,7 @@
},
"dependencies": {
"@analytics/google-analytics": "^1.0.5",
"@appwrite.io/console": "npm:bradley-console@^0.1.0",
"@appwrite.io/console": "npm:matej-appwrite-console@7.1.126",
"@appwrite.io/pink": "^0.1.0-next.3",
"@analytics/google-tag-manager": "^0.5.3",
"@popperjs/core": "^2.11.6",
+6 -2
View File
@@ -13,7 +13,9 @@ import {
Project,
Storage,
Teams,
Users
Users,
Console,
Assistant
} from '@appwrite.io/console';
const endpoint = VARS.APPWRITE_ENDPOINT ?? `${globalThis?.location?.origin}/v1`;
@@ -57,7 +59,9 @@ export const sdk = {
projects: new Projects(clientConsole),
teams: new Teams(clientConsole),
users: new Users(clientConsole),
migrations: new Migrations(clientConsole)
migrations: new Migrations(clientConsole),
console: new Console(clientConsole),
assistant: new Assistant(clientConsole)
},
get forProject() {
const projectId = getProjectId();
+8 -1
View File
@@ -24,6 +24,7 @@
import { addNotification } from '$lib/stores/notifications';
import { openMigrationWizard } from './(migration-wizard)';
import { project } from './project-[project]/store';
import { sdk } from '$lib/stores/sdk';
function kebabToSentenceCase(str: string) {
return str
@@ -32,6 +33,11 @@
.join(' ');
}
let isAssistantEnabled = false;
onMount(async () => {
const vars = sdk.forConsole.console.variables();
isAssistantEnabled = vars._APP_ASSISTANT_ENABLED === true;
});
$: $registerCommands([
{
label: 'Go to projects',
@@ -52,7 +58,8 @@
addSubPanel(AIPanel);
},
keys: ['a', 'i'],
icon: 'sparkles'
icon: 'sparkles',
disabled: !isAssistantEnabled
},
{
label: 'Go to account',