diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 9910414..692fac9 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -22,6 +22,7 @@ const Main = lazy(() => import("@/pages/Main")); const InvitePage = lazy(() => import("@/pages/Invite")); const WorkspaceChat = lazy(() => import("@/pages/WorkspaceChat")); const AdminUsers = lazy(() => import("@/pages/Admin/Users")); +const AdminSection = lazy(() => import("@/pages/Admin/Section")); const AdminInvites = lazy(() => import("@/pages/Admin/Invitations")); const AdminWorkspaces = lazy(() => import("@/pages/Admin/Workspaces")); const AdminLogs = lazy(() => import("@/pages/Admin/Logging")); @@ -213,6 +214,10 @@ export default function App() { path="/settings/users" element={} /> + } + /> } diff --git a/frontend/src/components/DefaultChat/index.jsx b/frontend/src/components/DefaultChat/index.jsx index 4340ada..591e6e7 100644 --- a/frontend/src/components/DefaultChat/index.jsx +++ b/frontend/src/components/DefaultChat/index.jsx @@ -45,7 +45,8 @@ export default function DefaultChatContainer() { - {t("welcomeMessage.part1")} + {/* {t("welcomeMessage.part1")} */} + {'欢迎使用琛海AI,可以将任何东西转换为你可以查询和聊天的训练有素的聊天机器人'} , @@ -54,30 +55,31 @@ export default function DefaultChatContainer() { - {t("welcomeMessage.part2")} + {/* {t("welcomeMessage.part2")} */} + {'琛海AI是将强大的 AI 产品,无需繁琐操作的最简单方法,可以将你的生产力提高 100 倍。'} , - - - - -
- {t("welcomeMessage.part3")} - - -

{t("welcomeMessage.githubIssue")}

-
-
-
-
-
, + // + // + // + // + //
+ // {t("welcomeMessage.part3")} + // + // + //

{t("welcomeMessage.githubIssue")}

+ //
+ //
+ //
+ //
+ //
, @@ -93,7 +95,8 @@ export default function DefaultChatContainer() {
- {t("welcomeMessage.part4")} + {/* {t("welcomeMessage.part4")} */} + {'很简单。所有集合都组织成我们称之为“工作区”的桶。工作区是文件、文档、图像、PDF 和其他文件的存储桶,这些文件将被琛海AI转换为可以理解和在对话中使用的内容。 你可以随时添加和删除文件。'} {(!user || user?.role !== "default") && (
@@ -203,7 +206,7 @@ export default function DefaultChatContainer() { return (
diff --git a/frontend/src/components/Modals/ManageWorkspace/Documents/Directory/FileRow/index.jsx b/frontend/src/components/Modals/ManageWorkspace/Documents/Directory/FileRow/index.jsx index 9dccbb2..4940e5b 100644 --- a/frontend/src/components/Modals/ManageWorkspace/Documents/Directory/FileRow/index.jsx +++ b/frontend/src/components/Modals/ManageWorkspace/Documents/Directory/FileRow/index.jsx @@ -44,7 +44,7 @@ export default function FileRow({ item, selected, toggleSelection }) {
{item?.cached && (
-

Cached

+

缓存

)}
diff --git a/frontend/src/components/Modals/ManageWorkspace/Documents/Directory/index.jsx b/frontend/src/components/Modals/ManageWorkspace/Documents/Directory/index.jsx index d29e893..cb25903 100644 --- a/frontend/src/components/Modals/ManageWorkspace/Documents/Directory/index.jsx +++ b/frontend/src/components/Modals/ManageWorkspace/Documents/Directory/index.jsx @@ -194,13 +194,13 @@ function Directory({
-

My Documents

+

我的文档

- New Folder + 新文件夹
-
-
+
+

Name

@@ -272,7 +272,7 @@ function Directory({ onMouseLeave={() => setHighlightWorkspace(false)} className="border-none text-sm font-semibold bg-white light:bg-[#E0F2FE] h-[30px] px-2.5 rounded-lg hover:bg-neutral-800/80 hover:text-white light:text-[#026AA2] light:hover:bg-[#026AA2] light:hover:text-white" > - Move to Workspace + 移动到工作区
- These files will be uploaded to the document processor running on this - AnythingLLM instance. These files are not sent or shared with a third - party. + 这些文件将被上传到运行于此的文档处理器上 + AnythingLLM实例。这些文件不会发送或与第三方共享
); diff --git a/frontend/src/components/Modals/ManageWorkspace/Documents/WorkspaceDirectory/WorkspaceFileRow/index.jsx b/frontend/src/components/Modals/ManageWorkspace/Documents/WorkspaceDirectory/WorkspaceFileRow/index.jsx index f31a6e9..c482529 100644 --- a/frontend/src/components/Modals/ManageWorkspace/Documents/WorkspaceDirectory/WorkspaceFileRow/index.jsx +++ b/frontend/src/components/Modals/ManageWorkspace/Documents/WorkspaceDirectory/WorkspaceFileRow/index.jsx @@ -28,7 +28,7 @@ export default function WorkspaceFileRow({ setLoading(true); try { - setLoadingMessage(`Removing file from workspace`); + setLoadingMessage(`从工作区中删除文件中`); await Workspace.modifyEmbeddings(workspace.slug, { adds: [], deletes: [`${folderName}/${item.name}`], @@ -60,7 +60,7 @@ export default function WorkspaceFileRow({ !disableSelection ? "hover:bg-theme-file-picker-hover cursor-pointer" : "" - } ${isMovedItem ? "bg-green-800/40" : "file-row"} ${ + } ${isMovedItem ? "" : "file-row"} ${ selected ? "selected light:text-white" : "" }`} onClick={toggleRowSelection} @@ -251,7 +251,7 @@ const RemoveItemFromWorkspace = ({ item, onClick }) => {
diff --git a/frontend/src/components/Modals/ManageWorkspace/Documents/WorkspaceDirectory/index.jsx b/frontend/src/components/Modals/ManageWorkspace/Documents/WorkspaceDirectory/index.jsx index 18a73de..6662181 100644 --- a/frontend/src/components/Modals/ManageWorkspace/Documents/WorkspaceDirectory/index.jsx +++ b/frontend/src/components/Modals/ManageWorkspace/Documents/WorkspaceDirectory/index.jsx @@ -126,8 +126,8 @@ function WorkspaceDirectory({ highlightWorkspace ? "border-4 border-cyan-300/80 z-[999]" : "" }`} /> -
-
+
+
{!hasChanges && files.items.some((folder) => folder.items.length > 0) ? ( @@ -182,7 +182,7 @@ function WorkspaceDirectory({ ) : (

- No Documents + 暂无文件

)} @@ -201,14 +201,14 @@ function WorkspaceDirectory({ (sum, folder) => sum + folder.items.length, 0 ) - ? "Deselect All" - : "Select All"} + ? "取消选择所有" + : "选择所有"}
@@ -237,7 +237,7 @@ function WorkspaceDirectory({ onClick={(e) => handleSaveChanges(e)} className="border border-slate-200 px-5 py-2.5 rounded-lg text-white text-sm items-center flex gap-x-2 hover:bg-slate-200 hover:text-slate-800 focus:ring-gray-800" > - Save and Embed + 保存和嵌入
)} diff --git a/frontend/src/components/Modals/ManageWorkspace/Documents/index.jsx b/frontend/src/components/Modals/ManageWorkspace/Documents/index.jsx index 98244d5..b857aa1 100644 --- a/frontend/src/components/Modals/ManageWorkspace/Documents/index.jsx +++ b/frontend/src/components/Modals/ManageWorkspace/Documents/index.jsx @@ -87,7 +87,7 @@ export default function DocumentSettings({ workspace, systemSettings }) { e.preventDefault(); setLoading(true); showToast("Updating workspace...", "info", { autoClose: false }); - setLoadingMessage("This may take a while for large documents"); + setLoadingMessage("对于大型文档,这可能需要一段时间"); const changesToSend = { adds: movedItems.map((item) => `${item.folderName}/${item.name}`), @@ -102,12 +102,12 @@ export default function DocumentSettings({ workspace, systemSettings }) { showToast(`Error: ${res.message}`, "error", { clear: true }); return; } - showToast("Workspace updated successfully.", "success", { + showToast("更新成功.", "success", { clear: true, }); }) .catch((error) => { - showToast(`Workspace update failed: ${error}`, "error", { + showToast(`更新失败: ${error}`, "error", { clear: true, }); }); diff --git a/frontend/src/components/Modals/ManageWorkspace/index.jsx b/frontend/src/components/Modals/ManageWorkspace/index.jsx index 33c9fa8..84666f5 100644 --- a/frontend/src/components/Modals/ManageWorkspace/index.jsx +++ b/frontend/src/components/Modals/ManageWorkspace/index.jsx @@ -125,7 +125,7 @@ const ModalTabSwitcher = ({ selectedTab, setSelectedTab }) => { : "text-white/20 font-medium hover:text-white light:bg-white light:text-[#535862] light:hover:bg-[#E0F2FE]" }`} > - Documents + 文档
diff --git a/frontend/src/components/Modals/NewWorkspace.jsx b/frontend/src/components/Modals/NewWorkspace.jsx index 5eed377..da34581 100644 --- a/frontend/src/components/Modals/NewWorkspace.jsx +++ b/frontend/src/components/Modals/NewWorkspace.jsx @@ -74,7 +74,7 @@ export default function NewWorkspaceModal({ hideModal = noop }) { type="submit" className="transition-all duration-300 bg-white text-black hover:opacity-60 px-4 py-2 rounded-lg text-sm" > - Save + 保存
diff --git a/frontend/src/components/Modals/Password/MultiUserAuth.jsx b/frontend/src/components/Modals/Password/MultiUserAuth.jsx index 9b74df3..6d31bf4 100644 --- a/frontend/src/components/Modals/Password/MultiUserAuth.jsx +++ b/frontend/src/components/Modals/Password/MultiUserAuth.jsx @@ -292,10 +292,10 @@ export default function MultiUserAuth() { {"琛海科技AI管理平台"}

-

+ {/*

{t("login.sign-in.start")} {customAppName || "AnythingLLM"}{" "} {t("login.sign-in.end")} -

+

*/}
diff --git a/frontend/src/components/SettingsSidebar/index.jsx b/frontend/src/components/SettingsSidebar/index.jsx index a20c2fe..a55a9a6 100644 --- a/frontend/src/components/SettingsSidebar/index.jsx +++ b/frontend/src/components/SettingsSidebar/index.jsx @@ -1,6 +1,7 @@ import React, { useEffect, useRef, useState } from "react"; import paths from "@/utils/paths"; import useLogo from "@/hooks/useLogo"; +import imglog from "../../../../images/chimg.png" import { House, List, @@ -140,11 +141,12 @@ export default function SettingsSidebar() { className="flex shrink-0 max-w-[55%] items-center justify-start mx-[38px] my-[18px]" > Logo +
琛海科技
( href: paths.settings.users(), roles: ["admin", "manager"], }, + { + btnText: t("settings.section"), + href: paths.settings.section(), + roles: ["admin", "manager"], + }, { btnText: t("settings.workspaces"), href: paths.settings.workspaces(), diff --git a/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/ThreadItem/index.jsx b/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/ThreadItem/index.jsx index 4c12b05..61b802f 100644 --- a/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/ThreadItem/index.jsx +++ b/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/ThreadItem/index.jsx @@ -196,7 +196,7 @@ function OptionsMenu({ const renameThread = async () => { const name = window - .prompt("What would you like to rename this thread to?") + .prompt("您想将此线程重命名为什么?") ?.trim(); if (!name || name.length === 0) { close(); @@ -223,7 +223,7 @@ function OptionsMenu({ const handleDelete = async () => { if ( !window.confirm( - "Are you sure you want to delete this thread? All of its chats will be deleted. You cannot undo this." + "您确定要删除此线程吗?所有的聊天记录都将被删除。这是无法挽回的。" ) ) return; @@ -254,7 +254,7 @@ function OptionsMenu({ className="w-full rounded-md flex items-center p-2 gap-x-2 hover:bg-slate-500/20 text-slate-300 light:text-theme-text-primary" > -

Rename

+

重命名

); diff --git a/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/index.jsx b/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/index.jsx index f9c0ea4..e669525 100644 --- a/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/index.jsx +++ b/frontend/src/components/Sidebar/ActiveWorkspaces/ThreadContainer/index.jsx @@ -195,11 +195,11 @@ function NewThreadButton({ workspace }) { {loading ? (

- Starting Thread... + 启动线程...

) : (

- New Thread + 新线程

)}
diff --git a/frontend/src/components/UserMenu/UserButton/index.jsx b/frontend/src/components/UserMenu/UserButton/index.jsx index af1a04a..15bea88 100644 --- a/frontend/src/components/UserMenu/UserButton/index.jsx +++ b/frontend/src/components/UserMenu/UserButton/index.jsx @@ -67,23 +67,23 @@ export default function UserButton() { {showMenu && (
-
+
{mode === "multi" && !!user && ( )} - Support - + */}
diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx index c78a8f2..e939dae 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/ChatHistory/index.jsx @@ -179,18 +179,18 @@ export default function ChatHistory({

- Welcome to your new workspace. + 欢迎来到你的新工作空间。

{!user || user.role !== "default" ? (

- To get started either{" "} + 开始吧{" "} - upload a document + 上传文档 - or send a chat. + 或 发送聊天信息.

) : (

diff --git a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx index 40a2d50..3c2fe18 100644 --- a/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx +++ b/frontend/src/components/WorkspaceChat/ChatContainer/PromptInput/index.jsx @@ -284,8 +284,8 @@ export default function PromptInput({ type="submit" className="border-none inline-flex justify-center rounded-2xl cursor-pointer opacity-60 hover:opacity-100 light:opacity-100 light:hover:opacity-60 ml-4" data-tooltip-id="send-prompt" - data-tooltip-content="Send prompt message to workspace" - aria-label="Send prompt message to workspace" + data-tooltip-content="向工作区发送提示消息" + aria-label="向工作区发送提示消息" > + +

+
+
+
+

+ 部门 +

+
+

+ 部门树状结构 +

+
+
+ + Add user + +
+
+ +
+
+ + + +
+
+ ); +} + +function UsersContainer() { + const { user: currUser } = useUser(); + const [loading, setLoading] = useState(true); + const [users, setUsers] = useState([]); + + useEffect(() => { + async function fetchUsers() { + const _users = await Admin.users(); + setUsers(_users); + setLoading(false); + } + fetchUsers(); + }, []); + + if (loading) { + return ( + + ); + } + + return ( + + + + + + + + + + + {users.map((user) => ( + + ))} + +
+ Username + + Role + + Date Added + + {" "} +
+ ); +} + +const ROLE_HINT = { + default: [ + "Can only send chats with workspaces they are added to by admin or managers.", + "Cannot modify any settings at all.", + ], + manager: [ + "Can view, create, and delete any workspaces and modify workspace-specific settings.", + "Can create, update and invite new users to the instance.", + "Cannot modify LLM, vectorDB, embedding, or other connections.", + ], + admin: [ + "Highest user level privilege.", + "Can see and do everything across the system.", + ], +}; + +export function RoleHintDisplay({ role }) { + return ( +
+

Permissions

+
    + {ROLE_HINT[role ?? "default"].map((hints, i) => { + return ( +
  • + {hints} +
  • + ); + })} +
+
+ ); +} + +export function MessageLimitInput({ enabled, limit, updateState, role }) { + if (role === "admin") return null; + return ( +
+
+
+

+ Limit messages per day +

+ +
+

+ Restrict this user to a number of successful queries or chats within a + 24 hour window. +

+
+ {enabled && ( +
+ +
+ e.target.blur()} + onChange={(e) => { + updateState({ + enabled: true, + limit: Number(e?.target?.value || 0), + }); + }} + value={limit} + min={1} + className="border-none bg-theme-settings-input-bg text-white placeholder:text-theme-settings-input-placeholder text-sm rounded-lg focus:outline-primary-button active:outline-primary-button outline-none block w-full p-2.5" + /> +
+
+ )} +
+ ); +} diff --git a/frontend/src/pages/Admin/Users/index.jsx b/frontend/src/pages/Admin/Users/index.jsx index e2d29c0..ab7922c 100644 --- a/frontend/src/pages/Admin/Users/index.jsx +++ b/frontend/src/pages/Admin/Users/index.jsx @@ -30,9 +30,8 @@ export default function AdminUsers() {

- These are all the accounts which have an account on this instance. - Removing an account will instantly remove their access to this - instance. + 这些是在此实例上拥有帐户的所有帐户。 + 删除一个帐户将立即删除他们的访问权限.

@@ -40,7 +39,7 @@ export default function AdminUsers() { onClick={openModal} className="mt-3 mr-0 mb-4 md:-mb-6 z-10" > - Add user + 添加用户
@@ -88,13 +87,13 @@ function UsersContainer() { - Username + 用户名 - Role + 角色 - Date Added + 添加日期 {" "} diff --git a/frontend/src/utils/paths.js b/frontend/src/utils/paths.js index 129f940..225105c 100644 --- a/frontend/src/utils/paths.js +++ b/frontend/src/utils/paths.js @@ -80,6 +80,9 @@ export default { users: () => { return `/settings/users`; }, + section: () => { + return `/settings/section`; + }, invites: () => { return `/settings/invites`; },