diff --git a/app/src/admin/api/info.ts b/app/src/admin/api/info.ts index 8b4b204..30b9e63 100644 --- a/app/src/admin/api/info.ts +++ b/app/src/admin/api/info.ts @@ -18,6 +18,8 @@ export type SiteInfo = { buy_link: string; mail: boolean; contact: string; + footer: string; + auth_footer: boolean; article: string[]; generation: string[]; }; @@ -36,6 +38,8 @@ export async function getSiteInfo(): Promise { announcement: "", buy_link: "", contact: "", + footer: "", + auth_footer: false, mail: false, article: [], generation: [], diff --git a/app/src/admin/api/system.ts b/app/src/admin/api/system.ts index 3afaaab..5d9a42d 100644 --- a/app/src/admin/api/system.ts +++ b/app/src/admin/api/system.ts @@ -35,6 +35,8 @@ export type SiteState = { buy_link: string; announcement: string; contact: string; + footer: string; + auth_footer: boolean; }; export type CommonState = { @@ -119,6 +121,8 @@ export const initialSystemState: SystemProps = { buy_link: "", announcement: "", contact: "", + footer: "", + auth_footer: false, }, mail: { host: "", diff --git a/app/src/components/home/ChatSpace.tsx b/app/src/components/home/ChatSpace.tsx index ba9d60e..8f22f96 100644 --- a/app/src/components/home/ChatSpace.tsx +++ b/app/src/components/home/ChatSpace.tsx @@ -11,25 +11,36 @@ import { DialogHeader, DialogTitle, } from "@/components/ui/dialog.tsx"; -import { getLanguage } from "@/i18n.ts"; import { selectAuthenticated } from "@/store/auth.ts"; import { appLogo } from "@/conf/env.ts"; import { infoArticleSelector, + infoAuthFooterSelector, infoContactSelector, + infoFooterSelector, infoGenerationSelector, } from "@/store/info.ts"; import Markdown from "@/components/Markdown.tsx"; import { hitGroup } from "@/utils/groups.ts"; +function Footer() { + const auth = useSelector(selectAuthenticated); + const footer = useSelector(infoFooterSelector); + const auth_footer = useSelector(infoAuthFooterSelector); + + if (auth && auth_footer) { + // hide footer + return null; + } + + return footer.length > 0 && {footer}; +} + function ChatSpace() { const [open, setOpen] = useState(false); const { t } = useTranslation(); const contact = useSelector(infoContactSelector); - const cn = getLanguage() === "cn"; - const auth = useSelector(selectAuthenticated); - const generationGroup = useSelector(infoGenerationSelector); const generation = hitGroup(generationGroup); @@ -84,18 +95,7 @@ function ChatSpace() {
- {cn && !auth && ( -

- 请您遵守 - - 《生成式人工智能服务管理暂行办法》 - - 法规使用 -

- )} +
); diff --git a/app/src/events/info.ts b/app/src/events/info.ts index 731b951..90ab52c 100644 --- a/app/src/events/info.ts +++ b/app/src/events/info.ts @@ -3,6 +3,8 @@ import { EventCommitter } from "@/events/struct.ts"; export type InfoForm = { mail: boolean; contact: string; + footer: string; + auth_footer: boolean; article: string[]; generation: string[]; }; diff --git a/app/src/resources/i18n/cn.json b/app/src/resources/i18n/cn.json index 72cd055..108e6c0 100644 --- a/app/src/resources/i18n/cn.json +++ b/app/src/resources/i18n/cn.json @@ -664,6 +664,9 @@ "announcementPlaceholder": "请输入站点公告 (支持 Markdown / HTML 格式)", "contact": "联系信息", "contactPlaceholder": "请输入联系信息 (支持 Markdown / HTML 格式)", + "footer": "页脚信息", + "footerPlaceholder": "请输入页脚信息 (支持 Markdown / HTML 格式)", + "authFooter": "登录后隐藏页脚", "article": "批量文章生成功能分组", "articleTip": "批量文章生成功能分组,勾选后当前用户组可使用批量文章生成功能", "generate": "AI 项目生成器分组", diff --git a/app/src/routes/admin/System.tsx b/app/src/routes/admin/System.tsx index b116203..e82be77 100644 --- a/app/src/routes/admin/System.tsx +++ b/app/src/routes/admin/System.tsx @@ -522,6 +522,30 @@ function Site({ data, dispatch, onChange }: CompProps) { placeholder={t("admin.system.contactPlaceholder")} /> + + + +