From 3fff7968a30cbf8ce0d02af8c87d2c2458240448 Mon Sep 17 00:00:00 2001 From: Jing Hua Date: Mon, 1 May 2023 21:51:27 +0800 Subject: [PATCH] feat: clear prompt library Fixes #266 --- public/locales/da/main.json | 1 + public/locales/en-US/main.json | 1 + public/locales/en/main.json | 1 + public/locales/es/main.json | 1 + public/locales/fr/main.json | 1 + public/locales/it/main.json | 1 + public/locales/ja/main.json | 1 + public/locales/ms/main.json | 1 + public/locales/nb/main.json | 1 + public/locales/sv/main.json | 1 + public/locales/zh-CN/main.json | 1 + public/locales/zh-HK/main.json | 1 + public/locales/zh-TW/main.json | 1 + .../PromptLibraryMenu/PromptLibraryMenu.tsx | 12 ++++++++++++ 14 files changed, 25 insertions(+) diff --git a/public/locales/da/main.json b/public/locales/da/main.json index 705373c..ef8d0d5 100644 --- a/public/locales/da/main.json +++ b/public/locales/da/main.json @@ -34,6 +34,7 @@ "resetCost": "Nulstil Omkostninger", "countTotalTokens": "Tæl totale tokens", "morePrompts": "Du kan finde flere opgaver her: ", + "clearPrompts": "Ryd prompter", "postOnShareGPT": { "title": "Indlæg på ShareGPT", "warning": "Vær opmærksom på, at ved at poste din samtale på ShareGPT, vil den blive offentligt tilgængelig og synlig for alle. Når den er postet, kan samtalen ikke skjules eller slettes og kan blive arkiveret eller delt af andre. Vi råder dig til at overveje nøje og undgå at dele følsomme eller private oplysninger på denne platform." diff --git a/public/locales/en-US/main.json b/public/locales/en-US/main.json index 4bd74d1..a27cebb 100644 --- a/public/locales/en-US/main.json +++ b/public/locales/en-US/main.json @@ -34,6 +34,7 @@ "resetCost": "Reset Costs", "countTotalTokens": "Count total tokens", "morePrompts": "You can find more prompts here: ", + "clearPrompts": "Clear prompts", "postOnShareGPT": { "title": "Post on ShareGPT", "warning": "Please be aware that by posting your conversation on ShareGPT, it will become publicly accessible and viewable to anyone. Once posted, the conversation cannot be hidden or deleted, and may be archived or shared by others. We advise you to consider carefully and avoid sharing sensitive or private information on this platform." diff --git a/public/locales/en/main.json b/public/locales/en/main.json index 4bd74d1..a27cebb 100644 --- a/public/locales/en/main.json +++ b/public/locales/en/main.json @@ -34,6 +34,7 @@ "resetCost": "Reset Costs", "countTotalTokens": "Count total tokens", "morePrompts": "You can find more prompts here: ", + "clearPrompts": "Clear prompts", "postOnShareGPT": { "title": "Post on ShareGPT", "warning": "Please be aware that by posting your conversation on ShareGPT, it will become publicly accessible and viewable to anyone. Once posted, the conversation cannot be hidden or deleted, and may be archived or shared by others. We advise you to consider carefully and avoid sharing sensitive or private information on this platform." diff --git a/public/locales/es/main.json b/public/locales/es/main.json index 8d18c39..b3666fe 100644 --- a/public/locales/es/main.json +++ b/public/locales/es/main.json @@ -34,6 +34,7 @@ "resetCost": "Reiniciar costos", "countTotalTokens": "Contar tokens totales", "morePrompts": "Puedes encontrar más prompts aquí: ", + "clearPrompts": "Prompts claras", "postOnShareGPT": { "title": "Publicar en ShareGPT", "warning": "Por favor, tenga en cuenta que al publicar su conversación en ShareGPT, esta será accesible y visible para cualquiera. Una vez publicada, la conversación no se podrá ocultar ni eliminar, y puede ser archivada o compartida por otros. Le aconsejamos que lo considere detenidamente y evite compartir información sensible o privada en esta plataforma." diff --git a/public/locales/fr/main.json b/public/locales/fr/main.json index a012b0a..e017a63 100644 --- a/public/locales/fr/main.json +++ b/public/locales/fr/main.json @@ -34,6 +34,7 @@ "resetCost": "Réinitialiser les coûts", "countTotalTokens": "Compter le nombre total de jetons", "morePrompts": "Vous pouvez trouver plus de prompts ici : ", + "clearPrompts": "Effacer les prompts", "postOnShareGPT": { "title": "Publier sur ShareGPT", "warning": "Veuillez noter que si vous publiez votre conversation sur ShareGPT, elle deviendra accessible au public et visible par tous. Une fois publiée, la conversation ne peut pas être cachée ou supprimée, et peut être archivée ou partagée par d'autres. Nous vous conseillons de considérer attentivement et d'éviter de partager des informations sensibles ou privées sur cette plateforme." diff --git a/public/locales/it/main.json b/public/locales/it/main.json index 99e474d..00f1001 100644 --- a/public/locales/it/main.json +++ b/public/locales/it/main.json @@ -34,6 +34,7 @@ "resetCost": "Ripristina costi", "countTotalTokens": "Conteggio totale dei token", "morePrompts": "Puoi trovare altri prompt qui:", + "clearPrompts": "Cancella prompts", "postOnShareGPT": { "title": "Pubblica su ShareGPT", "warning": "Ti ricordiamo che pubblicando la tua conversazione su ShareGPT, questa diventerà pubblicamente accessibile e visualizzabile da chiunque. Una volta pubblicata, la conversazione non può essere nascosta o cancellata e può essere archiviata o condivisa da altri. Ti consigliamo di valutare attentamente e di evitare di condividere informazioni sensibili o private su questa piattaforma." diff --git a/public/locales/ja/main.json b/public/locales/ja/main.json index 56714ec..b8c153e 100644 --- a/public/locales/ja/main.json +++ b/public/locales/ja/main.json @@ -34,6 +34,7 @@ "resetCost": "コストをリセットする", "countTotalTokens": "トークンの合計数をカウント", "morePrompts": "ここでさらにプロンプトを見つけることができます:", + "clearPrompts": "プロンプトをクリア", "postOnShareGPT": { "title": "ShareGPTに投稿", "warning": "ShareGPTに会話を投稿すると、誰でもアクセスして閲覧できるようになることに注意してください。一度投稿すると、会話は非表示にできず、削除もできません。また、他の人がアーカイブや共有する可能性があります。このプラットフォームで機密性のある情報や個人情報を共有しないように注意してください。" diff --git a/public/locales/ms/main.json b/public/locales/ms/main.json index 03a4216..26f7e53 100644 --- a/public/locales/ms/main.json +++ b/public/locales/ms/main.json @@ -34,6 +34,7 @@ "resetCost": "Reset Kos", "countTotalTokens": "Kira jumlah token keseluruhan", "morePrompts": "Anda boleh mencari lebih banyak arahan di sini: ", + "clearPrompts": "Kosongkan arahan", "postOnShareGPT": { "title": "Siarkan di ShareGPT", "warning": "Sila ambil perhatian bahawa dengan menyiarkan perbualan anda di ShareGPT, ia akan menjadi boleh diakses dan dilihat oleh sesiapa sahaja. Setelah disiarkan, perbualan tidak boleh disembunyikan atau dipadam, dan mungkin diarkibkan atau dikongsi oleh orang lain. Kami menasihatkan anda untuk mempertimbangkan dengan teliti dan mengelakkan berkongsi maklumat sensitif atau peribadi di platform ini." diff --git a/public/locales/nb/main.json b/public/locales/nb/main.json index 72994dd..462828e 100644 --- a/public/locales/nb/main.json +++ b/public/locales/nb/main.json @@ -34,6 +34,7 @@ "resetCost": "Tilbakestill kostnader", "countTotalTokens": "Tell totale token", "morePrompts": "Du kan finne flere oppgaver her: ", + "clearPrompts": "Tøm oppgave", "postOnShareGPT": { "title": "Innlegg på ShareGPT", "warning": "Vær oppmerksom på at ved å poste samtalen din på ShareGPT, vil den bli offentlig tilgjengelig og synlig for alle. Når den er postet, kan samtalen ikke skjules eller slettes, og den kan bli arkivert eller delt av andre. Vi anbefaler deg å tenke nøye gjennom og unngå å dele sensitiv eller privat informasjon på denne plattformen." diff --git a/public/locales/sv/main.json b/public/locales/sv/main.json index 5188d6b..a5a1283 100644 --- a/public/locales/sv/main.json +++ b/public/locales/sv/main.json @@ -34,6 +34,7 @@ "resetCost": "Återställ kostnader", "countTotalTokens": "Räkna totala token", "morePrompts": "Du kan hitta fler uppmaningar här: ", + "clearPrompts": "Rensa uppmaningar", "postOnShareGPT": { "title": "Inlägg på ShareGPT", "warning": "Var medveten om att genom att posta din konversation på ShareGPT kommer den att bli offentligt tillgänglig och synlig för alla. När den väl är postad kan konversationen varken döljas eller raderas och kan arkiveras eller delas av andra. Vi rekommenderar dig att tänka noggrant igenom och undvika att dela känslig eller privat information på denna plattform." diff --git a/public/locales/zh-CN/main.json b/public/locales/zh-CN/main.json index 46b2169..65a3d7b 100644 --- a/public/locales/zh-CN/main.json +++ b/public/locales/zh-CN/main.json @@ -34,6 +34,7 @@ "resetCost": "重置费用", "countTotalTokens": "计算总 Token 数", "morePrompts": "更多提示词请点击:", + "clearPrompts": "清除提示词", "postOnShareGPT": { "title": "发布至 ShareGPT", "warning": "请注意,把您的对话发布到 ShareGPT 后,任何人都可以公开访问和查看。发布后,对话不能被隐藏或删除,且可能被其他人存档或分享。建议您慎重考虑,在这个平台上避免分享敏感或私密信息。" diff --git a/public/locales/zh-HK/main.json b/public/locales/zh-HK/main.json index 66bae6e..dc4125b 100644 --- a/public/locales/zh-HK/main.json +++ b/public/locales/zh-HK/main.json @@ -34,6 +34,7 @@ "resetCost": "重置費用", "countTotalTokens": "計算總 Token 數", "morePrompts": "如果你想揾更多 prompt,撳呢度:", + "clearPrompts": "清空 prompts", "postOnShareGPT": { "title": "po 上 ShareGPT", "warning": "請注意,你將呢個傾偈 po 上 ShareGPT 之後,佢會係公開嘅,所有人都可以見到你寫嘅嘢。一旦 po 咗,呢個傾偈將冇得被隱藏或刪除,亦都可能畀人存檔同分享。我哋建議你仔細諗下,唔好喺嗰度分享敏感或私人資料。" diff --git a/public/locales/zh-TW/main.json b/public/locales/zh-TW/main.json index 5cf032d..20696de 100644 --- a/public/locales/zh-TW/main.json +++ b/public/locales/zh-TW/main.json @@ -34,6 +34,7 @@ "resetCost": "重置費用", "countTotalTokens": "計算總 Token 數", "morePrompts": "更多提示詞請點選:", + "clearPrompts": "清除提示詞", "postOnShareGPT": { "title": "發佈至 ShareGPT", "warning": "請注意,將您的對話發佈至 ShareGPT 後,任何人都可以公開訪問和查看。一旦發佈,對話將無法隱藏或刪除,並且可能被他人存檔或分享。我們建議您慎重考慮,並避免在此平台上分享敏感或私人信息。" diff --git a/src/components/PromptLibraryMenu/PromptLibraryMenu.tsx b/src/components/PromptLibraryMenu/PromptLibraryMenu.tsx index f7d2d52..61ec6fe 100644 --- a/src/components/PromptLibraryMenu/PromptLibraryMenu.tsx +++ b/src/components/PromptLibraryMenu/PromptLibraryMenu.tsx @@ -67,6 +67,10 @@ const PromptLibraryMenuPopUp = ({ _setPrompts(updatedPrompts); }; + const clearPrompts = () => { + _setPrompts([]); + }; + const handleOnFocus = (e: React.FocusEvent) => { e.target.style.height = 'auto'; e.target.style.height = `${e.target.scrollHeight}px`; @@ -149,6 +153,14 @@ const PromptLibraryMenuPopUp = ({
+
+
+ {t('clearPrompts')} +
+
{t('morePrompts')}