Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
366 changes: 167 additions & 199 deletions bun.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "agent-web",
"private": true,
"version": "6.2.2",
"version": "6.3.0",
"type": "module",
"scripts": {
"clean": "rm -rf dist .vite node_modules/.vite",
Expand Down Expand Up @@ -76,5 +76,8 @@
"typescript": "~5.8.3",
"typescript-eslint": "^8.71.0",
"vite": "^8.3.2"
},
"allowScripts": {
"fsevents@2.3.3": true
}
}
2 changes: 2 additions & 0 deletions src/assets/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "استخدم تعليمات سلوكي",
"use_custom_prompt_helper": "عند التمكين، سيتبع {botName} تعليمات سلوكك الخاصة في هذه المحادثة.",
"use_custom_prompt_which_instructions": "أي تعليمات؟",
"split_messages_label": "محادثة طبيعية",
"split_messages_helper": "عند التمكين، سيرسل {botName} عدة رسائل أقصر بتتابع سريع بدلاً من رد واحد طويل. قد يؤدي ذلك إلى زيادة تكاليف التوصيل على المنصات التي تفرض رسوماً على كل رسالة.",
"llm_limits": {
"response_length_label": "طول الرد",
"response_length_helper": "{botName} سيكتب حتى هذا العدد من الكلمات لكل رد.",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "Meine Verhaltensanweisungen verwenden",
"use_custom_prompt_helper": "Wenn aktiviert, befolgt {botName} in diesem Chat Ihre eigenen Verhaltensanweisungen.",
"use_custom_prompt_which_instructions": "Welche Anweisungen?",
"split_messages_label": "Natürlicher Gesprächsfluss",
"split_messages_helper": "Wenn aktiviert, sendet {botName} mehrere kürzere Nachrichten schnell hintereinander statt einer einzigen langen Antwort. Dies kann die Zustellkosten auf Plattformen erhöhen, die pro Nachricht abrechnen.",
"llm_limits": {
"response_length_label": "Antwortlänge",
"response_length_helper": "{botName} schreibt maximal so viele Wörter pro Antwort.",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "Use my behavior instructions",
"use_custom_prompt_helper": "When enabled, {botName} will follow your personal behavior instructions in this chat.",
"use_custom_prompt_which_instructions": "Which instructions?",
"split_messages_label": "Natural chat flow",
"split_messages_helper": "When enabled, {botName} will send several shorter messages in quick succession, instead of one long reply. This may increase delivery costs on platforms that charge per message.",
"llm_limits": {
"response_length_label": "Response length",
"response_length_helper": "{botName} will write up to this many words per reply.",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "Usar mis instrucciones de comportamiento",
"use_custom_prompt_helper": "Cuando esté habilitado, {botName} seguirá tus propias instrucciones de comportamiento en este chat.",
"use_custom_prompt_which_instructions": "¿Qué instrucciones?",
"split_messages_label": "Flujo de conversación natural",
"split_messages_helper": "Cuando esté habilitado, {botName} enviará varios mensajes más cortos en rápida sucesión en lugar de una sola respuesta larga. Esto puede aumentar los costes de entrega en las plataformas que cobran por mensaje.",
"llm_limits": {
"response_length_label": "Longitud de respuesta",
"response_length_helper": "{botName} escribirá como máximo esta cantidad de palabras por respuesta.",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "Utiliser mes instructions de comportement",
"use_custom_prompt_helper": "Lorsque cette option est activée, {botName} suivra vos propres instructions de comportement dans ce chat.",
"use_custom_prompt_which_instructions": "Quelles instructions ?",
"split_messages_label": "Conversation naturelle",
"split_messages_helper": "Lorsque cette option est activée, {botName} enverra plusieurs messages plus courts à la suite plutôt qu’une seule longue réponse. Cela peut augmenter les frais d’envoi sur les plateformes qui facturent chaque message.",
"llm_limits": {
"response_length_label": "Longueur de réponse",
"response_length_helper": "{botName} écrira au maximum ce nombre de mots par réponse.",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "मेरे व्यवहार निर्देशों का उपयोग करें",
"use_custom_prompt_helper": "सक्षम होने पर, {botName} इस चैट में आपके व्यक्तिगत व्यवहार निर्देशों का पालन करेगा।",
"use_custom_prompt_which_instructions": "कौन से निर्देश?",
"split_messages_label": "स्वाभाविक बातचीत",
"split_messages_helper": "सक्षम होने पर, {botName} एक लंबे जवाब के बजाय कई छोटे संदेश जल्दी-जल्दी भेजेगा। इससे हर संदेश के लिए शुल्क लेने वाले प्लेटफ़ॉर्म पर डिलीवरी की लागत बढ़ सकती है।",
"llm_limits": {
"response_length_label": "उत्तर की लंबाई",
"response_length_helper": "{botName} प्रति उत्तर अधिकतम इतने शब्द लिखेगा।",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "Usa le mie istruzioni di comportamento",
"use_custom_prompt_helper": "Quando abilitato, {botName} seguirà le tue proprie istruzioni di comportamento in questa chat.",
"use_custom_prompt_which_instructions": "Quali istruzioni?",
"split_messages_label": "Flusso di conversazione naturale",
"split_messages_helper": "Quando abilitato, {botName} invierà diversi messaggi più brevi in rapida successione, invece di un'unica risposta lunga. Questo può aumentare i costi di consegna sulle piattaforme che addebitano ogni messaggio.",
"llm_limits": {
"response_length_label": "Lunghezza risposta",
"response_length_helper": "{botName} scriverà al massimo questo numero di parole per risposta.",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "Использовать мои инструкции поведения",
"use_custom_prompt_helper": "Когда включено, {botName} будет следовать вашим личным инструкциям поведения в этом чате.",
"use_custom_prompt_which_instructions": "Какие инструкции?",
"split_messages_label": "Естественный ход разговора",
"split_messages_helper": "Когда включено, {botName} будет отправлять несколько коротких сообщений подряд вместо одного длинного ответа. Это может увеличить стоимость доставки на платформах, где оплачивается каждое сообщение.",
"llm_limits": {
"response_length_label": "Длина ответа",
"response_length_helper": "{botName} напишет не более этого количества слов за ответ.",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/sr.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "Koristi moja uputstva za ponašanje",
"use_custom_prompt_helper": "Kada je omogućeno, {botName} će pratiti Vaša lična uputstva za ponašanje u ovom četu.",
"use_custom_prompt_which_instructions": "Koja uputstva?",
"split_messages_label": "Prirodan tok razgovora",
"split_messages_helper": "Kada je omogućeno, {botName} će slati nekoliko kraćih poruka zaredom, umesto jednog dugačkog odgovora. Ovo može povećati troškove dostave na platformama koje naplaćuju svaku poruku.",
"llm_limits": {
"response_length_label": "Dužina odgovora",
"response_length_helper": "{botName} će napisati najviše ovoliko reči po odgovoru.",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "Benim davranış talimatlarımı kullan",
"use_custom_prompt_helper": "Etkinleştirildiğinde, {botName} bu sohbette kişisel davranış talimatlarınızı takip edecektir.",
"use_custom_prompt_which_instructions": "Hangi talimatlar?",
"split_messages_label": "Doğal sohbet akışı",
"split_messages_helper": "Etkinleştirildiğinde, {botName} tek bir uzun yanıt yerine art arda birkaç kısa mesaj gönderecektir. Bu, mesaj başına ücret alan platformlarda teslimat maliyetlerini artırabilir.",
"llm_limits": {
"response_length_label": "Yanıt uzunluğu",
"response_length_helper": "{botName} yanıt başına en fazla bu kadar kelime yazacaktır.",
Expand Down
2 changes: 2 additions & 0 deletions src/assets/i18n/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,8 @@
"use_custom_prompt_label": "使用我的行为指令",
"use_custom_prompt_helper": "启用后,{botName} 将在此聊天中遵循您的个人行为指令。",
"use_custom_prompt_which_instructions": "哪些指令?",
"split_messages_label": "自然的对话节奏",
"split_messages_helper": "启用后,{botName} 将快速连续发送多条较短的消息,而不是一条长回复。在按消息收费的平台上,这可能会增加消息发送成本。",
"llm_limits": {
"response_length_label": "回复长度",
"response_length_helper": "{botName} 每次回复最多写这么多字。",
Expand Down
12 changes: 12 additions & 0 deletions src/components/settings/chat/ChatSettingsForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,18 @@ const ChatSettingsForm: React.FC<ChatSettingsFormProps> = ({
onProfileLinkClick={onProfileLinkClick}
profileLinkText={t("use_custom_prompt_which_instructions")}
/>

<SettingToggle
id="split-messages"
label={t("split_messages_label")}
helperText={t("split_messages_helper", { botName })}
checked={userChatConfig.split_messages}
onChange={(splitMessages) =>
onUserChatConfigChange({ split_messages: splitMessages })
}
disabled={disabled}
className={fieldClassName}
/>
</SettingsSection>
</div>
);
Expand Down
14 changes: 13 additions & 1 deletion src/hooks/useChats.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useEffect, useState } from "react";
import { useCallback, useEffect, useState } from "react";
import { fetchAllChatSettings, ChatSettings } from "@/services/chat-settings-service";
import {
getCachedChats,
Expand All @@ -8,6 +8,7 @@ import {

export interface UseChatsResult {
chats: ChatSettings[];
updateChats: (updatedChats: ChatSettings[]) => void;
isLoading: boolean;
error: Error | null;
}
Expand Down Expand Up @@ -61,8 +62,19 @@ export const useChats = (
fetchChats();
}, [userId, rawToken]);

const updateChats = useCallback(
(updatedChats: ChatSettings[]) => {
setChats(updatedChats);
if (userId) {
setCachedChats(userId, updatedChats);
}
},
[userId],
);

return {
chats,
updateChats,
isLoading,
error,
};
Expand Down
2 changes: 2 additions & 0 deletions src/lib/translation-keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,8 @@ export type TranslationKey =
| "use_custom_prompt_label"
| "use_custom_prompt_helper"
| "use_custom_prompt_which_instructions"
| "split_messages_label"
| "split_messages_helper"
| "llm_limits.response_length_label"
| "llm_limits.response_length_helper"
| "llm_limits.response_length_minimum"
Expand Down
21 changes: 19 additions & 2 deletions src/pages/BaseSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ interface BaseSettingsPageProps {
page: SettingsPage;
children: React.ReactNode;
cardTitle?: string;
stickyTitleSubtitle?: string;
onActionClicked?: () => void;
actionDisabled?: boolean;
followupContent?: React.ReactNode;
Expand Down Expand Up @@ -99,6 +100,7 @@ const BaseSettingsPage = forwardRef<BaseSettingsPageRef, BaseSettingsPageProps>(
page,
children,
cardTitle,
stickyTitleSubtitle,
onActionClicked = () => {},
actionDisabled = false,
followupContent,
Expand Down Expand Up @@ -487,8 +489,23 @@ const BaseSettingsPage = forwardRef<BaseSettingsPageRef, BaseSettingsPageProps>(
<div className="absolute top-0 left-0 w-full animate-in border-b border-border bg-background/94 bg-[radial-gradient(28rem_10rem_at_0%_50%,oklch(0.4_0.12_326/18%),transparent_70%)] py-3 shadow-[0_16px_34px_oklch(0.05_0.01_292/0.24)] fade-in-0 slide-in-from-top-1 duration-200 ease-out backdrop-blur-xl">
<div className={contentContainerClassName}>
{renderActionBar(
<span className="truncate text-base font-semibold tracking-tight text-foreground">
{getSettingsPageTitle(page)}
<span className="flex min-w-0 items-center gap-2">
<span className="shrink-0 text-base font-semibold tracking-tight text-foreground">
{getSettingsPageTitle(page)}
</span>
{stickyTitleSubtitle && (
<>
<span
aria-hidden="true"
className="shrink-0 text-muted-foreground/55"
>
·
</span>
<span className="truncate text-sm font-medium text-muted-foreground">
{stickyTitleSubtitle}
</span>
</>
)}
</span>,
)}
</div>
Expand Down
23 changes: 12 additions & 11 deletions src/pages/ChatSettingsPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ import {
trackChatSettingsSaved,
} from "@/lib/analytics-settings";
import BaseSettingsPage from "@/pages/BaseSettingsPage";
import { setCachedChats } from "@/services/chat-cache";
import {
saveChatSettings,
type ChatConfig,
Expand All @@ -40,6 +39,7 @@ const hasUserChatConfigChanges = (
): boolean =>
current.use_about_me !== remote.use_about_me ||
current.use_custom_prompt !== remote.use_custom_prompt ||
current.split_messages !== remote.split_messages ||
current.max_output_tokens !== remote.max_output_tokens ||
current.max_chat_history_depth !== remote.max_chat_history_depth ||
current.max_iterations !== remote.max_iterations;
Expand All @@ -53,10 +53,7 @@ const ChatSettingsPage: React.FC = () => {
const { error, accessToken, isLoadingState, setError, setIsLoadingState } =
usePageSession();
const { navigateToProfile } = useNavigation();
const { chats, isLoading: isChatsLoading } = useChats(
user_id || accessToken?.decoded.sub,
accessToken?.raw,
);
const { chats, isLoading: isChatsLoading, updateChats } = useChats(user_id || accessToken?.decoded.sub, accessToken?.raw);
const selectedChat = chats.find(
(chat) => chat.chat_config.chat_id === chat_id,
);
Expand Down Expand Up @@ -152,6 +149,7 @@ const ChatSettingsPage: React.FC = () => {
? {
use_about_me: chatSettings.user_chat_config.use_about_me,
use_custom_prompt: chatSettings.user_chat_config.use_custom_prompt,
split_messages: chatSettings.user_chat_config.split_messages,
max_output_tokens: chatSettings.user_chat_config.max_output_tokens,
max_chat_history_depth:
chatSettings.user_chat_config.max_chat_history_depth,
Expand All @@ -171,13 +169,11 @@ const ChatSettingsPage: React.FC = () => {
});
trackChatSettingsSaved(chatConfigPayload, userChatConfigPayload);
setRemoteSettings(chatSettings);
const updatedChats = chats.map((chat) =>
chat.chat_config.chat_id === chat_id ? chatSettings : chat,
updateChats(
chats.map((chat) =>
chat.chat_config.chat_id === chat_id ? chatSettings : chat,
),
);
const resolvedUserId = user_id || accessToken.decoded.sub;
if (resolvedUserId) {
setCachedChats(resolvedUserId, updatedChats);
}
toast(t("saved"));
} catch (saveError) {
console.error("Error saving settings!", saveError);
Expand Down Expand Up @@ -216,6 +212,11 @@ const ChatSettingsPage: React.FC = () => {
onExternalErrorDismiss={() => setError(null)}
contentVariant="flow"
selectedChat={selectedChat}
stickyTitleSubtitle={
selectedChat
? selectedChat.chat_config.title || t("untitled")
: undefined
}
followupContent={
<SettingsGuideChip
icon={UserRound}
Expand Down
1 change: 1 addition & 0 deletions src/services/chat-settings-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export interface ChatConfig {

export interface UserChatConfig {
use_about_me: boolean;
split_messages: boolean;
use_custom_prompt: boolean;
max_output_tokens: number;
max_chat_history_depth: number;
Expand Down
Loading