Compare commits

..

No commits in common. "d8c869198ed32438e41facb886c8f16a2ac5226d" and "59ca88551849ca4b5875e644881a5ab106957d35" have entirely different histories.

20 changed files with 76 additions and 375 deletions

View File

@ -4533,9 +4533,6 @@ const docTemplate = `{
"contribute_settings": { "contribute_settings": {
"$ref": "#/definitions/domain.ContributeSettings" "$ref": "#/definitions/domain.ContributeSettings"
}, },
"conversation_setting": {
"$ref": "#/definitions/domain.ConversationSetting"
},
"copy_setting": { "copy_setting": {
"enum": [ "enum": [
"", "",
@ -4815,9 +4812,6 @@ const docTemplate = `{
"contribute_settings": { "contribute_settings": {
"$ref": "#/definitions/domain.ContributeSettings" "$ref": "#/definitions/domain.ContributeSettings"
}, },
"conversation_setting": {
"$ref": "#/definitions/domain.ConversationSetting"
},
"copy_setting": { "copy_setting": {
"$ref": "#/definitions/consts.CopySetting" "$ref": "#/definitions/consts.CopySetting"
}, },
@ -5758,17 +5752,6 @@ const docTemplate = `{
} }
} }
}, },
"domain.ConversationSetting": {
"type": "object",
"properties": {
"copyright_hide_enabled": {
"type": "boolean"
},
"copyright_info": {
"type": "string"
}
}
},
"domain.CreateKBReleaseReq": { "domain.CreateKBReleaseReq": {
"type": "object", "type": "object",
"required": [ "required": [

View File

@ -4526,9 +4526,6 @@
"contribute_settings": { "contribute_settings": {
"$ref": "#/definitions/domain.ContributeSettings" "$ref": "#/definitions/domain.ContributeSettings"
}, },
"conversation_setting": {
"$ref": "#/definitions/domain.ConversationSetting"
},
"copy_setting": { "copy_setting": {
"enum": [ "enum": [
"", "",
@ -4808,9 +4805,6 @@
"contribute_settings": { "contribute_settings": {
"$ref": "#/definitions/domain.ContributeSettings" "$ref": "#/definitions/domain.ContributeSettings"
}, },
"conversation_setting": {
"$ref": "#/definitions/domain.ConversationSetting"
},
"copy_setting": { "copy_setting": {
"$ref": "#/definitions/consts.CopySetting" "$ref": "#/definitions/consts.CopySetting"
}, },
@ -5751,17 +5745,6 @@
} }
} }
}, },
"domain.ConversationSetting": {
"type": "object",
"properties": {
"copyright_hide_enabled": {
"type": "boolean"
},
"copyright_info": {
"type": "string"
}
}
},
"domain.CreateKBReleaseReq": { "domain.CreateKBReleaseReq": {
"type": "object", "type": "object",
"required": [ "required": [

View File

@ -431,8 +431,6 @@ definitions:
description: catalog settings description: catalog settings
contribute_settings: contribute_settings:
$ref: '#/definitions/domain.ContributeSettings' $ref: '#/definitions/domain.ContributeSettings'
conversation_setting:
$ref: '#/definitions/domain.ConversationSetting'
copy_setting: copy_setting:
allOf: allOf:
- $ref: '#/definitions/consts.CopySetting' - $ref: '#/definitions/consts.CopySetting'
@ -608,8 +606,6 @@ definitions:
description: catalog settings description: catalog settings
contribute_settings: contribute_settings:
$ref: '#/definitions/domain.ContributeSettings' $ref: '#/definitions/domain.ContributeSettings'
conversation_setting:
$ref: '#/definitions/domain.ConversationSetting'
copy_setting: copy_setting:
$ref: '#/definitions/consts.CopySetting' $ref: '#/definitions/consts.CopySetting'
desc: desc:
@ -1222,13 +1218,6 @@ definitions:
url: url:
type: string type: string
type: object type: object
domain.ConversationSetting:
properties:
copyright_hide_enabled:
type: boolean
copyright_info:
type: string
type: object
domain.CreateKBReleaseReq: domain.CreateKBReleaseReq:
properties: properties:
kb_id: kb_id:

View File

@ -161,17 +161,11 @@ type AppSettings struct {
WebAppLandingConfigs []WebAppLandingConfig `json:"web_app_landing_configs,omitempty"` WebAppLandingConfigs []WebAppLandingConfig `json:"web_app_landing_configs,omitempty"`
WebAppLandingTheme WebAppLandingTheme `json:"web_app_landing_theme"` WebAppLandingTheme WebAppLandingTheme `json:"web_app_landing_theme"`
WatermarkContent string `json:"watermark_content"` WatermarkContent string `json:"watermark_content"`
WatermarkSetting consts.WatermarkSetting `json:"watermark_setting" validate:"omitempty,oneof='' hidden visible"` WatermarkSetting consts.WatermarkSetting `json:"watermark_setting" validate:"omitempty,oneof='' hidden visible"`
CopySetting consts.CopySetting `json:"copy_setting" validate:"omitempty,oneof='' append disabled"` CopySetting consts.CopySetting `json:"copy_setting" validate:"omitempty,oneof='' append disabled"`
ContributeSettings ContributeSettings `json:"contribute_settings"` ContributeSettings ContributeSettings `json:"contribute_settings"`
HomePageSetting consts.HomePageSetting `json:"home_page_setting"` HomePageSetting consts.HomePageSetting `json:"home_page_setting"`
ConversationSetting ConversationSetting `json:"conversation_setting"`
}
type ConversationSetting struct {
CopyrightInfo string `json:"copyright_info"`
CopyrightHideEnabled bool `json:"copyright_hide_enabled"`
} }
type WebAppLandingTheme struct { type WebAppLandingTheme struct {
@ -543,7 +537,6 @@ type AppSettingsResp struct {
WebAppLandingConfigs []WebAppLandingConfigResp `json:"web_app_landing_configs,omitempty"` WebAppLandingConfigs []WebAppLandingConfigResp `json:"web_app_landing_configs,omitempty"`
WebAppLandingTheme WebAppLandingTheme `json:"web_app_landing_theme"` WebAppLandingTheme WebAppLandingTheme `json:"web_app_landing_theme"`
HomePageSetting consts.HomePageSetting `json:"home_page_setting"` HomePageSetting consts.HomePageSetting `json:"home_page_setting"`
ConversationSetting ConversationSetting `json:"conversation_setting"`
} }
type WebAppLandingConfigResp struct { type WebAppLandingConfigResp struct {

View File

@ -192,29 +192,12 @@ func (h *UserHandler) ResetPassword(c echo.Context) error {
if err != nil { if err != nil {
return h.NewResponseWithError(c, "failed to get user", err) return h.NewResponseWithError(c, "failed to get user", err)
} }
if user.Account == "admin" && authInfo.UserId == req.ID {
// 非超级管理员没有改密码权限 return h.NewResponseWithError(c, "请修改安装目录下 .env 文件中的 ADMIN_PASSWORD并重启 panda-wiki-api 容器使更改生效。", nil)
if user.Role != consts.UserRoleAdmin {
return h.NewResponseWithErrCode(c, domain.ErrCodePermissionDenied)
} }
if user.Account != "admin" && authInfo.UserId != req.ID {
if user.Account == "admin" { return h.NewResponseWithError(c, "只有管理员可以重置其他用户密码", nil)
// admin 改不了自己的密码
if authInfo.UserId == req.ID {
return h.NewResponseWithError(c, "请修改安装目录下 .env 文件中的 ADMIN_PASSWORD并重启 panda-wiki-api 容器使更改生效。", nil)
}
} else {
targetUser, err := h.usecase.GetUser(ctx, req.ID)
if err != nil {
return h.NewResponseWithError(c, "failed to get target user", err)
}
// 超级管理员不能改其他超级管理员密码
if targetUser.Role == consts.UserRoleAdmin && targetUser.ID != authInfo.UserId {
return h.NewResponseWithError(c, "无法修改其他超级管理员密码", nil)
}
} }
err = h.usecase.ResetPassword(c.Request().Context(), &req) err = h.usecase.ResetPassword(c.Request().Context(), &req)
if err != nil { if err != nil {
return h.NewResponseWithError(c, "failed to reset password", err) return h.NewResponseWithError(c, "failed to reset password", err)

View File

@ -125,9 +125,6 @@ func (u *AppUsecase) ValidateUpdateApp(ctx context.Context, id string, req *doma
if app.Settings.WidgetBotSettings.CopyrightHideEnabled != req.Settings.WidgetBotSettings.CopyrightHideEnabled || app.Settings.WidgetBotSettings.CopyrightInfo != req.Settings.WidgetBotSettings.CopyrightInfo { if app.Settings.WidgetBotSettings.CopyrightHideEnabled != req.Settings.WidgetBotSettings.CopyrightHideEnabled || app.Settings.WidgetBotSettings.CopyrightInfo != req.Settings.WidgetBotSettings.CopyrightInfo {
return domain.ErrPermissionDenied return domain.ErrPermissionDenied
} }
if app.Settings.ConversationSetting.CopyrightHideEnabled != req.Settings.ConversationSetting.CopyrightHideEnabled || app.Settings.ConversationSetting.CopyrightInfo != req.Settings.ConversationSetting.CopyrightInfo {
return domain.ErrPermissionDenied
}
} }
return nil return nil
@ -516,21 +513,14 @@ func (u *AppUsecase) GetAppDetailByKBIDAndAppType(ctx context.Context, kbID stri
WebAppLandingConfigs: webAppLandingConfigs, WebAppLandingConfigs: webAppLandingConfigs,
WebAppLandingTheme: app.Settings.WebAppLandingTheme, WebAppLandingTheme: app.Settings.WebAppLandingTheme,
WatermarkContent: app.Settings.WatermarkContent, WatermarkContent: app.Settings.WatermarkContent,
WatermarkSetting: app.Settings.WatermarkSetting, WatermarkSetting: app.Settings.WatermarkSetting,
CopySetting: app.Settings.CopySetting, CopySetting: app.Settings.CopySetting,
ContributeSettings: app.Settings.ContributeSettings, ContributeSettings: app.Settings.ContributeSettings,
HomePageSetting: app.Settings.HomePageSetting, HomePageSetting: app.Settings.HomePageSetting,
ConversationSetting: app.Settings.ConversationSetting,
WecomAIBotSettings: app.Settings.WecomAIBotSettings, WecomAIBotSettings: app.Settings.WecomAIBotSettings,
} }
if !domain.GetBaseEditionLimitation(ctx).AllowCustomCopyright {
appDetailResp.Settings.ConversationSetting.CopyrightHideEnabled = false
appDetailResp.Settings.ConversationSetting.CopyrightInfo = domain.SettingCopyrightInfo
}
// init ai feedback string // init ai feedback string
if app.Settings.AIFeedbackSettings.AIFeedbackType == nil { if app.Settings.AIFeedbackSettings.AIFeedbackType == nil {
appDetailResp.Settings.AIFeedbackSettings.AIFeedbackType = []string{"内容不准确", "没有帮助", "其他"} appDetailResp.Settings.AIFeedbackSettings.AIFeedbackType = []string{"内容不准确", "没有帮助", "其他"}
@ -623,12 +613,11 @@ func (u *AppUsecase) ShareGetWebAppInfo(ctx context.Context, kbID string, authId
WebAppLandingConfigs: webAppLandingConfigs, WebAppLandingConfigs: webAppLandingConfigs,
WebAppLandingTheme: app.Settings.WebAppLandingTheme, WebAppLandingTheme: app.Settings.WebAppLandingTheme,
WatermarkContent: app.Settings.WatermarkContent, WatermarkContent: app.Settings.WatermarkContent,
WatermarkSetting: app.Settings.WatermarkSetting, WatermarkSetting: app.Settings.WatermarkSetting,
CopySetting: app.Settings.CopySetting, CopySetting: app.Settings.CopySetting,
ContributeSettings: app.Settings.ContributeSettings, ContributeSettings: app.Settings.ContributeSettings,
HomePageSetting: app.Settings.HomePageSetting, HomePageSetting: app.Settings.HomePageSetting,
ConversationSetting: app.Settings.ConversationSetting,
}, },
} }
// init ai feedback string // init ai feedback string
@ -644,8 +633,6 @@ func (u *AppUsecase) ShareGetWebAppInfo(ctx context.Context, kbID string, authId
if !domain.GetBaseEditionLimitation(ctx).AllowCustomCopyright { if !domain.GetBaseEditionLimitation(ctx).AllowCustomCopyright {
appInfo.Settings.WebAppCustomSettings.ShowBrandInfo = &showBrand appInfo.Settings.WebAppCustomSettings.ShowBrandInfo = &showBrand
appInfo.Settings.DisclaimerSettings.Content = &defaultDisclaimer appInfo.Settings.DisclaimerSettings.Content = &defaultDisclaimer
appInfo.Settings.ConversationSetting.CopyrightHideEnabled = false
appInfo.Settings.ConversationSetting.CopyrightInfo = domain.SettingCopyrightInfo
} else { } else {
if appInfo.Settings.DisclaimerSettings.Content == nil { if appInfo.Settings.DisclaimerSettings.Content == nil {
appInfo.Settings.DisclaimerSettings.Content = &defaultDisclaimer appInfo.Settings.DisclaimerSettings.Content = &defaultDisclaimer

View File

@ -534,7 +534,6 @@ const FooterConfig = ({ data, setIsEdit, isEdit }: FooterConfigProps) => {
</Box> </Box>
<VersionMask <VersionMask
permission={PROFESSION_VERSION_PERMISSION} permission={PROFESSION_VERSION_PERMISSION}
wrapperSx={{ px: 2 }}
sx={{ inset: '-8px 0' }} sx={{ inset: '-8px 0' }}
> >
<Controller <Controller

View File

@ -137,7 +137,7 @@ const Member = () => {
<Button <Button
size='small' size='small'
sx={{ sx={{
color: 'var(--mui-palette-action-disabled)', color: 'text.tertiary',
cursor: 'not-allowed', cursor: 'not-allowed',
p: 0, p: 0,
minWidth: 'auto', minWidth: 'auto',
@ -151,11 +151,6 @@ const Member = () => {
size='small' size='small'
sx={{ p: 0, minWidth: 'auto' }} sx={{ p: 0, minWidth: 'auto' }}
color='primary' color='primary'
disabled={
record.role === 'admin' &&
user.account !== 'admin' &&
user.id !== record.id
}
onClick={() => { onClick={() => {
setCurUser(record); setCurUser(record);
setCurType('reset-password'); setCurType('reset-password');
@ -164,9 +159,8 @@ const Member = () => {
{user?.id === record.id ? '修改密码' : '重置密码'} {user?.id === record.id ? '修改密码' : '重置密码'}
</Button> </Button>
)} )}
{user?.id !== record.id && {record.account !== 'admin' &&
(user.account === 'admin' || (user?.id === record.id || user.account === 'admin') && (
(user.role === 'admin' && record.role !== 'admin')) && (
<Button <Button
size='small' size='small'
color='error' color='error'

View File

@ -108,6 +108,7 @@ const System = () => {
aria-label='system tabs' aria-label='system tabs'
sx={{ sx={{
mb: 2, mb: 2,
ml: -2,
borderBottom: 1, borderBottom: 1,
borderColor: 'divider', borderColor: 'divider',
'& .MuiTabs-indicator': { '& .MuiTabs-indicator': {
@ -143,12 +144,12 @@ const System = () => {
))} ))}
</Tabs> </Tabs>
{activeTab === 'user-management' && ( {activeTab === 'user-management' && (
<Box> <Box sx={{ ml: -2 }}>
<Member /> <Member />
</Box> </Box>
)} )}
{activeTab === 'model-config' && ( {activeTab === 'model-config' && (
<Box> <Box sx={{ ml: -2 }}>
<ModelConfig <ModelConfig
ref={modelConfigRef} ref={modelConfigRef}
onCloseModal={() => setOpen(false)} onCloseModal={() => setOpen(false)}

View File

@ -55,12 +55,10 @@ const VersionMask = ({
ConstsLicenseEdition.LicenseEditionEnterprise, ConstsLicenseEdition.LicenseEditionEnterprise,
], ],
children, children,
wrapperSx,
sx, sx,
}: { }: {
permission?: ConstsLicenseEdition[]; permission?: ConstsLicenseEdition[];
children?: React.ReactNode; children?: React.ReactNode;
wrapperSx?: SxProps;
sx?: SxProps; sx?: SxProps;
}) => { }) => {
const versionInfo = useVersionInfo(); const versionInfo = useVersionInfo();
@ -69,7 +67,7 @@ const VersionMask = ({
const nextVersionInfo = VersionInfoMap[permission[0]]; const nextVersionInfo = VersionInfoMap[permission[0]];
return ( return (
<StyledMaskWrapper sx={wrapperSx}> <StyledMaskWrapper>
{children} {children}
<StyledMask sx={sx}> <StyledMask sx={sx}>
<StyledMaskContent> <StyledMaskContent>

View File

@ -1,139 +0,0 @@
import { putApiV1App } from '@/request/App';
import { FormItem, SettingCardItem } from './Common';
import {
DomainAppDetailResp,
DomainConversationSetting,
} from '@/request/types';
import { PROFESSION_VERSION_PERMISSION } from '@/constant/version';
import {
FormControlLabel,
Radio,
RadioGroup,
TextField,
Box,
} from '@mui/material';
import { message } from '@ctzhian/ui';
import { useEffect, useState } from 'react';
import VersionMask from '@/components/VersionMask';
import { Controller, useForm } from 'react-hook-form';
import { useAppSelector } from '@/store';
const CardQaCopyright = ({
data,
refresh,
}: {
data: DomainAppDetailResp;
refresh: (value: DomainConversationSetting) => void;
}) => {
const [isEdit, setIsEdit] = useState<boolean>(false);
const { kb_id } = useAppSelector(state => state.config);
const {
control,
handleSubmit,
reset,
watch,
setValue,
formState: { errors },
} = useForm({
defaultValues: {
copyright_hide_enabled: false,
copyright_info: '',
},
});
const copyright_hide_enabled = watch('copyright_hide_enabled');
const onSubmit = handleSubmit(value => {
putApiV1App(
{ id: data.id! },
{ settings: { ...data.settings, conversation_setting: value }, kb_id },
).then(() => {
refresh(value);
message.success('保存成功');
setIsEdit(false);
});
});
useEffect(() => {
setValue(
'copyright_hide_enabled',
data.settings?.conversation_setting?.copyright_hide_enabled ?? false,
);
setValue(
'copyright_info',
data.settings?.conversation_setting?.copyright_info ?? '',
);
}, [data]);
return (
<SettingCardItem
title='智能问答版权信息'
isEdit={isEdit}
onSubmit={onSubmit}
>
<VersionMask permission={PROFESSION_VERSION_PERMISSION}>
<FormItem
label='版权信息'
sx={{ alignItems: 'flex-start' }}
labelSx={{ mt: 1 }}
>
<Controller
control={control}
name='copyright_hide_enabled'
render={({ field }) => {
return (
<RadioGroup
row
{...field}
onChange={e => {
field.onChange(e.target.value === 'true');
setIsEdit(true);
}}
>
<FormControlLabel
value={false}
control={<Radio size='small' />}
label={<Box sx={{ width: 100 }}></Box>}
/>
<FormControlLabel
value={true}
control={<Radio size='small' />}
label={<Box sx={{ width: 100 }}></Box>}
/>
</RadioGroup>
);
}}
/>
</FormItem>
{!copyright_hide_enabled && (
<FormItem
label='版权文字'
sx={{ alignItems: 'flex-start' }}
labelSx={{ mt: 1 }}
>
<Controller
control={control}
name='copyright_info'
render={({ field }) => (
<TextField
fullWidth
{...field}
placeholder='本网站由 PandaWiki 提供技术支持'
error={!!errors.copyright_info}
helperText={errors.copyright_info?.message}
onChange={event => {
setIsEdit(true);
field.onChange(event);
}}
/>
)}
/>
</FormItem>
)}
</VersionMask>
</SettingCardItem>
);
};
export default CardQaCopyright;

View File

@ -14,7 +14,6 @@ import CardProxy from './CardProxy';
import CardStyle from './CardStyle'; import CardStyle from './CardStyle';
import CardWebCustomCode from './CardWebCustomCode'; import CardWebCustomCode from './CardWebCustomCode';
import CardWebSEO from './CardWebSEO'; import CardWebSEO from './CardWebSEO';
import CardQaCopyright from './CardQaCopyright';
interface CardWebProps { interface CardWebProps {
kb: DomainKnowledgeBaseDetail; kb: DomainKnowledgeBaseDetail;
@ -77,18 +76,6 @@ const CardWeb = ({ kb, refresh }: CardWebProps) => {
<CardListen kb={kb} refresh={refresh} /> <CardListen kb={kb} refresh={refresh} />
<CardProxy kb={kb} refresh={refresh} /> <CardProxy kb={kb} refresh={refresh} />
<CardBasicInfo kb={kb} refresh={refresh} /> <CardBasicInfo kb={kb} refresh={refresh} />
<CardQaCopyright
data={info}
refresh={value => {
setInfo({
...info,
settings: {
...info.settings,
conversation_setting: value,
},
});
}}
/>
<CardAuth kb={kb} refresh={refresh} /> <CardAuth kb={kb} refresh={refresh} />
<CardCatalog <CardCatalog
id={info.id} id={info.id}

View File

@ -304,7 +304,6 @@ export interface DomainAppSettings {
/** catalog settings */ /** catalog settings */
catalog_settings?: DomainCatalogSettings; catalog_settings?: DomainCatalogSettings;
contribute_settings?: DomainContributeSettings; contribute_settings?: DomainContributeSettings;
conversation_setting?: DomainConversationSetting;
copy_setting?: "" | "append" | "disabled"; copy_setting?: "" | "append" | "disabled";
/** seo */ /** seo */
desc?: string; desc?: string;
@ -390,7 +389,6 @@ export interface DomainAppSettingsResp {
/** catalog settings */ /** catalog settings */
catalog_settings?: DomainCatalogSettings; catalog_settings?: DomainCatalogSettings;
contribute_settings?: DomainContributeSettings; contribute_settings?: DomainContributeSettings;
conversation_setting?: DomainConversationSetting;
copy_setting?: ConstsCopySetting; copy_setting?: ConstsCopySetting;
/** seo */ /** seo */
desc?: string; desc?: string;
@ -707,11 +705,6 @@ export interface DomainConversationReference {
url?: string; url?: string;
} }
export interface DomainConversationSetting {
copyright_hide_enabled?: boolean;
copyright_info?: string;
}
export interface DomainCreateKBReleaseReq { export interface DomainCreateKBReleaseReq {
kb_id: string; kb_id: string;
message: string; message: string;
@ -989,11 +982,11 @@ export interface DomainNodeListItemResp {
editor_id?: string; editor_id?: string;
emoji?: string; emoji?: string;
id?: string; id?: string;
publisher_id?: string;
name?: string; name?: string;
parent_id?: string; parent_id?: string;
permissions?: DomainNodePermissions; permissions?: DomainNodePermissions;
position?: number; position?: number;
publisher_id?: string;
rag_info?: DomainRagInfo; rag_info?: DomainRagInfo;
status?: DomainNodeStatus; status?: DomainNodeStatus;
summary?: string; summary?: string;
@ -1780,23 +1773,23 @@ export interface DeleteApiV1AuthDeleteParams {
export interface GetApiV1AuthGetParams { export interface GetApiV1AuthGetParams {
kb_id?: string; kb_id?: string;
source_type: source_type:
| "dingtalk" | "dingtalk"
| "feishu" | "feishu"
| "wecom" | "wecom"
| "oauth" | "oauth"
| "github" | "github"
| "cas" | "cas"
| "ldap" | "ldap"
| "widget" | "widget"
| "dingtalk_bot" | "dingtalk_bot"
| "feishu_bot" | "feishu_bot"
| "lark_bot" | "lark_bot"
| "wechat_bot" | "wechat_bot"
| "wecom_ai_bot" | "wecom_ai_bot"
| "wechat_service_bot" | "wechat_service_bot"
| "discord_bot" | "discord_bot"
| "wechat_official_account" | "wechat_official_account"
| "openai_api"; | "openai_api";
} }
export interface GetApiV1CommentParams { export interface GetApiV1CommentParams {

View File

@ -2,7 +2,6 @@ import {
ConstsCopySetting, ConstsCopySetting,
ConstsWatermarkSetting, ConstsWatermarkSetting,
DomainDisclaimerSettings, DomainDisclaimerSettings,
DomainConversationSetting,
DomainWebAppLandingConfig, DomainWebAppLandingConfig,
} from '@/request/types'; } from '@/request/types';
@ -59,7 +58,6 @@ export interface ThemeAndStyleSetting {
export interface KBDetail { export interface KBDetail {
name: string; name: string;
settings: { settings: {
conversation_setting: DomainConversationSetting;
title: string; title: string;
btns: NavBtn[]; btns: NavBtn[];
icon: string; icon: string;

View File

@ -247,8 +247,7 @@ const QaModal: React.FC<QaModalProps> = () => {
<Box <Box
sx={{ sx={{
px: 3, px: 3,
pt: !kbDetail?.settings?.conversation_setting pt: kbDetail?.settings?.web_app_custom_style?.show_brand_info
?.copyright_hide_enabled
? 2 ? 2
: 0, : 0,
display: 'flex', display: 'flex',
@ -267,10 +266,8 @@ const QaModal: React.FC<QaModalProps> = () => {
}} }}
> >
<Box> <Box>
{!kbDetail?.settings?.conversation_setting {kbDetail?.settings?.web_app_custom_style?.show_brand_info &&
?.copyright_hide_enabled && '本网站由 PandaWiki 提供技术支持'}
(kbDetail?.settings?.conversation_setting?.copyright_info ||
'本网站由 PandaWiki 提供技术支持')}
</Box> </Box>
</Typography> </Typography>
</Box> </Box>

View File

@ -152,11 +152,7 @@ export const WelcomeHeader = () => {
onSearch={handleSearch} onSearch={handleSearch}
onQaClick={() => setQaModalOpen?.(true)} onQaClick={() => setQaModalOpen?.(true)}
> >
{!!authInfo && ( <Box sx={{ ml: 2 }}>{!!authInfo && <LogoutButton />}</Box>
<Box sx={{ ml: 2 }}>
<LogoutButton />
</Box>
)}
<QaModal /> <QaModal />
</WelcomeHeaderComponent> </WelcomeHeaderComponent>
); );

View File

@ -304,7 +304,6 @@ export interface DomainAppSettings {
/** catalog settings */ /** catalog settings */
catalog_settings?: DomainCatalogSettings; catalog_settings?: DomainCatalogSettings;
contribute_settings?: DomainContributeSettings; contribute_settings?: DomainContributeSettings;
conversation_setting?: DomainConversationSetting;
copy_setting?: "" | "append" | "disabled"; copy_setting?: "" | "append" | "disabled";
/** seo */ /** seo */
desc?: string; desc?: string;
@ -390,7 +389,6 @@ export interface DomainAppSettingsResp {
/** catalog settings */ /** catalog settings */
catalog_settings?: DomainCatalogSettings; catalog_settings?: DomainCatalogSettings;
contribute_settings?: DomainContributeSettings; contribute_settings?: DomainContributeSettings;
conversation_setting?: DomainConversationSetting;
copy_setting?: ConstsCopySetting; copy_setting?: ConstsCopySetting;
/** seo */ /** seo */
desc?: string; desc?: string;
@ -707,11 +705,6 @@ export interface DomainConversationReference {
url?: string; url?: string;
} }
export interface DomainConversationSetting {
copyright_hide_enabled?: boolean;
copyright_info?: string;
}
export interface DomainCreateKBReleaseReq { export interface DomainCreateKBReleaseReq {
kb_id: string; kb_id: string;
message: string; message: string;
@ -993,7 +986,6 @@ export interface DomainNodeListItemResp {
parent_id?: string; parent_id?: string;
permissions?: DomainNodePermissions; permissions?: DomainNodePermissions;
position?: number; position?: number;
publisher_id?: string;
rag_info?: DomainRagInfo; rag_info?: DomainRagInfo;
status?: DomainNodeStatus; status?: DomainNodeStatus;
summary?: string; summary?: string;

View File

@ -23,17 +23,11 @@ const StyledBanner = styled('div')(({ theme }) => ({
})); }));
const StyledTitle = styled('h1')(({ theme }) => ({ const StyledTitle = styled('h1')(({ theme }) => ({
fontSize: 60, fontSize: 36,
fontWeight: 700, fontWeight: 700,
wordBreak: 'break-all', wordBreak: 'break-all',
color: theme.palette.primary.main, color: theme.palette.primary.main,
marginBottom: theme.spacing(3), marginBottom: theme.spacing(3),
[theme.breakpoints.down('md')]: {
fontSize: 50,
},
[theme.breakpoints.down('sm')]: {
fontSize: 40,
},
})); }));
const StyledSubTitle = styled('h2')(({ theme }) => ({ const StyledSubTitle = styled('h2')(({ theme }) => ({
@ -334,15 +328,16 @@ const Banner = React.memo(
: {}), : {}),
}} }}
> >
<StyledTopicBox <StyledTopicBox sx={{ alignItems: 'flex-start', gap: 0, py: '200px' }}>
sx={{ <StyledTitle
alignItems: 'flex-start', ref={titleRef}
gap: 0, sx={{
py: { xs: 8, md: '200px' }, fontSize: `${title.fontSize || 60}px`,
pt: { xs: 16 }, // color: title.color || '#5F58FE',
}} }}
> >
<StyledTitle ref={titleRef}>{title.text}</StyledTitle> {title.text}
</StyledTitle>
{/* {subtitle.text && ( */} {/* {subtitle.text && ( */}
<StyledSubTitle <StyledSubTitle
ref={subtitleRef} ref={subtitleRef}

View File

@ -130,7 +130,7 @@ const Header = React.memo(
// }), // }),
}} }}
> >
<Link href={'/'} sx={{ flex: 1, minWidth: 0 }}> <Link href={'/'}>
<Stack <Stack
direction='row' direction='row'
alignItems='center' alignItems='center'
@ -143,16 +143,7 @@ const Header = React.memo(
}} }}
> >
<img src={logo} alt='logo' width={36} /> <img src={logo} alt='logo' width={36} />
<Box <Box sx={{ fontSize: 20 }}>{title}</Box>
sx={{
fontSize: 20,
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
overflow: 'hidden',
}}
>
{title}
</Box>
</Stack> </Stack>
</Link> </Link>
{showSearch && {showSearch &&
@ -162,6 +153,7 @@ const Header = React.memo(
direction='row' direction='row'
alignItems='center' alignItems='center'
justifyContent='flex-end' justifyContent='flex-end'
sx={{ flex: 1 }}
> >
<IconButton <IconButton
size='small' size='small'
@ -179,9 +171,11 @@ const Header = React.memo(
focused={false} focused={false}
onClick={() => onQaClick?.()} onClick={() => onQaClick?.()}
sx={{ sx={{
flex: 1, position: 'absolute',
left: '50%',
top: '50%',
transform: 'translate(-50%, -50%)',
maxWidth: '500px', maxWidth: '500px',
minWidth: '220px',
bgcolor: 'background.paper3', bgcolor: 'background.paper3',
borderRadius: '10px', borderRadius: '10px',
overflow: 'hidden', overflow: 'hidden',
@ -279,13 +273,7 @@ const Header = React.memo(
))} ))}
{!mobile && btns && btns.length > 0 && ( {!mobile && btns && btns.length > 0 && (
<Stack <Stack direction='row' gap={2} alignItems='center'>
direction='row'
gap={2}
alignItems='center'
justifyContent='flex-end'
sx={{ flex: 1 }}
>
{btns.slice(0, Math.min(2, btns.length)).map((item, index) => ( {btns.slice(0, Math.min(2, btns.length)).map((item, index) => (
<Link key={index} href={item.url} target={item.target}> <Link key={index} href={item.url} target={item.target}>
<Button <Button
@ -302,7 +290,6 @@ const Header = React.memo(
} }
sx={theme => ({ sx={theme => ({
px: 3.5, px: 3.5,
whiteSpace: 'nowrap',
textTransform: 'none', textTransform: 'none',
boxSizing: 'border-box', boxSizing: 'border-box',
height: 40, height: 40,

View File

@ -155,7 +155,7 @@ const Header = React.memo(
// }), // }),
}} }}
> >
<Link href={'/'} sx={{ flex: 1, minWidth: 0 }}> <Link href={'/'}>
<Stack <Stack
direction='row' direction='row'
alignItems='center' alignItems='center'
@ -167,16 +167,7 @@ const Header = React.memo(
}} }}
> >
<img src={logo} alt='logo' height={36} /> <img src={logo} alt='logo' height={36} />
<Box <Box sx={{ fontSize: 20 }}>{title}</Box>
sx={{
fontSize: 20,
whiteSpace: 'nowrap',
textOverflow: 'ellipsis',
overflow: 'hidden',
}}
>
{title}
</Box>
</Stack> </Stack>
</Link> </Link>
{showSearch && {showSearch &&
@ -186,6 +177,7 @@ const Header = React.memo(
direction='row' direction='row'
alignItems='center' alignItems='center'
justifyContent='flex-end' justifyContent='flex-end'
sx={{ flex: 1 }}
> >
<IconButton <IconButton
size='small' size='small'
@ -203,9 +195,11 @@ const Header = React.memo(
focused={false} focused={false}
onClick={() => onQaClick?.()} onClick={() => onQaClick?.()}
sx={theme => ({ sx={theme => ({
flex: 1, position: 'absolute',
left: '50%',
top: '50%',
transform: 'translate(-50%, -50%)',
maxWidth: '500px', maxWidth: '500px',
minWidth: '220px',
borderRadius: '10px', borderRadius: '10px',
overflow: 'hidden', overflow: 'hidden',
cursor: 'pointer', cursor: 'pointer',
@ -243,7 +237,7 @@ const Header = React.memo(
direction='row' direction='row'
alignItems='center' alignItems='center'
gap={1.5} gap={1.5}
sx={{ flexShrink: 0, ml: 1 }} sx={{ flexShrink: 0 }}
> >
<Box <Box
sx={{ sx={{
@ -264,22 +258,13 @@ const Header = React.memo(
))} ))}
{!mobile && btns && btns.length > 0 && ( {!mobile && btns && btns.length > 0 && (
<Stack <Stack direction='row' gap={2} alignItems='center'>
direction='row'
gap={2}
alignItems='center'
justifyContent='flex-end'
sx={{
flex: 1,
}}
>
{btns.slice(0, Math.min(2, btns.length)).map((item, index) => ( {btns.slice(0, Math.min(2, btns.length)).map((item, index) => (
<Link key={index} href={item.url} target={item.target}> <Link key={index} href={item.url} target={item.target}>
<Button <Button
variant={item.variant} variant={item.variant}
sx={theme => ({ sx={theme => ({
px: 3.5, px: 3.5,
whiteSpace: 'nowrap',
textTransform: 'none', textTransform: 'none',
boxSizing: 'border-box', boxSizing: 'border-box',
height: 40, height: 40,