Skip to content

Commit 3383f36

Browse files
committed
feat: add context limit prompt text to chat interface
1 parent 82bf3dc commit 3383f36

File tree

16 files changed

+58
-15
lines changed

16 files changed

+58
-15
lines changed

webview-ui/src/components/chat/TaskHeader.tsx

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
5050
const textContainerRef = useRef<HTMLDivElement>(null)
5151
const textRef = useRef<HTMLDivElement>(null)
5252
const contextWindow = selectedModelInfo?.contextWindow || 1
53+
const isContextNearLimit = contextWindow > 0 && contextTokens / contextWindow >= 0.9
5354

5455
/*
5556
When dealing with event listeners in React components that depend on state
@@ -347,6 +348,18 @@ const TaskHeader: React.FC<TaskHeaderProps> = ({
347348
<TaskActions item={currentTaskItem} />
348349
</div>
349350
)}
351+
{isContextNearLimit && (
352+
<div className="flex items-start gap-1" style={{ flexWrap: "wrap" }}>
353+
<span className="font-bold" style={{ flexShrink: 0 }}>
354+
{t("chat:task.contextLimitTipTitle")}
355+
</span>
356+
<span
357+
className="text-yellow-300"
358+
style={{ whiteSpace: "normal", wordBreak: "break-word", flex: 1 }}>
359+
{t("chat:task.contextLimitTipText")}
360+
</span>
361+
</div>
362+
)}
350363
</div>
351364
</>
352365
)}

webview-ui/src/i18n/locales/ca/chat.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"contextWindow": "Finestra de context:",
1111
"closeAndStart": "Tancar tasca i iniciar-ne una de nova",
1212
"export": "Exportar historial de tasques",
13-
"delete": "Eliminar tasca (Shift + Clic per ometre confirmació)"
13+
"delete": "Eliminar tasca (Shift + Clic per ometre confirmació)",
14+
"contextLimitTipTitle": "Nota:",
15+
"contextLimitTipText": "El context està arribant al límit màxim. Es recomana iniciar una nova finestra de tasca per evitar la truncació."
1416
},
1517
"unpin": "Desfixar",
1618
"pin": "Fixar",

webview-ui/src/i18n/locales/de/chat.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"contextWindow": "Kontextfenster:",
1111
"closeAndStart": "Aufgabe schließen und neue starten",
1212
"export": "Aufgabenverlauf exportieren",
13-
"delete": "Aufgabe löschen (Shift + Klick zum Überspringen der Bestätigung)"
13+
"delete": "Aufgabe löschen (Shift + Klick zum Überspringen der Bestätigung)",
14+
"contextLimitTipTitle": "Hinweis:",
15+
"contextLimitTipText": "Der Kontext nähert sich dem maximalen Limit. Es wird empfohlen, ein neues Aufgabenfenster zu starten, um eine Kürzung zu vermeiden."
1416
},
1517
"unpin": "Lösen von oben",
1618
"pin": "Anheften",

webview-ui/src/i18n/locales/en/chat.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"contextWindow": "Context Window:",
1111
"closeAndStart": "Close task and start a new one",
1212
"export": "Export task history",
13-
"delete": "Delete Task (Shift + Click to skip confirmation)"
13+
"delete": "Delete Task (Shift + Click to skip confirmation)",
14+
"contextLimitTipTitle": "Note:",
15+
"contextLimitTipText": "Context is nearing the maximum limit. It is recommended to start a new task window to avoid truncation."
1416
},
1517
"unpin": "Unpin",
1618
"pin": "Pin",

webview-ui/src/i18n/locales/es/chat.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"contextWindow": "Ventana de contexto:",
1111
"closeAndStart": "Cerrar tarea e iniciar una nueva",
1212
"export": "Exportar historial de tareas",
13-
"delete": "Eliminar tarea (Shift + Clic para omitir confirmación)"
13+
"delete": "Eliminar tarea (Shift + Clic para omitir confirmación)",
14+
"contextLimitTipTitle": "Nota:",
15+
"contextLimitTipText": "El contexto está alcanzando el límite máximo. Se recomienda iniciar una nueva ventana de tarea para evitar la truncación."
1416
},
1517
"unpin": "Desfijar",
1618
"pin": "Fijar",

webview-ui/src/i18n/locales/fr/chat.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"contextWindow": "Fenêtre de contexte :",
1111
"closeAndStart": "Fermer la tâche et en commencer une nouvelle",
1212
"export": "Exporter l'historique des tâches",
13-
"delete": "Supprimer la tâche (Shift + Clic pour ignorer la confirmation)"
13+
"delete": "Supprimer la tâche (Shift + Clic pour ignorer la confirmation)",
14+
"contextLimitTipTitle": "Remarque :",
15+
"contextLimitTipText": "Le contexte approche de la limite maximale. Il est recommandé de démarrer une nouvelle fenêtre de tâche pour éviter toute coupure."
1416
},
1517
"unpin": "Désépingler",
1618
"pin": "Épingler",

webview-ui/src/i18n/locales/hi/chat.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"contextWindow": "संदर्भ विंडो:",
1111
"closeAndStart": "कार्य बंद करें और नया शुरू करें",
1212
"export": "कार्य इतिहास निर्यात करें",
13-
"delete": "कार्य हटाएं (पुष्टि को छोड़ने के लिए Shift + क्लिक)"
13+
"delete": "कार्य हटाएं (पुष्टि को छोड़ने के लिए Shift + क्लिक)",
14+
"contextLimitTipTitle": "नोट:",
15+
"contextLimitTipText": "संदर्भ अधिकतम सीमा के करीब है। कटौती से बचने के लिए एक नया कार्य विंडो शुरू करने की सिफारिश की जाती है।"
1416
},
1517
"unpin": "पिन करें",
1618
"pin": "अवपिन करें",

webview-ui/src/i18n/locales/it/chat.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"contextWindow": "Finestra di contesto:",
1111
"closeAndStart": "Chiudi attività e iniziane una nuova",
1212
"export": "Esporta cronologia attività",
13-
"delete": "Elimina attività (Shift + Clic per saltare la conferma)"
13+
"delete": "Elimina attività (Shift + Clic per saltare la conferma)",
14+
"contextLimitTipTitle": "Nota:",
15+
"contextLimitTipText": "Il contesto sta raggiungendo il limite massimo. Si consiglia di avviare una nuova finestra di attività per evitare il troncamento."
1416
},
1517
"unpin": "Rilascia",
1618
"pin": "Fissa",

webview-ui/src/i18n/locales/ja/chat.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"contextWindow": "コンテキストウィンドウ:",
1111
"closeAndStart": "タスクを閉じて新しいタスクを開始",
1212
"export": "タスク履歴をエクスポート",
13-
"delete": "タスクを削除(Shift + クリックで確認をスキップ)"
13+
"delete": "タスクを削除(Shift + クリックで確認をスキップ)",
14+
"contextLimitTipTitle": "注意:",
15+
"contextLimitTipText": "コンテキストが最大制限に近づいています。切り捨てを防ぐために新しいタスクウィンドウを開始することをお勧めします。"
1416
},
1517
"unpin": "ピン留めを解除",
1618
"pin": "ピン留め",

webview-ui/src/i18n/locales/ko/chat.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010
"contextWindow": "컨텍스트 창:",
1111
"closeAndStart": "작업 닫고 새 작업 시작",
1212
"export": "작업 기록 내보내기",
13-
"delete": "작업 삭제 (Shift + 클릭으로 확인 생략)"
13+
"delete": "작업 삭제 (Shift + 클릭으로 확인 생략)",
14+
"contextLimitTipTitle": "참고:",
15+
"contextLimitTipText": "컨텍스트가 최대 한도에 도달하고 있습니다. 잘림을 방지하려면 새 작업 창을 시작하는 것이 좋습니다."
1416
},
1517
"unpin": "고정 해제하기",
1618
"pin": "고정하기",

0 commit comments

Comments
 (0)