Skip to content

Commit 5a5b4d4

Browse files
Merge branch 'main' of https://github.com/appwrite/console into fix-sdk-context
2 parents 1234691 + 3fa83d3 commit 5a5b4d4

File tree

119 files changed

+2112
-912
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

119 files changed

+2112
-912
lines changed

.github/workflows/publish.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
- name: Log in to Docker Hub
1818
uses: docker/login-action@v3
1919
with:
20-
username: ${{ secrets.DOCKERHUB_USERNAME }}
20+
username: ${{ vars.DOCKERHUB_USERNAME }}
2121
password: ${{ secrets.DOCKERHUB_TOKEN }}
2222
- name: Extract metadata (tags, labels) for Docker
2323
id: meta
@@ -54,8 +54,8 @@ jobs:
5454
- name: Log in to Docker Hub
5555
uses: docker/login-action@v3
5656
with:
57-
username: ${{ secrets.DOCKER_USERNAME }}
58-
password: ${{ secrets.DOCKER_PASSWORD }}
57+
username: ${{ vars.DOCKERHUB_USERNAME }}
58+
password: ${{ secrets.DOCKERHUB_TOKEN }}
5959
- name: Extract metadata (tags, labels) for Docker
6060
id: meta
6161
uses: docker/metadata-action@v5
@@ -90,8 +90,8 @@ jobs:
9090
- name: Log in to Docker Hub
9191
uses: docker/login-action@v3
9292
with:
93-
username: ${{ secrets.DOCKER_USERNAME }}
94-
password: ${{ secrets.DOCKER_PASSWORD }}
93+
username: ${{ vars.DOCKERHUB_USERNAME }}
94+
password: ${{ secrets.DOCKERHUB_TOKEN }}
9595
- name: Extract metadata (tags, labels) for Docker
9696
id: meta
9797
uses: docker/metadata-action@v5

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"e2e:ui": "playwright test tests/e2e --ui"
2020
},
2121
"dependencies": {
22-
"@appwrite.io/console": "1.4.4",
22+
"@appwrite.io/console": "1.4.7",
2323
"@appwrite.io/pink": "0.25.0",
2424
"@appwrite.io/pink-icons": "0.25.0",
2525
"@popperjs/core": "^2.11.8",
@@ -36,6 +36,7 @@
3636
"plausible-tracker": "^0.3.9",
3737
"pretty-bytes": "^6.1.1",
3838
"prismjs": "^1.29.0",
39+
"remarkable": "^2.0.1",
3940
"svelte-confetti": "^1.4.0",
4041
"tippy.js": "^6.3.7"
4142
},
@@ -52,6 +53,7 @@
5253
"@testing-library/user-event": "^14.5.2",
5354
"@types/deep-equal": "^1.0.4",
5455
"@types/prismjs": "^1.26.5",
56+
"@types/remarkable": "^2.0.8",
5557
"@typescript-eslint/eslint-plugin": "^7.18.0",
5658
"@typescript-eslint/parser": "^7.18.0",
5759
"@vitest/ui": "^1.6.0",

