Spaces:
Sleeping
Sleeping
Commit
•
b99b950
1
Parent(s):
575a8fc
Revert "✨ Real "patch" for settings"
Browse filesThis reverts commit 5c2f6a4cc6a9d642c661e8dd54c79cb327725f74.
src/lib/components/EthicsModal.svelte
CHANGED
@@ -4,6 +4,9 @@
|
|
4 |
import { PUBLIC_VERSION } from "$env/static/public";
|
5 |
import Logo from "$lib/components/icons/Logo.svelte";
|
6 |
import Modal from "$lib/components/Modal.svelte";
|
|
|
|
|
|
|
7 |
</script>
|
8 |
|
9 |
<Modal>
|
@@ -30,6 +33,9 @@
|
|
30 |
</p>
|
31 |
<form action="{base}/settings" use:enhance method="POST">
|
32 |
<input type="hidden" name="ethicsModalAccepted" value={true} />
|
|
|
|
|
|
|
33 |
<button
|
34 |
type="submit"
|
35 |
class="mt-2 rounded-full bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-yellow-500"
|
|
|
4 |
import { PUBLIC_VERSION } from "$env/static/public";
|
5 |
import Logo from "$lib/components/icons/Logo.svelte";
|
6 |
import Modal from "$lib/components/Modal.svelte";
|
7 |
+
import type { Settings } from "$lib/types/Settings";
|
8 |
+
|
9 |
+
export let settings: Omit<Settings, "sessionId" | "createdAt" | "updatedAt">;
|
10 |
</script>
|
11 |
|
12 |
<Modal>
|
|
|
33 |
</p>
|
34 |
<form action="{base}/settings" use:enhance method="POST">
|
35 |
<input type="hidden" name="ethicsModalAccepted" value={true} />
|
36 |
+
{#each Object.entries(settings) as [key, val]}
|
37 |
+
<input type="hidden" name={key} value={val} />
|
38 |
+
{/each}
|
39 |
<button
|
40 |
type="submit"
|
41 |
class="mt-2 rounded-full bg-black px-5 py-2 text-lg font-semibold text-gray-100 transition-colors hover:bg-yellow-500"
|
src/routes/+layout.svelte
CHANGED
@@ -135,7 +135,7 @@
|
|
135 |
<SettingsModal on:close={() => (isSettingsOpen = false)} settings={data.settings} />
|
136 |
{/if}
|
137 |
{#if !data.settings.ethicsModalAcceptedAt}
|
138 |
-
<EthicsModal />
|
139 |
{/if}
|
140 |
<slot />
|
141 |
</div>
|
|
|
135 |
<SettingsModal on:close={() => (isSettingsOpen = false)} settings={data.settings} />
|
136 |
{/if}
|
137 |
{#if !data.settings.ethicsModalAcceptedAt}
|
138 |
+
<EthicsModal settings={data.settings} />
|
139 |
{/if}
|
140 |
<slot />
|
141 |
</div>
|
src/routes/settings/+page.server.ts
CHANGED
@@ -7,13 +7,9 @@ export const actions = {
|
|
7 |
default: async function ({ request, locals }) {
|
8 |
const formData = await request.formData();
|
9 |
|
10 |
-
const existingSettings = await collections.settings.findOne({ sessionId: locals.sessionId });
|
11 |
-
|
12 |
const { ethicsModalAccepted, ...settings } = z
|
13 |
.object({
|
14 |
-
shareConversationsWithModelAuthors: z
|
15 |
-
.boolean({ coerce: true })
|
16 |
-
.default(existingSettings?.shareConversationsWithModelAuthors ?? true),
|
17 |
ethicsModalAccepted: z.boolean({ coerce: true }).optional(),
|
18 |
})
|
19 |
.parse({
|
|
|
7 |
default: async function ({ request, locals }) {
|
8 |
const formData = await request.formData();
|
9 |
|
|
|
|
|
10 |
const { ethicsModalAccepted, ...settings } = z
|
11 |
.object({
|
12 |
+
shareConversationsWithModelAuthors: z.boolean({ coerce: true }).default(true),
|
|
|
|
|
13 |
ethicsModalAccepted: z.boolean({ coerce: true }).optional(),
|
14 |
})
|
15 |
.parse({
|