From 0c7f0f4430adaa56ede03c69b03bcffb1079ff4d Mon Sep 17 00:00:00 2001 From: "Timothy J. Baek" Date: Fri, 24 May 2024 23:54:22 -0700 Subject: [PATCH] refac: suggestion prompts --- .../workspace/models/create/+page.svelte | 135 ++++++++++------- .../(app)/workspace/models/edit/+page.svelte | 138 +++++++++++------- 2 files changed, 165 insertions(+), 108 deletions(-) diff --git a/src/routes/(app)/workspace/models/create/+page.svelte b/src/routes/(app)/workspace/models/create/+page.svelte index 0247bfbb4..d80648fb5 100644 --- a/src/routes/(app)/workspace/models/create/+page.svelte +++ b/src/routes/(app)/workspace/models/create/+page.svelte @@ -386,64 +386,93 @@
-
-
{$i18n.t('Prompt suggestions')}
+
+
+
{$i18n.t('Prompt suggestions')}
- -
-
- {#each info.meta.suggestion_prompts as prompt, promptIdx} -
- + {#if info.meta.suggestion_prompts === null} + {$i18n.t('Default')} + {:else} + {$i18n.t('Custom')} + {/if} + +
- -
- {/each} + + + + {/if}
+ + {#if info.meta.suggestion_prompts} +
+ {#if info.meta.suggestion_prompts.length > 0} + {#each info.meta.suggestion_prompts as prompt, promptIdx} +
+ + + +
+ {/each} + {:else} +
No suggestion prompts
+ {/if} +
+ {/if}
diff --git a/src/routes/(app)/workspace/models/edit/+page.svelte b/src/routes/(app)/workspace/models/edit/+page.svelte index 18efe5a08..c8fa2ecb2 100644 --- a/src/routes/(app)/workspace/models/edit/+page.svelte +++ b/src/routes/(app)/workspace/models/edit/+page.svelte @@ -44,8 +44,7 @@ meta: { profile_image_url: '/favicon.png', description: '', - content: '', - suggestion_prompts: [] + suggestion_prompts: null }, params: { system: '' @@ -366,64 +365,93 @@
-
-
{$i18n.t('Prompt suggestions')}
+
+
+
{$i18n.t('Prompt suggestions')}
- -
-
- {#each info.meta.suggestion_prompts as prompt, promptIdx} -
- + {#if info.meta.suggestion_prompts === null} + {$i18n.t('Default')} + {:else} + {$i18n.t('Custom')} + {/if} + +
- -
- {/each} + + + + {/if}
+ + {#if info.meta.suggestion_prompts} +
+ {#if info.meta.suggestion_prompts.length > 0} + {#each info.meta.suggestion_prompts as prompt, promptIdx} +
+ + + +
+ {/each} + {:else} +
No suggestion prompts
+ {/if} +
+ {/if}