playwright.config.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const config: PlaywrightTestConfig = {
1212
webServer: {
1313
timeout: 120000,
1414
env: {
15-
PUBLIC_APPWRITE_ENDPOINT: 'https://console-testing.appwrite.org/v1',
15+
PUBLIC_APPWRITE_ENDPOINT: 'https://console-testing-2.appwrite.org/v1',
1616
PUBLIC_CONSOLE_MODE: 'cloud',
1717
PUBLIC_STRIPE_KEY:
1818
'pk_test_51LT5nsGYD1ySxNCyd7b304wPD8Y1XKKWR6hqo6cu3GIRwgvcVNzoZv4vKt5DfYXL1gRGw4JOqE19afwkJYJq1g3K004eVfpdWn'

pnpm-lock.yaml

+33-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/hooks.client.ts

+1-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,7 @@ Sentry.init({
88
dsn: 'https://c7ce178bdedd486480317b72f282fd39@o1063647.ingest.us.sentry.io/4504158071422976',
99
tracesSampleRate: 1,
1010
replaysSessionSampleRate: 0,
11-
replaysOnErrorSampleRate: 1,
12-
integrations: [Sentry.replayIntegration()]
11+
replaysOnErrorSampleRate: 0
1312
});
1413

1514
export const handleError: HandleClientError = Sentry.handleErrorWithSentry(

src/lib/commandCenter/panels/ai.svelte

+53-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
<script lang="ts">
2+
import { Remarkable } from 'remarkable';
23
import Template from './template.svelte';
34
5+
const markdownInstance = new Remarkable();
6+
47
import { Alert, AvatarInitials, Code, LoadingDots, SvgIcon } from '$lib/components';
58
import { user } from '$lib/stores/user';
69
import { useCompletion } from 'ai/svelte';
@@ -19,8 +22,6 @@
1922
credentials: 'include'
2023
});
2124
22-
let question = $input;
23-
2425
const examples = [
2526
'How to add platform in the console?',
2627
'How can I manage users, permissions, and access control in Appwrite?',
@@ -87,10 +88,47 @@
8788
8889
$: answer = parseCompletion($completion);
8990
91+
function renderMarkdown(answer: string): string {
92+
const trimmedAnswer = answer
93+
.trim()
94+
.replace(/[ \t]+/g, ' ')
95+
.replace(/\n[ \t]+/g, '\n')
96+
.replace(/\n+/g, '\n');
97+
98+
// targeting links in plain text.
99+
const processedAnswer = trimmedAnswer
100+
.replace(/(\[(.*?)]\((.*?)\))|https?:\/\/\S+/g, (match, fullMarkdownLink, _, __) =>
101+
fullMarkdownLink ? match : `[${match}](${match})`
102+
)
103+
.replace(/https?:\/\/\S+##/g, (url) => url.replace(/##/, '#'));
104+
105+
const formattedAnswer = processedAnswer.replace(
106+
/(^|\n)Sources:/g,
107+
(_, prefix) => `${prefix}\nSources:`
108+
);
109+
110+
let renderedHTML = markdownInstance.render(formattedAnswer);
111+
112+
// add target blank to open links in a new tab.
113+
renderedHTML = renderedHTML.replace(/<a\s+href="([^"]+)"/g, '<a href="$1" target="_blank"');
114+
115+
return renderedHTML;
116+
}
117+
90118
function getInitials(name: string) {
91119
const [first, last] = name.split(' ');
92120
return `${first?.[0] ?? ''}${last?.[0] ?? ''}`;
93121
}
122+
123+
let previousQuestion = '';
124+
$: if ($input) {
125+
previousQuestion = $input;
126+
}
127+
128+
$: if (!$isLoading && answer) {
129+
// reset input if answer received.
130+
$input = '';
131+
}
94132
</script>
95133

96134
<Template
@@ -142,7 +180,7 @@
142180
<div class="content">
143181
<div class="u-flex u-gap-8 u-cross-center">
144182
<div class="avatar is-size-x-small">{getInitials($user.name)}</div>
145-
<p class="u-opacity-75">{question}</p>
183+
<p class="u-opacity-75">{previousQuestion}</p>
146184
</div>
147185
<div class="u-flex u-gap-8 u-margin-block-start-24">
148186
<div class="logo">
@@ -154,7 +192,7 @@
154192
{:else}
155193
{#each answer as part}
156194
{#if part.type === 'text'}
157-
<p>{part.value.trimStart()}</p>
195+
<p>{@html renderMarkdown(part.value.trim())}</p>
158196
{:else if part.type === 'code'}
159197
{#key part.value}
160198
<div
@@ -196,7 +234,6 @@
196234
class="input-text-wrapper u-width-full-line"
197235
style="--amount-of-buttons: 1;"
198236
on:submit|preventDefault={(e) => {
199-
question = $input;
200237
handleSubmit(e);
201238
}}>
202239
<!-- svelte-ignore a11y-autofocus -->
@@ -269,10 +306,20 @@
269306
.answer {
270307
overflow: hidden;
271308
272-
p {
309+
p:first-of-type {
273310
white-space: pre-wrap;
274311
}
275312
}
313+
314+
:global(.answer ul),
315+
:global(.answer ol) {
316+
gap: 1rem;
317+
display: grid;
318+
}
319+
320+
:global(.answer a) {
321+
text-decoration: underline;
322+
}
276323
}
277324
278325
.footer {

src/lib/components/avatarGroup.svelte

+4-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
export let bordered = false;
1010
export let color = '';
1111
12+
let classes = '';
13+
export { classes as class };
14+
1215
enum Sizes {
1316
xsmall = 'is-size-x-small',
1417
small = 'is-size-small',
@@ -18,7 +21,7 @@
1821
}
1922
</script>
2023

21-
<ul class="avatars-group" class:is-with-border={bordered}>
24+
<ul class="avatars-group {classes}" class:is-with-border={bordered}>
2225
{#each avatars as name, index}
2326
{#if index < 2}
2427
<li class="avatars-group-item">

src/lib/components/billing/estimatedTotalBox.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@
6464
</span>
6565

6666
<p class="text u-margin-block-start-16">
67-
You'll pay <span class="u-bold">{formatCurrency(estimatedTotal)}</span> now, with our first
67+
You'll pay <span class="u-bold">{formatCurrency(estimatedTotal)}</span> now, with your first
6868
billing cycle starting on
6969
<span class="u-bold"
7070
>{!currentPlan.trialDays

src/lib/components/billing/selectPaymentMethod.svelte

+1
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,7 @@
140140
<InputText
141141
id="taxId"
142142
label="Tax ID"
143+
autofocus
143144
placeholder="Tax ID"
144145
bind:value={taxId} />
145146
</div>

src/lib/components/billing/usageRates.svelte

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
following rates. Next billing period: {toLocaleDate(nextDate)}.
6868
</p>
6969
{/if}
70-
<Table noStyles>
70+
<Table noStyles noMargin>
7171
<TableHeader>
7272
<TableCellHead>Resource</TableCellHead>
7373
<TableCellHead>Limit</TableCellHead>

src/lib/components/code.svelte

+7-1
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,20 @@
3232
export let noBoxPadding = false;
3333
export let allowScroll = false;
3434
35+
let classes = '';
36+
export { classes as class };
37+
3538
Prism.plugins.customClass.prefix('prism-');
3639
3740
afterUpdate(async () => {
3841
Prism.highlightAll();
3942
});
4043
</script>
4144

42-
<section class="box u-overflow-hidden" class:common-section={!noMargin} class:noBoxPadding>
45+
<section
46+
class="box u-overflow-hidden {classes}"
47+
class:common-section={!noMargin}
48+
class:noBoxPadding>
4349
<div
4450
class="controls u-position-absolute u-inset-inline-end-8 u-inset-block-start-8 u-flex u-gap-8">
4551
{#if label}

0 commit comments

Comments
 (0)