Merge main

This commit is contained in:
Bradley Schofield committed 2024-05-13 17:43:37 +09:00
commit 1192398132
13 files changed
+283 -68

No files matched your search

-1
View File
@@ -27,7 +27,6 @@
<button
type="button"
class="button is-text is-only-icon"
style="--button-size:1.5rem;"
aria-label="close alert box"
on:click={() => dispatch('dismiss')}>
<span class="icon-x" aria-hidden="true" />
+1 -18
View File
@@ -1,13 +1,9 @@
<script lang="ts">
import { Button } from '$lib/elements/forms';
import SupportOfflineLight from '$lib/images/support/support-offline-light.png';
import SupportOfflineDark from '$lib/images/support/support-offline-dark.png';
import SupportOnlineLight from '$lib/images/support/support-online-light.png';
import SupportOnlineDark from '$lib/images/support/support-online-dark.png';
import { app } from '$lib/stores/app';
import { wizard } from '$lib/stores/wizard';
import SupportWizard from '../../routes/console/supportWizard.svelte';
import { isSupportOnline, showSupportModal } from '../../routes/console/wizard/support/store';
import { showSupportModal } from '../../routes/console/wizard/support/store';
import { isCloud } from '$lib/system';
import { organization } from '$lib/stores/organization';
import { BillingPlan } from '$lib/constants';
@@ -23,19 +19,6 @@
{#if isCloud}
<section class="drop-section u-grid u-gap-24 u-padding-24">
<div class="u-flex u-main-center">
{#if isSupportOnline()}
{#if $app.themeInUse === 'light'}
<img src={SupportOnlineLight} alt="Support" height="87" width="230" />
{:else}
<img src={SupportOnlineDark} alt="Support" height="87" width="230" />
{/if}
{:else if $app.themeInUse === 'light'}
<img src={SupportOfflineLight} alt="Support" height="87" width="230" />
{:else}
<img src={SupportOfflineDark} alt="Support" height="87" width="230" />
{/if}
</div>
<div>
<h4 class="eyebrow-heading-3">Premium support</h4>
{#if isPaid}
+1 -4
View File
@@ -22,12 +22,9 @@
placeholder: '',
defaultValue: value.split(''),
onValueChange: ({ next }) => {
if (!autoSubmit) {
return next;
}
value = next.join('');
if (value.length === length && !autoSubmitted) {
if (autoSubmit && value.length === length && !autoSubmitted) {
autoSubmitted = true;
const firstInputElement = element.querySelector('input');
firstInputElement?.form.requestSubmit();
Binary file not shown.

Before

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 21 KiB

+45
View File
@@ -0,0 +1,45 @@
import type { Client } from '@appwrite.io/console';
type Source = {
$id: string;
fingerprint: string;
referrer: string;
ref: string;
utmSource: string;
utmCampaign: string;
utmMedium: string;
};
export class Sources {
client: Client;
constructor(client: Client) {
this.client = client;
}
async create(
ref: string,
referrer: string,
utmSource: string,
utmCampaign: string,
utmMedium: string
): Promise<Source> {
const path = `/console/sources`;
const params = {
ref,
referrer,
utmSource,
utmCampaign,
utmMedium
};
const uri = new URL(this.client.config.endpoint + path);
return await this.client.call(
'POST',
uri,
{
'content-type': 'application/json'
},
params
);
}
}
+212 -43
View File
@@ -958,7 +958,7 @@ export const marketplace: MarketplaceTemplate[] = [
]
},
{
icon: 'icon-chip',
icon: 'icon-chat',
id: 'text-generation-with-huggingface',
name: 'Text generation',
tagline: 'Generate text using the Hugging Face inference API.',
@@ -991,7 +991,7 @@ export const marketplace: MarketplaceTemplate[] = [
]
},
{
icon: 'icon-chip',
icon: 'icon-translate',
id: 'language-translation-with-huggingface',
name: 'Language translation',
tagline: 'Translate text using the Hugging Face inference API.',
@@ -1024,7 +1024,7 @@ export const marketplace: MarketplaceTemplate[] = [
]
},
{
icon: 'icon-chip',
icon: 'icon-eye',
id: 'image-classification-with-huggingface',
name: 'Image classification',
tagline: 'Classify images using the Hugging Face inference API.',
@@ -1097,7 +1097,7 @@ export const marketplace: MarketplaceTemplate[] = [
]
},
{
icon: 'icon-chip',
icon: 'icon-eye',
id: 'object-detection-with-huggingface',
name: 'Object detection',
tagline: 'Detect objects in images using the Hugging Face inference API.',
@@ -1170,7 +1170,7 @@ export const marketplace: MarketplaceTemplate[] = [
]
},
{
icon: 'icon-chip',
icon: 'icon-text',
id: 'speech-recognition-with-huggingface',
name: 'Speech recognition',
tagline: 'Transcribe audio to text using the Hugging Face inference API.',
@@ -1243,7 +1243,7 @@ export const marketplace: MarketplaceTemplate[] = [
]
},
{
icon: 'icon-chip',
icon: 'icon-chat',
id: 'text-to-speech-with-huggingface',
name: 'Text to speech',
tagline: 'Convert text to speech using the Hugging Face inference API.',
@@ -1349,6 +1349,63 @@ export const marketplace: MarketplaceTemplate[] = [
}
]
},
{
icon: 'icon-chip',
id: 'generate-with-together-ai',
name: 'Generate with Together AI',
tagline: "Generate text and images using Together AI's API.",
permissions: ['any'],
events: [],
cron: '',
timeout: 300,
usecases: ['AI'],
runtimes: [
...getRuntimes(
TemplateRuntimes.NODE,
'npm install',
'src/main.js',
'node/generate-with-together-ai'
)
],
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/generate-with-together-ai">file</a>.`,
vcsProvider: 'github',
providerRepositoryId: 'templates',
providerOwner: 'appwrite',
providerBranch: 'main',
variables: [
{
name: 'TOGETHER_API_KEY',
description: `A unique key used to authenticate with the Together AI API. <a class="u-bold" target="_blank" href="https://docs.together.ai/reference/authentication-1">Learn more</a>.`,
value: '',
placeholder: 'd1efb...aec35',
required: true,
type: 'password'
},
{
name: 'APPWRITE_API_KEY',
description: `The API Key to authenticate against Appwrite's server APIs. <a class="u-bold" target="_blank" href="https://appwrite.io/docs/advanced/platform/api-keys">Learn more</a>.`,
value: '',
placeholder: 'd1efb...aec35',
required: true,
type: 'password'
},
{
name: 'APPWRITE_ENDPOINT',
description: `The URL endpoint of the Appwrite server. <a class="u-bold" target="_blank" href="https://appwrite.io/docs/references#api">Learn more</a>.`,
value: 'https://cloud.appwrite.io/v1',
placeholder: 'https://cloud.appwrite.io/v1',
required: false,
type: 'url'
},
{
name: 'APPWRITE_BUCKET_ID',
description: `The ID of the bucket where audio is stored. <a class="u-bold" target="_blank" href="https://appwrite.io/docs/products/storage/buckets">Learn more</a>.`,
placeholder: 'generated_speech',
required: true,
type: 'text'
}
]
},
{
icon: 'icon-chip',
id: 'chat-with-perplexity-ai',
@@ -1424,7 +1481,7 @@ export const marketplace: MarketplaceTemplate[] = [
]
},
{
icon: 'icon-chip',
icon: 'icon-document-search',
id: 'sync-with-pinecone',
name: 'Sync with Pinecone',
tagline: "Sync your Appwrite database with Pinecone's vector database.",
@@ -1580,7 +1637,7 @@ export const marketplace: MarketplaceTemplate[] = [
]
},
{
icon: 'icon-chip',
icon: 'icon-chat',
id: 'speak-with-elevenlabs',
name: 'Speak with ElevenLabs',
tagline: 'Convert text to speech using the ElevenLabs API.',
@@ -1649,6 +1706,62 @@ export const marketplace: MarketplaceTemplate[] = [
}
]
},
{
icon: 'icon-chip',
id: 'speak-with-lmnt',
name: 'Speak with LMNT',
tagline: 'Convert text to speech using the LMNT API.',
permissions: ['any'],
cron: '',
events: [],
timeout: 15,
usecases: ['AI'],
runtimes: [
...getRuntimes(
TemplateRuntimes.NODE,
'npm install',
'src/main.js',
'node/speak-with-lmnt'
)
],
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/speak-with-lmnt">file</a>.`,
vcsProvider: 'github',
providerRepositoryId: 'templates',
providerOwner: 'appwrite',
providerBranch: 'main',
variables: [
{
name: 'LMNT_API_KEY',
description: `A unique key used to authenticate with the LMNT API. <a class="u-bold" target="_blank" href="https://app.lmnt.com/account">Learn more</a>.`,
placeholder: 'd03xxxxxxxx26',
required: true,
type: 'password'
},
{
name: 'APPWRITE_API_KEY',
description: `The API Key to authenticate against Appwrite's server APIs. <a class="u-bold" target="_blank" href="https://appwrite.io/docs/advanced/platform/api-keys">Learn more</a>.`,
value: '',
placeholder: 'd1efb...aec35',
required: true,
type: 'password'
},
{
name: 'APPWRITE_ENDPOINT',
description: `The URL endpoint of the Appwrite server. <a class="u-bold" target="_blank" href="https://appwrite.io/docs/references#api">Learn more</a>.`,
value: 'https://cloud.appwrite.io/v1',
placeholder: 'https://cloud.appwrite.io/v1',
required: false,
type: 'url'
},
{
name: 'APPWRITE_BUCKET_ID',
description: `The ID of the bucket where audio is stored. <a class="u-bold" target="_blank" href="https://appwrite.io/docs/products/storage/buckets">Learn more</a>.`,
placeholder: 'generated_speech',
required: true,
type: 'text'
}
]
},
{
icon: 'icon-chip',
id: 'chat-with-anyscale',
@@ -1688,6 +1801,97 @@ export const marketplace: MarketplaceTemplate[] = [
type: 'number'
}
]
},
{
icon: 'icon-music-note',
id: 'music-generation-with-huggingface',
name: 'Music generation',
tagline: 'Generate music from a text prompt using the Hugging Face inference API.',
permissions: ['any'],
events: [],
cron: '',
timeout: 15,
usecases: ['AI'],
runtimes: [
...getRuntimes(
TemplateRuntimes.NODE,
'npm install && npm run setup',
'src/main.js',
'node/music-generation-with-huggingface'
)
],
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/music-generation-with-huggingface">file</a>.`,
vcsProvider: 'github',
providerRepositoryId: 'templates',
providerOwner: 'appwrite',
providerBranch: 'main',
variables: [
{
name: 'APPWRITE_API_KEY',
description: `The API Key to authenticate against Appwrite's server APIs. <a class="u-bold" target="_blank" href="https://appwrite.io/docs/advanced/platform/api-keys">Learn more</a>.`,
value: '',
placeholder: 'd1efb...aec35',
required: true,
type: 'password'
},
{
name: 'APPWRITE_ENDPOINT',
description: `The URL endpoint of the Appwrite server. <a class="u-bold" target="_blank" href="https://appwrite.io/docs/references#api">Learn more</a>.`,
value: 'https://cloud.appwrite.io/v1',
placeholder: 'https://cloud.appwrite.io/v1',
required: false,
type: 'url'
},
{
name: 'APPWRITE_BUCKET_ID',
description: `The ID of the bucket where generated music is stored. <a class="u-bold" target="_blank" href="https://appwrite.io/docs/products/storage/buckets">Learn more</a>.`,
value: 'generated_music',
placeholder: 'generated_music',
required: false,
type: 'text'
},
{
name: 'HUGGINGFACE_ACCESS_TOKEN',
description: `Secret for sending requests to the Hugging Face API. <a class="u-bold" target="_blank" href="https://huggingface.co/docs/api-inference/en/quicktour#get-your-api-token">Learn more</a>.`,
placeholder: 'hf_MUvn...',
required: true,
type: 'password'
}
]
},
{
icon: 'icon-chip',
id: 'generate-with-fal-ai',
name: 'Generate with fal.ai',
tagline: "Generate images using fal.ai's API.",
permissions: ['any'],
events: [],
cron: '',
timeout: 300,
usecases: ['AI'],
runtimes: [
...getRuntimes(
TemplateRuntimes.NODE,
'npm install',
'src/main.js',
'node/generate-with-fal-ai'
)
],
instructions: `For documentation and instructions check out <a target="_blank" rel="noopener noreferrer" class="link" href="https://github.com/appwrite/templates/tree/main/node/generate-with-fal-ai">file</a>.`,
vcsProvider: 'github',
providerRepositoryId: 'templates',
providerOwner: 'appwrite',
providerBranch: 'main',
variables: [
{
name: 'FAL_API_KEY',
description: `A unique key used to authenticate with the fal.ai API. <a class="u-bold" target="_blank" href="https://fal.ai/docs/authentication/key-based">Learn more</a>.`,
value: '',
placeholder: 'd1efb...aec35',
required: true,
type: 'password'
}
]
}
];
@@ -1725,38 +1929,3 @@ export type MarketplaceTemplate = {
providerBranch: string;
variables: Variable[];
};
/*
Template:
{
"icon": "algolia",
"id": "sync-with-algolia",
"name": "Sync with Algolia",
"tagline": "Search your Appwrite Database with Algolia.",
"permissions": ["any"],
"events": [ "users.*.create" ],
"cron": "0 * * * *",
"timeout": 15,
"runtimes": [
{
"name": "node-18",
"entrypoint": "src/main.js",
"commands": "npm install"
}
],
"instructions": "# Some markdown stuff",
"vcsProvider": "github",
"vcsRepositoryName": "templates-for-node",
"vcsOwnerName": "loks0n",
"vcsRootDirectory": "sync-with-algolia",
"variables": [
{
"name": "ALGOLIA_API_KEY",
"description": "Algolia read-write API key.",
"value": "",
"placeholder": "sk_1df...h9jef",
"required": true
}
]
}
*/
+3 -1
View File
@@ -22,6 +22,7 @@ import {
Vcs
} from '@appwrite.io/console';
import { Billing } from '../sdk/billing';
import { Sources } from '$lib/sdk/sources';
const endpoint = VARS.APPWRITE_ENDPOINT ?? `${globalThis?.location?.origin}/v1`;
@@ -72,7 +73,8 @@ export const sdk = {
migrations: new Migrations(clientConsole),
console: new Console(clientConsole),
assistant: new Assistant(clientConsole),
billing: new Billing(clientConsole)
billing: new Billing(clientConsole),
sources: new Sources(clientConsole)
},
get forProject() {
const projectId = getProjectId();
+20
View File
@@ -13,9 +13,29 @@
import { loading, requestedMigration } from './store';
import { parseIfString } from '$lib/helpers/object';
import Consent from '$lib/components/consent.svelte';
import { sdk } from '$lib/stores/sdk';
import type { Models } from '@appwrite.io/console';
onMount(async () => {
// handle sources
if (isCloud) {
const urlParams = $page.url.searchParams;
const ref = urlParams.get('ref');
const utmSource = urlParams.get('utm_source');
const utmMedium = urlParams.get('utm_medium');
const utmCampaign = urlParams.get('utm_campaign');
let referrer = document.referrer.length ? document.referrer : null;
// Skip our own
if (referrer?.includes('//appwrite.io')) {
referrer = null;
}
if (ref || referrer || utmSource || utmCampaign || utmMedium) {
sdk.forConsole.sources.create(ref, referrer, utmSource, utmCampaign, utmMedium);
}
}
if ($page.url.searchParams.has('migrate')) {
const migrateData = $page.url.searchParams.get('migrate');
requestedMigration.set(parseIfString(migrateData) as Record<string, string>);
@@ -224,7 +224,7 @@
<p>
Configure the settings to <Button
link
href={`https://appwrite.io/docs/products/messaging/providers/${provider}`}
href={`https://appwrite.io/docs/products/messaging/${provider}`}
external>enable {displayName}</Button> to send {message}, or <Button
link
on:click={() => (newMemberModal = true)}>invite a team member</Button> to complete the
Binary file not shown.