这是indexloc提供的服务,不要输入任何密码
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
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { memo } from "react";
import { Warning } from "@phosphor-icons/react";
import { Info, Warning } from "@phosphor-icons/react";
import UserIcon from "../../../../UserIcon";
import Actions from "./Actions";
import renderMarkdown from "@/utils/chat/markdown";
Expand All @@ -16,6 +16,10 @@ import {
THOUGHT_REGEX_OPEN,
ThoughtChainComponent,
} from "../ThoughtContainer";
import paths from "@/utils/paths";
import { useTranslation } from "react-i18next";
import { Link } from "react-router-dom";
import { chatQueryRefusalResponse } from "@/utils/chat";

const HistoricalMessage = ({
uuid = v4(),
Expand All @@ -34,6 +38,7 @@ const HistoricalMessage = ({
metrics = {},
alignmentCls = "",
}) => {
const { t } = useTranslation();
const { isEditing } = useEditMessage({ chatId, role });
const { isDeleted, completeDelete, onEndAnimation } = useWatchDeleteMessage({
chatId,
Expand All @@ -45,6 +50,9 @@ const HistoricalMessage = ({
element.style.height = element.scrollHeight + "px";
};

const isRefusalMessage =
role === "assistant" && message === chatQueryRefusalResponse(workspace);

if (!!error) {
return (
<div
Expand Down Expand Up @@ -109,6 +117,22 @@ const HistoricalMessage = ({
message={message}
expanded={isLastMessage}
/>
{isRefusalMessage && (
<Link
data-tooltip-id="query-refusal-info"
data-tooltip-content={`${t("chat.refusal.tooltip-description")}`}
className="!no-underline group !flex w-fit"
to={paths.chatModes()}
target="_blank"
>
<div className="flex flex-row items-center gap-x-1 group-hover:opacity-100 opacity-60 w-fit">
<Info className="text-theme-text-secondary" />
<p className="!m-0 !p-0 text-theme-text-secondary !no-underline text-xs cursor-pointer">
{t("chat.refusal.tooltip-title")}
</p>
</div>
</Link>
)}
<ChatAttachments attachments={attachments} />
</div>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ export function ChatTooltips() {
delayShow={500}
className="tooltip !text-xs"
/>
<Tooltip
id="query-refusal-info"
place="top"
delayShow={500}
className="tooltip !text-xs max-w-[350px]"
/>
<DocumentLevelTooltip />
</>
);
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/ar/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ const TRANSLATIONS = {
query: "استعلام",
"desc-end":
"وضعٍية ترغب في إرجاع رفض آخر مناسب عندما لا يتم العثور على السياق.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "حرارة نموذج التعلم العميق",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/da/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,8 @@ const TRANSLATIONS = {
query: "forespørgsels-tilstand",
"desc-end":
"tilstand, kan du vælge at returnere et brugerdefineret afvisningssvar, når der ikke findes nogen kontekst.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM-temperatur",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/de/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,8 @@ const TRANSLATIONS = {
query: "Abfrage",
"desc-end":
"modus, möchten Sie vielleicht eine benutzerdefinierte Ablehnungsantwort zurückgeben, wenn kein Kontext gefunden wird.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM-Temperatur",
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/locales/en/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,9 @@ const TRANSLATIONS = {
query: "query",
"desc-end":
"mode, you may want to return a custom refusal response when no context is found.",
"tooltip-title": "Why am I seeing this?",
"tooltip-description":
"You are in query mode, which only uses information from your documents. Switch to chat mode for more flexible conversations, or click here to visit our documentation to learn more about chat modes.",
},
temperature: {
title: "LLM Temperature",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/es/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,8 @@ const TRANSLATIONS = {
query: "consulta",
"desc-end":
"modo, es posible que desees devolver una respuesta de rechazo personalizada cuando no se encuentre contexto.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "Temperatura de LLM",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/et/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,6 +327,8 @@ const TRANSLATIONS = {
query: "päringu",
"desc-end":
"režiimis, võib määrata kohandatud vastuse, kui konteksti ei leita.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM-i temperatuur",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/fa/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,8 @@ const TRANSLATIONS = {
query: "پرس‌وجو",
"desc-end":
"ممکن است بخواهید هنگامی که هیچ محتوایی یافت نمی‌شود، یک پاسخ رد سفارشی برگردانید.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "دمای LLM",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/fr/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ const TRANSLATIONS = {
query: "requête",
"desc-end":
", vous pouvez souhaiter retourner une réponse de refus personnalisée lorsque aucun contexte n'est trouvé.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "Température LLM",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/he/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ const TRANSLATIONS = {
query: "שאילתה",
"desc-end":
"אתה עשוי לרצות להחזיר תגובת סירוב מותאמת אישית כאשר לא נמצא הקשר.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "טמפרטורה של LLM",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/it/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@ const TRANSLATIONS = {
query: "query",
"desc-end":
"è attiva, potresti voler restituire una risposta di rifiuto personalizzata quando non viene trovato alcun contesto.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "Temperatura LLM",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/ja/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,8 @@ const TRANSLATIONS = {
query: "クエリ",
"desc-end":
"の場合、コンテキストが見つからないときにカスタム拒否応答を返すことができます。",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM温度",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/ko/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,8 @@ const TRANSLATIONS = {
"desc-start": "쿼리 모드에서",
query: "응답에 사용할 수 있는",
"desc-end": "컨텍스트를 찾을 수 없을 때 거부 응답 내용을 작성합니다.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM 온도",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/lv/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,8 @@ const TRANSLATIONS = {
query: "vaicājuma",
"desc-end":
"režīmā, jūs varētu vēlēties atgriezt pielāgotu atteikuma atbildi, kad konteksts nav atrasts.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM Temperatūra",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/nl/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ const TRANSLATIONS = {
query: "query",
"desc-end":
"modus, wil je wellicht een aangepaste afwijzingsreactie geven wanneer er geen context wordt gevonden.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM Temperatuur",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/pt_BR/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,8 @@ const TRANSLATIONS = {
query: "consulta",
"desc-end":
"modo, você pode definir uma resposta personalizada quando nenhum contexto for encontrado.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "Temperatura do LLM",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/ru/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -251,6 +251,8 @@ const TRANSLATIONS = {
query: "запроса",
"desc-end":
"вы можете вернуть пользовательский ответ об отказе, если контекст не найден.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "Температура LLM",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/tr/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,8 @@ const TRANSLATIONS = {
query: "sorgu",
"desc-end":
"modunda bağlam bulunamazsa, özel bir ret yanıtı döndürmek isteyebilirsiniz.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM Sıcaklığı",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/vn/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,8 @@ const TRANSLATIONS = {
query: "query",
"desc-end":
"mode, you may want to return a custom refusal response when no context is found.",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM Temperature",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/zh/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,8 @@ const TRANSLATIONS = {
"desc-start": "当处于",
query: "查询",
"desc-end": "模式时,当未找到上下文时,你可能希望返回自定义拒绝响应。",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM 温度",
Expand Down
2 changes: 2 additions & 0 deletions frontend/src/locales/zh_TW/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,8 @@ const TRANSLATIONS = {
"desc-start": "在",
query: "查詢",
"desc-end": "模式下,當找不到內容時,您可能需要傳回自訂的拒絕回應。",
"tooltip-title": null,
"tooltip-description": null,
},
temperature: {
title: "LLM 溫度值",
Expand Down
3 changes: 3 additions & 0 deletions frontend/src/utils/paths.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,9 @@ export default {
docs: () => {
return "https://docs.anythingllm.com";
},
chatModes: () => {
return "https://docs.anythingllm.com/features/chat-modes";
},
mailToMintplex: () => {
return "mailto:team@mintplexlabs.com";
},
Expand Down