Skip to content

Commit 9afe72b

Browse files
authored
Merge pull request #485 from n4ze3m/next
1.5.4
2 parents 0d07cc4 + d5fad55 commit 9afe72b

40 files changed

+322
-61
lines changed

docs/features/prompts.md

+13
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,19 @@ There are two types of custom prompts:
2222

2323
System prompts will be set as the `system` type of prompt in the LLM. This means that the prompt will be sent to the LLM as a system prompt. This is useful for setting the context of the conversation.
2424

25+
#### Supported System Prompt Variables
26+
27+
You can use the following variables in your system prompts:
28+
29+
- `{current_date_time}` - The current date and time in local format
30+
- `{current_year}` - The current year
31+
- `{current_month}` - The current month (0-11)
32+
- `{current_day}` - The current day of the month
33+
- `{current_hour}` - The current hour (0-23)
34+
- `{current_minute}` - The current minute (0-59)
35+
36+
These variables will be automatically replaced with their respective values when the prompt is sent to the LLM.
37+
2538
### Quick Prompts
2639

2740
Quick prompts are quick prompts that you can use to quickly send a prompt to the LLM. You can use quick prompts by clicking on the `Quick Prompts` button in the input box.

src/assets/locale/ar/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "فتح التفكير المنطقي بشكل افتراضي"
50+
},
51+
"userChatBubble": {
52+
"label": "استخدام فقاعة الدردشة لرسائل المستخدم"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/da/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
},
4545
"openReasoning": {
4646
"label": "Åbn Ræsonnement Sammenfoldet som standard"
47+
},
48+
"userChatBubble": {
49+
"label": "Brug chatboble til brugermeddelelser"
4750
}
4851
},
4952
"sidepanelRag": {

src/assets/locale/de/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "Offene Argumentation standardmäßig eingeklappt"
50+
},
51+
"userChatBubble": {
52+
"label": "Chat-Blase für Benutzernachrichten verwenden"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/en/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "Open Reasoning Collapse by default"
50+
},
51+
"userChatBubble": {
52+
"label": "Use Chat Bubble for User Messages"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/es/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "Abrir el Razonamiento Colapsado por defecto"
50+
},
51+
"userChatBubble": {
52+
"label": "Usar Burbuja de Chat para Mensajes del Usuario"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/fa/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@
4444
},
4545
"openReasoning": {
4646
"label": "باز کردن استدلال به صورت پیش فرض"
47+
},
48+
"userChatBubble": {
49+
"label": "استفاده از حباب گفتگو برای پیام‌های کاربر"
4750
}
4851
},
4952
"sidepanelRag": {

src/assets/locale/fr/settings.json

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "Déplier par défaut le raisonnement"
50+
},
51+
"userChatBubble": {
52+
"label": "Utiliser une bulle de discussion pour les messages de l'utilisateur"
5053
}
5154
},
5255
"sidepanelRag": {
@@ -392,4 +395,4 @@
392395
"title": "Paramètres Chrome AI"
393396
},
394397
"mermaid": "Mermaid"
395-
}
398+
}

