diff --git a/README.md b/README.md index 228bd030..bd5052c7 100644 --- a/README.md +++ b/README.md @@ -45,7 +45,7 @@ mkdir ./AppData && chmod 777 ./AppData && docker run --restart unless-stopped -- docker run --restart unless-stopped --name sdcb-chats -v ./AppData:/app/AppData -p 8080:8080 sdcb/chats:latest ``` -- **数据库初始化**:容器启动后,如果数据库文件不存在,将自动创建并插入初始数据。初始管理员用户名为 `admin`,默认密码为 `please reset your password`。强烈建议您在首次登录后立即前往左下角的用户管理界面,设置一个新密码以确保安全。 +- **数据库初始化**:容器启动后,如果数据库文件不存在,将自动创建并插入初始数据。初始管理员用户名为 `chats`,默认密码为 `RESET!!!`。强烈建议您在首次登录后立即前往左下角的用户管理界面,设置一个新密码以确保安全。 通过以上步骤,您将能顺利使用 Docker 部署和运行应用。如果在部署过程中遇到任何问题,可以联系我们。 diff --git a/README_EN.md b/README_EN.md index 09fb6276..889cb655 100644 --- a/README_EN.md +++ b/README_EN.md @@ -43,7 +43,7 @@ mkdir ./AppData && chmod 777 ./AppData && docker run --restart unless-stopped -- docker run --restart unless-stopped --name sdcb-chats -v ./AppData:/app/AppData -p 8080:8080 sdcb/chats:latest ``` -- **Database initialization**: After the container starts, if the database file does not exist, it will be automatically created and initial data inserted. The initial admin username is `admin`, and the default password is `please reset your password`. It is strongly recommended that you immediately set a new password in the user management interface at the bottom left after logging in for the first time to ensure security. +- **Database initialization**: After the container starts, if the database file does not exist, it will be automatically created and initial data inserted. The initial admin username is `chats`, and the default password is `RESET!!!`. It is strongly recommended that you immediately set a new password in the user management interface at the bottom left after logging in for the first time to ensure security. By following the above steps, you will be able to use Docker to successfully deploy and run the application. If you encounter any problems during deployment, feel free to contact us. diff --git a/src/BE/Controllers/Admin/GlobalConfigs/GlobalConfigController.cs b/src/BE/Controllers/Admin/GlobalConfigs/GlobalConfigController.cs index a2c06d23..453eb99f 100644 --- a/src/BE/Controllers/Admin/GlobalConfigs/GlobalConfigController.cs +++ b/src/BE/Controllers/Admin/GlobalConfigs/GlobalConfigController.cs @@ -52,4 +52,31 @@ public async Task UpdateGlobalConfig([FromBody] GlobalConfigDto re } return NoContent(); } + + [HttpPost] + public async Task CreateGlobalConfig([FromBody] GlobalConfigDto req, CancellationToken cancellationToken) + { + Config? config = await db.Configs.FindAsync([req.Key], cancellationToken); + if (config != null) + { + return this.BadRequestMessage("Key already exists"); + } + // ensure value is valid json + try + { + JsonDocument.Parse(req.Value); + } + catch (JsonException) + { + return this.BadRequestMessage("Invalid JSON"); + } + await db.Configs.AddAsync(new Config() + { + Key = req.Key, + Value = req.Value, + Description = req.Description, + }, cancellationToken); + await db.SaveChangesAsync(cancellationToken); + return NoContent(); + } } diff --git a/src/BE/DB/Init/BasicData.cs b/src/BE/DB/Init/BasicData.cs index 7f9c0d59..4e9fb5fe 100644 --- a/src/BE/DB/Init/BasicData.cs +++ b/src/BE/DB/Init/BasicData.cs @@ -107,10 +107,10 @@ private static void InsertTransactionTypes(ChatsDB db) private static void InsertModelReferences(ChatsDB db) { - // Generated from data, hash: c5fc80eafe0435e9a03ed9df3b46fe5755d391047b0f8460d17228b4a10fd886 + // Generated from data, hash: ebf7fc3a8c4f38d7efc44b0e1b38633c2af4fea6ec8a42ad73d72299dfdbf6d4 db.ModelReferences.AddRange( [ - new(){ Id=0, ProviderId=0, Name="Test", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=2048, TokenizerId=1, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, + new(){ Id=0, ProviderId=0, Name="Test", ShortName=null, IsLegacy=false, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=true, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=2048, MaxResponseTokens=2048, TokenizerId=1, InputTokenPrice1M=0.00000M, OutputTokenPrice1M=0.00000M, CurrencyCode="RMB", }, new(){ Id=100, ProviderId=1, Name="gpt-35-turbo-0301", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, new(){ Id=101, ProviderId=1, Name="gpt-35-turbo-16k-0613", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=16385, MaxResponseTokens=16385, TokenizerId=1, InputTokenPrice1M=3.00000M, OutputTokenPrice1M=4.00000M, CurrencyCode="USD", }, new(){ Id=102, ProviderId=1, Name="gpt-35-turbo-0613", ShortName="gpt-35-turbo", IsLegacy=true, MinTemperature=0.00M, MaxTemperature=2.00M, AllowSearch=false, AllowVision=false, AllowSystemPrompt=true, AllowStreaming=true, ContextWindow=4096, MaxResponseTokens=4096, TokenizerId=1, InputTokenPrice1M=1.50000M, OutputTokenPrice1M=2.00000M, CurrencyCode="USD", }, diff --git a/src/BE/DB/Init/InitService.cs b/src/BE/DB/Init/InitService.cs index ec5dd629..a1c0c892 100644 --- a/src/BE/DB/Init/InitService.cs +++ b/src/BE/DB/Init/InitService.cs @@ -1,6 +1,8 @@ using Chats.BE.DB.Enums; using Chats.BE.Services; +using Chats.BE.Services.Configs; using Chats.BE.Services.Sessions; +using System.Text.Json; namespace Chats.BE.DB.Init; @@ -47,10 +49,10 @@ private static async Task InsertInitialData(IServiceScope scope, ChatsDB db, Can User adminUser = new() { - Account = "admin", - Username = "admin", + Account = "chats", + Username = "chats", CreatedAt = DateTime.UtcNow, - Password = scope.ServiceProvider.GetRequiredService().HashPassword("please reset your password"), + Password = scope.ServiceProvider.GetRequiredService().HashPassword("RESET!!!"), Enabled = true, Role = "admin", UpdatedAt = DateTime.UtcNow, @@ -100,6 +102,15 @@ private static async Task InsertInitialData(IServiceScope scope, ChatsDB db, Can CreatedAt = DateTime.UtcNow, UpdatedAt = DateTime.UtcNow, }); + db.Configs.Add(new() + { + Key = DBConfigKey.SiteInfo, + Value = JsonSerializer.Serialize(new SiteInfo() + { + WebsiteRegistrationNumber = null, + CompanyName = "Customized Text(Company name, etc)", + }) + }); await db.SaveChangesAsync(cancellationToken); } } diff --git a/src/BE/Services/ChatServices/ChatService.cs b/src/BE/Services/ChatServices/ChatService.cs index 83f1acd1..d1997220 100644 --- a/src/BE/Services/ChatServices/ChatService.cs +++ b/src/BE/Services/ChatServices/ChatService.cs @@ -19,18 +19,11 @@ public abstract partial class ChatService : IDisposable public ChatService(Model model) { Model = model; - try + if (model.ModelReference.Tokenizer is not null) { - if (model.ModelReference.Tokenizer is not null) - { - Tokenizer = TiktokenTokenizer.CreateForEncoding(model.ModelReference.Tokenizer.Name); - } - else - { - Tokenizer = TiktokenTokenizer.CreateForModel(Model.ModelReference.Name); - } + Tokenizer = TiktokenTokenizer.CreateForEncoding(model.ModelReference.Tokenizer.Name); } - catch (NotSupportedException) + else { Tokenizer = TiktokenTokenizer.CreateForEncoding("cl100k_base"); } diff --git a/src/BE/Services/Configs/DBConfigKey.cs b/src/BE/Services/Configs/DBConfigKey.cs index 5299e996..22e0b883 100644 --- a/src/BE/Services/Configs/DBConfigKey.cs +++ b/src/BE/Services/Configs/DBConfigKey.cs @@ -4,7 +4,7 @@ public static class DBConfigKey { public const string JwtSecretKey = "JwtSecretKey"; - public const string TencentSms = "TencentSms"; + public const string TencentSms = "tencentSms"; - public const string SiteInfo = "SiteInfo"; + public const string SiteInfo = "siteInfo"; } diff --git a/src/BE/Services/Configs/SiteInfo.cs b/src/BE/Services/Configs/SiteInfo.cs index cb21538d..a7fc9da5 100644 --- a/src/BE/Services/Configs/SiteInfo.cs +++ b/src/BE/Services/Configs/SiteInfo.cs @@ -2,20 +2,11 @@ namespace Chats.BE.Services.Configs; -public record Contact -{ - [JsonPropertyName("qqGroupNumber")] - public required string QQGroupNumber { get; init; } - - [JsonPropertyName("qqGroupQrCodeLink")] - public required string QQGroupQrCodeLink { get; init; } -} - public record SiteInfo { [JsonPropertyName("filingNumber")] - public required string WebsiteRegistrationNumber { get; init; } + public string? WebsiteRegistrationNumber { get; init; } - [JsonPropertyName("contact")] - public required Contact Contact { get; init; } + [JsonPropertyName("companyName")] + public string? CompanyName { get; init; } } \ No newline at end of file diff --git a/src/FE/apis/clientApis.ts b/src/FE/apis/clientApis.ts index f2d807c9..ff2c047d 100644 --- a/src/FE/apis/clientApis.ts +++ b/src/FE/apis/clientApis.ts @@ -33,11 +33,9 @@ export const changeUserPassword = (params: PostUserPassword) => { export const getUserMessages = (chatId: string): Promise => { const fetchService = useFetch(); - return fetchService - .get(`/api/messages/${chatId}`) - .then((data: any) => { - return calculateMessages(data) as any; - }); + return fetchService.get(`/api/messages/${chatId}`).then((data: any) => { + return calculateMessages(data) as any; + }); }; export const getChatsByPaging = ( @@ -227,4 +225,4 @@ export const deleteUserApiKey = (id: number) => { export const getModelUsage = (modelId: number) => { const fetchServer = useFetch(); return fetchServer.get('/api/models/' + modelId + '/usage'); -} \ No newline at end of file +}; diff --git a/src/FE/components/Admin/ModelKeys/ModelKeysModal.tsx b/src/FE/components/Admin/ModelKeys/ModelKeysModal.tsx index 332950ca..34eab153 100644 --- a/src/FE/components/Admin/ModelKeys/ModelKeysModal.tsx +++ b/src/FE/components/Admin/ModelKeys/ModelKeysModal.tsx @@ -198,7 +198,7 @@ export const ModelKeysModal = (props: IProps) => { field={field} items={feModelProviders.map((p) => ({ value: p.id.toString(), - name: p.name, + name: t(p.name), }))} /> )} diff --git a/src/FE/components/Admin/Users/UserInitialConfigModal.tsx b/src/FE/components/Admin/Users/UserInitialConfigModal.tsx index 382aecc6..c12a9eac 100644 --- a/src/FE/components/Admin/Users/UserInitialConfigModal.tsx +++ b/src/FE/components/Admin/Users/UserInitialConfigModal.tsx @@ -92,6 +92,7 @@ export const UserInitialConfigModal = (props: IProps) => { name: '', price: 0, loginType: '-', + invitationCodeId: '-', }, }); @@ -243,7 +244,7 @@ export const UserInitialConfigModal = (props: IProps) => { { name: '-', value: '-' }, ...invitationCodes.map((x) => ({ name: x.value, - value: x.id, + value: x.id.toString(), })), ]} /> diff --git a/src/FE/components/Admin/Users/UserModal.tsx b/src/FE/components/Admin/Users/UserModal.tsx index b7f06b16..2d651c43 100644 --- a/src/FE/components/Admin/Users/UserModal.tsx +++ b/src/FE/components/Admin/Users/UserModal.tsx @@ -58,6 +58,7 @@ export const UserModal = (props: IProps) => { { name: 'enabled', label: t('Is it enabled'), + defaultValue: true, render: (options: IFormFieldOption, field: FormFieldType) => ( ), diff --git a/src/FE/components/Chat/PromptList.tsx b/src/FE/components/Chat/PromptList.tsx index 71ab6a2b..3b008083 100644 --- a/src/FE/components/Chat/PromptList.tsx +++ b/src/FE/components/Chat/PromptList.tsx @@ -20,7 +20,7 @@ export const PromptList = ({ return (
    {prompts.map((prompt, index) => (
  • { setSettingSheetOpen(true); }} /> - } @@ -117,6 +116,7 @@ export const ChatBarSettings = () => { setChangePwdModalOpen(true); }} /> + } diff --git a/src/FE/components/Login/PhoneRegisterCard.tsx b/src/FE/components/Login/PhoneRegisterCard.tsx index 630e0d77..790ea604 100644 --- a/src/FE/components/Login/PhoneRegisterCard.tsx +++ b/src/FE/components/Login/PhoneRegisterCard.tsx @@ -9,7 +9,6 @@ import useTranslation from '@/hooks/useTranslation'; import { PhoneRegExp, SmsExpirationSeconds } from '@/utils/common'; import { saveUserInfo, setUserSession } from '@/utils/user'; -import ContactModal from '@/components/Modal/ContactModal'; import { Button } from '@/components/ui/button'; import { Card, CardContent } from '@/components/ui/card'; import { @@ -24,21 +23,20 @@ import { Input } from '@/components/ui/input'; import { registerByPhone, sendRegisterSmsCode } from '@/apis/clientApis'; import { zodResolver } from '@hookform/resolvers/zod'; import { z } from 'zod'; +import { redirectToGithub } from '@/utils/website'; const PhoneRegisterCard = (props: { loginLoading: boolean; openLoading: Function; closeLoading: Function; - showContact: boolean; }) => { - const { loginLoading, openLoading, closeLoading, showContact } = props; + const { loginLoading, openLoading, closeLoading } = props; const { t } = useTranslation(); const router = useRouter(); const [seconds, setSeconds] = useState(SmsExpirationSeconds - 1); const [isSendCode, setIsSendCode] = useState(false); const [smsCode, setSmsCode] = useState(''); const [sending, setSending] = useState(false); - const [isContactModalOpen, setIsContactModal] = useState(false); const formSchema = z.object({ invitationCode: z @@ -139,18 +137,14 @@ const PhoneRegisterCard = (props: { className="w-full m-0 border-none outline-none bg-transparent rounded-md" {...field} /> - {showContact && ( - - )} + @@ -222,12 +216,6 @@ const PhoneRegisterCard = (props: { - { - setIsContactModal(false); - }} - /> ); }; diff --git a/src/FE/components/Modal/ContactModal.tsx b/src/FE/components/Modal/ContactModal.tsx deleted file mode 100644 index 73511976..00000000 --- a/src/FE/components/Modal/ContactModal.tsx +++ /dev/null @@ -1,52 +0,0 @@ -import useTranslation from '@/hooks/useTranslation'; - -import { getSiteInfo } from '@/utils/website'; - -import { - Dialog, - DialogContent, - DialogHeader, - DialogTitle, -} from '@/components/ui/dialog'; - -interface IProps { - isOpen: boolean; - onClose: () => void; -} - -const ContactModal = (props: IProps) => { - const { t } = useTranslation(); - const { isOpen, onClose } = props; - const contact = getSiteInfo().contact; - - return ( - - - - {t('Contact')} -
    - {contact?.qqGroupNumber && ( -
    -
    - qq -
    - - QQ群 {` ${contact.qqGroupNumber}`} - -
    - )} -
    -
    -
    -
    - ); -}; - -export default ContactModal; diff --git a/src/FE/components/Sidebar/SidebarButton.tsx b/src/FE/components/Sidebar/SidebarButton.tsx index f2ce2af0..91ad5114 100644 --- a/src/FE/components/Sidebar/SidebarButton.tsx +++ b/src/FE/components/Sidebar/SidebarButton.tsx @@ -17,7 +17,7 @@ export const SidebarButton: FC = ({ }) => { return (
    diff --git a/src/FE/components/ui/table.tsx b/src/FE/components/ui/table.tsx index 9c85abd1..41e730ed 100644 --- a/src/FE/components/ui/table.tsx +++ b/src/FE/components/ui/table.tsx @@ -5,6 +5,8 @@ import { Skeleton } from './skeleton'; import { cn } from '@/lib/utils'; +import useTranslation from '@/hooks/useTranslation'; + const Table = React.forwardRef< HTMLTableElement, React.HTMLAttributes @@ -48,8 +50,10 @@ const TableBody = React.forwardRef( ...props }, ref, - ) => - isLoading ? ( + ) => + { + const { t } = useTranslation(); + return (isLoading ? ( @@ -71,7 +75,7 @@ const TableBody = React.forwardRef( {emptyContent || (
    - {emptyText || '没有找到相关数据'} + {emptyText || t('No data')}
    )} @@ -83,7 +87,8 @@ const TableBody = React.forwardRef( className={cn('[&_tr:last-child]:border-0', className)} {...props} /> - ), + )) + } ); TableBody.displayName = 'TableBody'; diff --git a/src/FE/hooks/useFetch.ts b/src/FE/hooks/useFetch.ts index 3a3d4046..93aa633b 100644 --- a/src/FE/hooks/useFetch.ts +++ b/src/FE/hooks/useFetch.ts @@ -52,12 +52,14 @@ const handleErrorResponse = async (err: Response) => { case 500: message = 'Internal server error, Please try again later'; break; + case 401: + redirectToLogin(); + return; case 403: message = 'Resource denial of authorized access'; redirectToHome(1000); break; - case 401: - redirectToLogin(); + case 404: return; default: message = diff --git a/src/FE/locales/zh-CN.json b/src/FE/locales/zh-CN.json index 590a1efd..c5b9b029 100644 --- a/src/FE/locales/zh-CN.json +++ b/src/FE/locales/zh-CN.json @@ -2,7 +2,6 @@ "Stop Generating": "停止生成", "Prompt limit is {{maxLength}} characters": "提示字数限制为 {{maxLength}} 个字符", "New Conversation": "新的聊天", - "No model data.": "没有模型数据", "System Prompt": "系统提示", "Enter a prompt": "输入一个提示", "Regenerate response": "重新生成回应", @@ -132,6 +131,7 @@ "Clear conversations": "清空对话", "Account Settings": "用户设置", "Contact": "联系我们", + "About Us": "关于我们", "Export data": "导出对话", "Admin Panel": "后台管理", "Log out": "退出登录", @@ -186,7 +186,7 @@ "Account Login": "账号登录", "Welcome to register": "欢迎注册", "Please enter your phone number and invitation code below to complete the register": "在下面输入您的手机号码和邀请码以完成注册", - "Please enter your account name and password below to complete the login": "在下面输入您的账号和密码已完成登录", + "Please enter your account name and password below to complete the login": "在下面输入您的账号和密码以完成登录", "Authorization failed. Please try again later.": "授权失败,请稍后再试", "Dashboard": "仪表盘", "User Models": "用户模型", @@ -342,12 +342,10 @@ "Model already exists.": "模型已存在。", "Model key is in use": "模型密钥已被使用", "Token Price": "Token价格", - "404: Page not found": "404: 页面未找到", "Sorry, we couldn't find the page you were trying to access.": "抱歉,我们找不到你要访问的页面。", ": An error has occurred": ": 发生错误", "Sorry, there was an unexpected error, please try again later.": "抱歉,出现了意外错误,请稍后再试。", - "Local": "本地", "Minio": "Minio", "AWS S3": "AWS S3", @@ -360,7 +358,7 @@ "File is empty.": "文件为空。", "File is too large.": "文件过大。", "Invalid file name.": "无效的文件名。", - "There's no model here": "这里没有模型", - "You can contact the administrator or create one yourself": "你可以联系管理员或者自己创建一个" -} + "You can contact the administrator or create one yourself": "你可以联系管理员或者自己创建一个", + "Customized Text(Company name, etc)": "自定义文本(公司名称等)" +} \ No newline at end of file diff --git a/src/FE/pages/admin/layout/index.tsx b/src/FE/pages/admin/layout/index.tsx index b5b1fc25..520d03cb 100644 --- a/src/FE/pages/admin/layout/index.tsx +++ b/src/FE/pages/admin/layout/index.tsx @@ -37,13 +37,6 @@ const AdminLayout = ({ // }, // title: t('Dashboard'), // }, - { - url: '/admin/users', - icon: (stroke?: string) => { - return ; - }, - title: t('User Management'), - }, { url: '/admin/model-keys', icon: (stroke?: string) => { @@ -58,6 +51,13 @@ const AdminLayout = ({ }, title: t('Model Configs'), }, + { + url: '/admin/users', + icon: (stroke?: string) => { + return ; + }, + title: t('User Management'), + }, { url: '/admin/messages', icon: (stroke?: string) => { diff --git a/src/FE/pages/admin/user-config/index.tsx b/src/FE/pages/admin/user-config/index.tsx index 6c763034..dfbe5400 100644 --- a/src/FE/pages/admin/user-config/index.tsx +++ b/src/FE/pages/admin/user-config/index.tsx @@ -187,6 +187,12 @@ export default function UserInitialConfig() { ))} + + {configList.length === 0 && ( +
    + {t('No data')} +
    + )} {t('Model Count')} - {t('Created Time')} + {t('Actions')} @@ -189,7 +189,16 @@ export default function Users() { - {new Date(item.createdAt).toLocaleString()} + ))} @@ -220,13 +229,14 @@ export default function Users() { userBalance={selectedUser?.balance} isOpen={isOpenModal.recharge} /> - { selectedUser && - } + )} ); } diff --git a/src/FE/pages/login/index.tsx b/src/FE/pages/login/index.tsx index e5068f2f..64667732 100644 --- a/src/FE/pages/login/index.tsx +++ b/src/FE/pages/login/index.tsx @@ -2,7 +2,7 @@ import { useEffect, useState } from 'react'; import useTranslation from '@/hooks/useTranslation'; -import { hasContact, setSiteInfo } from '@/utils/website'; +import { redirectToGithub, setSiteInfo } from '@/utils/website'; import { LoginConfigsResult } from '@/types/clientApis'; import { SiteInfoConfig } from '@/types/config'; @@ -13,7 +13,6 @@ import KeyCloakLogin from '@/components/Login/KeyCloakLogin'; import PhoneLoginCard from '@/components/Login/PhoneLoginCard'; import PhoneRegisterCard from '@/components/Login/PhoneRegisterCard'; import WeChatLogin from '@/components/Login/WeChatLogin'; -import ContactModal from '@/components/Modal/ContactModal'; import { Button } from '@/components/ui/button'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; @@ -31,7 +30,6 @@ type LoginHeader = { export default function LoginPage() { const { t } = useTranslation(); - const [contactOpenModal, setContactOpenModal] = useState(false); const [isClient, setIsClient] = useState(false); const [webSiteInfo, setWebSiteInfo] = useState(); const LoginHeaders: LoginHeader = { @@ -178,7 +176,6 @@ export default function LoginPage() { openLoading={openLoading} closeLoading={closeLoading} loginLoading={loginLoading} - showContact={hasContact(webSiteInfo)} /> {loginConfigs.length > 0 && ( -
    +
    @@ -225,30 +222,22 @@ export default function LoginPage() {
    -

    - +

    +
    {webSiteInfo?.filingNumber} - - © 2024 Chats™ . All Rights Reserved. - {hasContact() && ( -
    +
    + © {new Date().getFullYear()} Chats™ . All Rights Reserved. +
    +
    + {webSiteInfo?.companyName && t(webSiteInfo.companyName)} + - )} -

    +
    +
    - { - setContactOpenModal(false); - }} - /> )} diff --git a/src/FE/types/clientApis.ts b/src/FE/types/clientApis.ts index 80d5fe0c..7b8dd9db 100644 --- a/src/FE/types/clientApis.ts +++ b/src/FE/types/clientApis.ts @@ -52,10 +52,7 @@ export interface GetLoginProvidersResult { export interface GetSiteInfoResult { filingNumber: string; - contact: { - qqGroupNumber: string; - qqGroupQrCodeLink: string; - }; + companyName: string; } export interface GetChatsParams extends Paging { diff --git a/src/FE/types/config.ts b/src/FE/types/config.ts index aae3283a..e865d801 100644 --- a/src/FE/types/config.ts +++ b/src/FE/types/config.ts @@ -6,10 +6,7 @@ export enum GlobalConfigKeys { export interface SiteInfoConfig { filingNumber: string; - contact: { - qqGroupNumber: string; - qqGroupQrCodeLink: string; - }; + companyName: string; } export const GlobalDefaultConfigs = { @@ -22,9 +19,7 @@ export const GlobalDefaultConfigs = { }, siteInfo: { filingNumber: '', - contact: { - qqGroup: '', - }, + companyName: '', }, JwtSecretKey: '', }; diff --git a/src/FE/utils/website.ts b/src/FE/utils/website.ts index a3db06af..f586ca7c 100644 --- a/src/FE/utils/website.ts +++ b/src/FE/utils/website.ts @@ -1,7 +1,7 @@ import { SiteInfoConfig } from '@/types/config'; export const setSiteInfo = (info: SiteInfoConfig) => { - localStorage.setItem('siteInfo', JSON.stringify(info)); + localStorage.setItem('siteInfo', JSON.stringify(info || {})); }; export const getSiteInfo = (): SiteInfoConfig => { @@ -9,12 +9,6 @@ export const getSiteInfo = (): SiteInfoConfig => { return JSON.parse(siteInfo); }; -export const hasContact = (siteInfo?: SiteInfoConfig) => { - let contact = {} as any; - if (siteInfo) { - contact = siteInfo.contact; - } else { - contact = getSiteInfo().contact; - } - return !!contact?.qqGroupNumber; +export const redirectToGithub = () => { + window.open('https://github.com/sdcb/chats', '_blank'); };