这是indexloc提供的服务,不要输入任何密码
Skip to content
Open
15 changes: 4 additions & 11 deletions .github/workflows/build-and-push-image-semver.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ concurrency:
group: build-${{ github.ref }}
cancel-in-progress: true

# on:
# release:
# types: [published]

on:
push:
branches: ['master']
release:
types: [published]

jobs:
push_multi_platform_to_registries:
Expand Down Expand Up @@ -67,11 +63,8 @@ jobs:
${{ steps.dockerhub.outputs.enabled == 'true' && 'mintplexlabs/anythingllm' || '' }}
ghcr.io/${{ github.repository }}
tags: |
type=semver,pattern=1.8.2
type=semver,pattern=1.8
# tags: |
# type=semver,pattern={{version}}
# type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}

- name: Build and push multi-platform Docker image
uses: docker/build-push-action@v6
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@ import { useSearchParams } from "react-router-dom";
import { useTranslation } from "react-i18next";

export const CMD_REGEX = new RegExp(/[^a-zA-Z0-9_-]/g);
export default function SlashPresets({ setShowing, sendCommand, promptRef }) {
export default function SlashPresets({
setShowing,
sendCommand,
promptRef,
workspace,
}) {
const { t } = useTranslation();
const isActiveAgentSession = useIsAgentSessionActive();
const {
Expand All @@ -27,6 +32,11 @@ export default function SlashPresets({ setShowing, sendCommand, promptRef }) {
const [selectedPreset, setSelectedPreset] = useState(null);
const [searchParams] = useSearchParams();

const fetchPresets = async () => {
const presets = await System.getSlashCommandPresets();
setPresets(presets);
};

useEffect(() => {
fetchPresets();
}, []);
Expand All @@ -44,12 +54,8 @@ export default function SlashPresets({ setShowing, sendCommand, promptRef }) {
openAddModal();
}, []);

if (isActiveAgentSession) return null;

const fetchPresets = async () => {
const presets = await System.getSlashCommandPresets();
setPresets(presets);
};
// Hide presets if there's an active agent session OR workspace is in agent mode
if (isActiveAgentSession || workspace?.chatMode === "agent") return null;

const handleSavePreset = async (preset) => {
const { error } = await System.createSlashCommandPreset(preset);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { useIsAgentSessionActive } from "@/utils/chat/agent";

export default function EndAgentSession({ setShowing, sendCommand }) {
export default function EndAgentSession({
setShowing,
sendCommand,
workspace,
}) {
const isActiveAgentSession = useIsAgentSessionActive();
if (!isActiveAgentSession) return null;

// Only show exit command if there's an active agent session AND workspace is NOT in agent mode
// If workspace is in agent mode, we don't want users to exit the agent
if (!isActiveAgentSession || workspace?.chatMode === "agent") return null;

return (
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,13 @@ export default function SlashCommandsButton({ showing, setShowSlashCommand }) {
);
}

export function SlashCommands({ showing, setShowing, sendCommand, promptRef }) {
export function SlashCommands({
showing,
setShowing,
sendCommand,
promptRef,
workspace,
}) {
const cmdRef = useRef(null);
useEffect(() => {
function listenForOutsideClick() {
Expand All @@ -56,12 +62,21 @@ export function SlashCommands({ showing, setShowing, sendCommand, promptRef }) {
ref={cmdRef}
className="w-[600px] bg-theme-action-menu-bg rounded-2xl flex shadow flex-col justify-start items-start gap-2.5 p-2 overflow-y-auto max-h-[300px] no-scroll"
>
<ResetCommand sendCommand={sendCommand} setShowing={setShowing} />
<EndAgentSession sendCommand={sendCommand} setShowing={setShowing} />
<ResetCommand
sendCommand={sendCommand}
setShowing={setShowing}
workspace={workspace}
/>
<EndAgentSession
sendCommand={sendCommand}
setShowing={setShowing}
workspace={workspace}
/>
<SlashPresets
sendCommand={sendCommand}
setShowing={setShowing}
promptRef={promptRef}
workspace={workspace}
/>
</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import { useIsAgentSessionActive } from "@/utils/chat/agent";
import { useTranslation } from "react-i18next";

export default function ResetCommand({ setShowing, sendCommand }) {
export default function ResetCommand({ setShowing, sendCommand, workspace }) {
const { t } = useTranslation();
const isActiveAgentSession = useIsAgentSessionActive();
if (isActiveAgentSession) return null; // cannot reset during active agent chat

// Hide reset command only if there's an active agent session AND the workspace is NOT in agent mode
// If workspace is in agent mode, reset should always be available (except during active sessions, but then the logic is different)
if (isActiveAgentSession && workspace?.chatMode !== "agent") return null;

return (
<button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export default function PromptInput({
isStreaming,
sendCommand,
attachments = [],
workspace,
}) {
const { t } = useTranslation();
const { isDisabled } = useIsDisabled();
Expand Down Expand Up @@ -244,6 +245,7 @@ export default function PromptInput({
showing={showSlashCommand}
setShowing={setShowSlashCommand}
sendCommand={sendCommand}
workspace={workspace}
promptRef={textareaRef}
/>
<AvailableAgents
Expand Down
41 changes: 25 additions & 16 deletions frontend/src/components/WorkspaceChat/ChatContainer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
const handleSubmit = async (event) => {
event.preventDefault();
if (!message || message === "") return false;

const prevChatHistory = [
...chatHistory,
{
Expand Down Expand Up @@ -183,6 +184,7 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
workspaceSlug: workspace.slug,
threadSlug,
prompt: promptMessage.userMessage,
mode: workspace.chatMode || "chat",
chatHandler: (chatResult) =>
handleChat(
chatResult,
Expand All @@ -209,7 +211,10 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
);

window.addEventListener(ABORT_STREAM_EVENT, () => {
window.dispatchEvent(new CustomEvent(AGENT_SESSION_END));
// Only end agent session if we're not in agent chat mode
if (workspace?.chatMode !== "agent") {
window.dispatchEvent(new CustomEvent(AGENT_SESSION_END));
}
websocket.close();
});

Expand All @@ -226,21 +231,24 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
});

socket.addEventListener("close", (_event) => {
window.dispatchEvent(new CustomEvent(AGENT_SESSION_END));
setChatHistory((prev) => [
...prev.filter((msg) => !!msg.content),
{
uuid: v4(),
type: "statusResponse",
content: "Agent session complete.",
role: "assistant",
sources: [],
closed: true,
error: null,
animate: false,
pending: false,
},
]);
// Don't end agent session if we're in agent chat mode
if (workspace?.chatMode !== "agent") {
window.dispatchEvent(new CustomEvent(AGENT_SESSION_END));
setChatHistory((prev) => [
...prev.filter((msg) => !!msg.content),
{
uuid: v4(),
type: "statusResponse",
content: "Agent session complete.",
role: "assistant",
sources: [],
closed: true,
error: null,
animate: false,
pending: false,
},
]);
}
setLoadingResponse(false);
setWebsocket(null);
setSocketId(null);
Expand Down Expand Up @@ -294,6 +302,7 @@ export default function ChatContainer({ workspace, knownHistory = [] }) {
isStreaming={loadingResponse}
sendCommand={sendCommand}
attachments={files}
workspace={workspace}
/>
</DnDFileUploaderWrapper>
<ChatTooltips />
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/ar/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,11 @@ const TRANSLATIONS = {
only: "فقط",
"desc-end": "إذا وجد المستند في السياق",
},
agent: {
title: "Agent",
agent_mode: "Agent Mode",
desc: "Automatically uses the agent for all messages without requiring @agent prefix.",
},
},
history: {
title: "سجل المحادثة",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/da/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ const TRANSLATIONS = {
only: "kun",
"desc-end": "hvis dokumentkontekst findes.",
},
agent: {
title: "Agent",
agent_mode: "Agent-tilstand",
desc: "Bruger altid direkte agenten.",
},
},
history: {
title: "Chat-historik",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/de/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ const TRANSLATIONS = {
only: "nur",
"desc-end": "liefern, wenn Dokumentenkontext gefunden wird.",
},
agent: {
title: "Agent",
agent_mode: "Agenten Modus",
desc: "Nutzt immer direkt den Agenten.",
},
},
history: {
title: "Chat-Verlauf",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/en/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -316,6 +316,11 @@ const TRANSLATIONS = {
only: "only",
"desc-end": "if document context is found.",
},
agent: {
title: "Agent",
agent_mode: "Agent Mode",
desc: "Automatically uses the agent for all messages without requiring @agent prefix.",
},
},
history: {
title: "Chat History",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/es/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@ const TRANSLATIONS = {
only: "solo",
"desc-end": "si se encuentra el contexto del documento.",
},
agent: {
title: "Agent",
agent_mode: "Agent Mode",
desc: "Automatically uses the agent for all messages without requiring @agent prefix.",
},
},
history: {
title: "Historial de chat",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/fa/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,11 @@ const TRANSLATIONS = {
only: "فقط",
"desc-end": "در صورت یافتن محتوای اسناد ارائه می‌دهد.",
},
agent: {
title: "Agent",
agent_mode: "Agent Mode",
desc: "Automatically uses the agent for all messages without requiring @agent prefix.",
},
},
history: {
title: "تاریخچه گفتگو",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/fr/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,11 @@ const TRANSLATIONS = {
only: "uniquement",
"desc-end": "si un contexte de document est trouvé.",
},
agent: {
title: "Agent",
agent_mode: "Agent Mode",
desc: "Automatically uses the agent for all messages without requiring @agent prefix.",
},
},
history: {
title: "Historique des chats",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/he/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ const TRANSLATIONS = {
only: "רק",
"desc-end": "אם נמצא הקשר של מסמך.",
},
agent: {
title: "Agent",
agent_mode: "Agent Mode",
desc: "Automatically uses the agent for all messages without requiring @agent prefix.",
},
},
history: {
title: "היסטוריית צ'אט",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/it/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,11 @@ const TRANSLATIONS = {
only: "solo",
"desc-end": "se sarà presente un contesto documentale",
},
agent: {
title: "Agent",
agent_mode: "Agent Mode",
desc: "Automatically uses the agent for all messages without requiring @agent prefix.",
},
},
history: {
title: "Chat History",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/ja/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,11 @@ const TRANSLATIONS = {
only: "のみ",
"desc-end": "ドキュメントコンテキストが見つかった場合のみ。",
},
agent: {
title: "Agent",
agent_mode: "エージェントモード",
desc: "常にエージェントを直接使用します。",
},
},
history: {
title: "チャット履歴",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/ko/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ const TRANSLATIONS = {
only: "때만",
"desc-end": "답변을 제공합니다.",
},
agent: {
title: "Agent",
agent_mode: "Agent Mode",
desc: "Automatically uses the agent for all messages without requiring @agent prefix.",
},
},
history: {
title: "채팅 기록",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/lv/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,11 @@ const TRANSLATIONS = {
only: "tikai",
"desc-end": "ja tiek atrasts dokumentu konteksts.",
},
agent: {
title: "Agent",
agent_mode: "Agent režīms",
desc: "Vienmēr izmanto direktu agentu.",
},
},
history: {
title: "Sarunu vēsture",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/locales/nl/common.js
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,11 @@ const TRANSLATIONS = {
only: "alleen",
"desc-end": "als documentcontext wordt gevonden.",
},
agent: {
title: "Agent",
agent_mode: "Agent Mode",
desc: "Automatically uses the agent for all messages without requiring @agent prefix.",
},
},
history: {
title: "Chatgeschiedenis",
Expand Down
Loading