src/assets/locale/it/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "Apri il Ragionamento Compresso per impostazione predefinita"
50+
},
51+
"userChatBubble": {
52+
"label": "Usa fumetto chat per i messaggi utente"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/ja-JP/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
},
5151
"openReasoning": {
5252
"label": "デフォルトで推論を展開する"
53+
},
54+
"userChatBubble": {
55+
"label": "ユーザーメッセージにチャットバブルを使用"
5356
}
5457
},
5558
"sidepanelRag": {

src/assets/locale/ko/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
},
5151
"openReasoning": {
5252
"label": "추론 섹션을 기본적으로 열기"
53+
},
54+
"userChatBubble": {
55+
"label": "사용자 메시지에 채팅 버블 사용"
5356
}
5457
},
5558
"sidepanelRag": {

src/assets/locale/ml/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
},
5151
"openReasoning": {
5252
"label": "സ്ഥിരസ്ഥിതിയായി റീസണിംഗ് കൊളാപ്സ് തുറക്കുക"
53+
},
54+
"userChatBubble": {
55+
"label": "ഉപയോക്തൃ സന്ദേശങ്ങൾക്കായി ചാറ്റ് ബബിൾ ഉപയോഗിക്കുക"
5356
}
5457
},
5558
"sidepanelRag": {

src/assets/locale/no/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "Åpne Resonnement Sammenfoldet som standard"
50+
},
51+
"userChatBubble": {
52+
"label": "Bruk chatboble for bruker meldinger"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/pt-BR/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "Abrir Raciocínio Recolhido por padrão"
50+
},
51+
"userChatBubble": {
52+
"label": "Usar Balão de Chat para Mensagens do Usuário"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/ru/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "Открыть рассуждения свернутыми по умолчанию"
50+
},
51+
"userChatBubble": {
52+
"label": "Использовать пузырь чата для сообщений пользователя"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/sv/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "Öppna resonemang kollapsat som standard"
50+
},
51+
"userChatBubble": {
52+
"label": "Använd chattbubbla för användarmeddelanden"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/uk/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "Розгорнути міркування за замовчуванням"
50+
},
51+
"userChatBubble": {
52+
"label": "Використовувати бульбашку чату для повідомлень користувача"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/zh-TW/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,9 @@
4747
},
4848
"openReasoning": {
4949
"label": "預設展開推理過程"
50+
},
51+
"userChatBubble": {
52+
"label": "使用對話泡泡顯示使用者訊息"
5053
}
5154
},
5255
"sidepanelRag": {

src/assets/locale/zh/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@
5050
},
5151
"openReasoning": {
5252
"label": "默认展开推理过程"
53+
},
54+
"userChatBubble": {
55+
"label": "使用聊天气泡显示用户消息"
5356
}
5457
},
5558
"sidepanelRag": {

src/components/Common/Playground/Message.tsx

+27-22
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import { Tag, Image, Tooltip, Collapse, Popover, Avatar } from "antd"
44
import { WebSearch } from "./WebSearch"
55
import {
66
CheckIcon,
7-
ClipboardIcon,
87
CopyIcon,
98
InfoIcon,
109
Pen,
@@ -22,6 +21,7 @@ import { GenerationInfo } from "./GenerationInfo"
2221
import { parseReasoning } from "@/libs/reasoning"
2322
import { humanizeMilliseconds } from "@/utils/humanize-milliseconds"
2423
import { useStorage } from "@plasmohq/storage/hook"
24+
import { PlaygroundUserMessageBubble } from "./PlaygroundUserMessage"
2525
type Props = {
2626
message: string
2727
message_type?: string
@@ -54,9 +54,15 @@ export const PlaygroundMessage = (props: Props) => {
5454
const [isBtnPressed, setIsBtnPressed] = React.useState(false)
5555
const [editMode, setEditMode] = React.useState(false)
5656
const [checkWideMode] = useStorage("checkWideMode", false)
57+
const [isUserChatBubble] = useStorage("userChatBubble", true)
5758

5859
const { t } = useTranslation("common")
5960
const { cancel, isSpeaking, speak } = useTTS()
61+
62+
if (isUserChatBubble && !props.isBot) {
63+
return <PlaygroundUserMessageBubble {...props} />
64+
}
65+
6066
return (
6167
<div
6268
className={`group relative flex w-full max-w-3xl flex-col items-end justify-center pb-2 md:px-4 lg:w-4/5 text-gray-800 dark:text-gray-100 ${checkWideMode ? "max-w-none" : ""}`}>
@@ -247,29 +253,28 @@ export const PlaygroundMessage = (props: Props) => {
247253
</button>
248254
</Tooltip>
249255
)}
256+
{!props.hideCopy && (
257+
<Tooltip title={t("copyToClipboard")}>
258+
<button
259+
aria-label={t("copyToClipboard")}
260+
onClick={() => {
261+
navigator.clipboard.writeText(props.message)
262+
setIsBtnPressed(true)
263+
setTimeout(() => {
264+
setIsBtnPressed(false)
265+
}, 2000)
266+
}}
267+
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
268+
{!isBtnPressed ? (
269+
<CopyIcon className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
270+
) : (
271+
<CheckIcon className="w-3 h-3 text-green-400 group-hover:text-green-500" />
272+
)}
273+
</button>
274+
</Tooltip>
275+
)}
250276
{props.isBot && (
251277
<>
252-
{!props.hideCopy && (
253-
<Tooltip title={t("copyToClipboard")}>
254-
<button
255-
aria-label={t("copyToClipboard")}
256-
onClick={() => {
257-
navigator.clipboard.writeText(props.message)
258-
setIsBtnPressed(true)
259-
setTimeout(() => {
260-
setIsBtnPressed(false)
261-
}, 2000)
262-
}}
263-
className="flex items-center justify-center w-6 h-6 rounded-full bg-gray-100 dark:bg-gray-800 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors duration-200 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-gray-500">
264-
{!isBtnPressed ? (
265-
<CopyIcon className="w-3 h-3 text-gray-400 group-hover:text-gray-500" />
266-
) : (
267-
<CheckIcon className="w-3 h-3 text-green-400 group-hover:text-green-500" />
268-
)}
269-
</button>
270-
</Tooltip>
271-
)}
272-
273278
{props.generationInfo && (
274279
<Popover
275280
content={

0 commit comments

Comments
 (0)