抱歉,您访问的页面不存在!
请确认链接地址是否正确后重新尝试
@@ -18,4 +18,4 @@ function Page404 (){
)
}
-export default Page404;
\ No newline at end of file
+export default Page404;
diff --git a/src/pages/admin/config/index.tsx b/src/pages/admin/config/index.tsx
index ad06256..6b87e4e 100644
--- a/src/pages/admin/config/index.tsx
+++ b/src/pages/admin/config/index.tsx
@@ -4,14 +4,16 @@ import {
ProFormGroup,
ProFormList,
ProFormText,
+ ProFormTextArea,
QueryFilter
} from '@ant-design/pro-components'
-import { Button, Form, Space, message } from 'antd'
-import { useEffect, useState } from 'react'
+import { Button, Form, Space, Tabs, message } from 'antd'
+import { useEffect, useRef, useState } from 'react'
import styles from './index.module.less'
import { getAdminConfig, putAdminConfig } from '@/request/adminApi'
import { ConfigInfo } from '@/types/admin'
import { CloseCircleOutlined, SmileOutlined } from '@ant-design/icons'
+import RichEdit from '@/components/RichEdit'
function ConfigPage() {
const [configs, setConfigs] = useState
>([])
@@ -29,13 +31,21 @@ function ConfigPage() {
ai4_ratio: number | string
}>()
- const [drawUsePriceForm] = Form.useForm<{
- draw_use_price: Array<{
- size: string
- integral: number
- }>
+ const [drawPriceForm] = Form.useForm<{
+ draw_price: number | string
}>()
+ const [webSiteForm] = Form.useForm<{
+ website_title: string
+ website_description: string
+ website_keywords: string
+ website_logo: string
+ website_footer: string
+ }>()
+
+ const shopIntroduce = useRef()
+ const userIntroduce = useRef()
+
function getConfigValue(key: string, data: Array) {
const value = data.filter((c) => c.name === key)[0]
return value
@@ -47,7 +57,7 @@ function ConfigPage() {
const historyMessageCountInfo = getConfigValue('history_message_count', data)
const ai3Ratio = getConfigValue('ai3_ratio', data)
const ai4Ratio = getConfigValue('ai4_ratio', data)
- const drawUsePrice = getConfigValue('draw_use_price', data)
+ const drawPrice = getConfigValue('draw_price', data)
rewardForm.setFieldsValue({
register_reward: registerRewardInfo.value,
signin_reward: signinRewardInfo.value
@@ -59,33 +69,34 @@ function ConfigPage() {
ai3_ratio: Number(ai3Ratio.value),
ai4_ratio: Number(ai4Ratio.value)
})
- if (drawUsePrice && drawUsePrice.value) {
- drawUsePriceForm.setFieldsValue({
- draw_use_price: JSON.parse(drawUsePrice.value)
+ if (drawPrice && drawPrice.value) {
+ drawPriceForm.setFieldsValue({
+ draw_price: JSON.parse(drawPrice.value)
})
}
- // else {
- // const drawUsePriceInitData = {
- // draw_use_price: [
- // {
- // size: '256x256',
- // integral: 80
- // },
- // {
- // size: '512x512',
- // integral: 90
- // },
- // {
- // size: '1024x1024',
- // integral: 100
- // }
- // ]
- // }
- // drawUsePriceForm.setFieldsValue(drawUsePriceInitData)
- // onSave({
- // draw_use_price: JSON.stringify(drawUsePriceInitData.draw_use_price)
- // })
- // }
+
+ const website_title = getConfigValue('website_title', data)
+ const website_description = getConfigValue('website_description', data)
+ const website_keywords = getConfigValue('website_keywords', data)
+ const website_logo = getConfigValue('website_logo', data)
+ const website_footer = getConfigValue('website_footer', data)
+ webSiteForm.setFieldsValue({
+ website_title: website_title.value,
+ website_description: website_description.value,
+ website_keywords: website_keywords.value,
+ website_logo: website_logo.value,
+ website_footer: website_footer.value
+ })
+
+ const shop_introduce = getConfigValue('shop_introduce', data)
+ if (shop_introduce && shop_introduce.value) {
+ shopIntroduce.current = shop_introduce.value
+ }
+
+ const user_introduce = getConfigValue('user_introduce', data)
+ if (user_introduce && user_introduce.value) {
+ userIntroduce.current = user_introduce.value
+ }
}
function onGetConfig() {
@@ -114,8 +125,150 @@ function ConfigPage() {
})
}
- return (
-
+ function IntroduceSettings() {
+ return (
+
+
+
商城页面公告设置
+
+ {
+ shopIntroduce.current = value
+ }}
+ />
+
+
+
+
+
个人中心页面公告设置
+
+ {
+ userIntroduce.current = value
+ }}
+ />
+
+
+
+
+ )
+ }
+
+ function WebSiteSettings() {
+ return (
+
+
+
网站设置
+
{
+ onRewardFormSet(configs)
+ }}
+ >
+
+
+
+
+
+
+
+
+
+
+
+
+ )
+ }
+
+ function RewardSettings() {
+ return (
奖励激励
{
putAdminConfig(values).then((res) => {
@@ -166,6 +321,8 @@ function ConfigPage() {
历史记录
{
@@ -194,6 +351,8 @@ function ConfigPage() {
设置1积分等于多少Token,比如:1积分=50Token,那么单次会话消耗100Token就需要扣除2积分。
{
@@ -225,60 +384,62 @@ function ConfigPage() {
绘画积分扣除设置
-
分为三个规格 256x256 512x512 1024x1024 请分别设置, 如为设置则不扣除积分。
-
{
- values.draw_use_price = JSON.stringify(values.draw_use_price) as any
- return onSave(values)
- }}
+
+ 绘画计费规则为每秒消耗多少积分,比如设置10则生成一张512x512图片耗时为2秒则扣除20积分!
+
+ {
onRewardFormSet(configs)
}}
size="large"
+ collapsed={false}
+ defaultCollapsed={false}
requiredMark={false}
- isKeyPressSubmit={false}
- submitter={{
- searchConfig: {
- submitText: '保存',
- resetText: '恢复'
- }
- }}
+ defaultColsNumber={79}
+ searchText="保存"
+ resetText="恢复"
>
-
-
-
-
-
-
-
+
+
+ )
+ }
+
+ return (
+
+
+ },
+ {
+ label: '奖励设置',
+ key: 'RewardSettings',
+ children:
+ },
+ {
+ label: '页面说明设置',
+ key: 'IntroduceSettings',
+ children:
+ },
+ ]}
+ />
)
}
diff --git a/src/pages/admin/notification/index.tsx b/src/pages/admin/notification/index.tsx
index 41d113e..e521a4b 100644
--- a/src/pages/admin/notification/index.tsx
+++ b/src/pages/admin/notification/index.tsx
@@ -38,21 +38,6 @@ function NotificationPage() {
content: ''
})
- function getConfigValue(key: string, data: Array
) {
- const value = data.filter((c) => c.name === key)[0]
- return value
- }
-
- function onGetConfigs (){
- getAdminConfig().then((res)=>{
- if(res.code) return
- setConfigs(res.data)
- })
- }
-
- useEffect(() => {
- onGetConfigs()
- }, [])
const columns: ProColumns[] = [
{
@@ -81,7 +66,7 @@ function NotificationPage() {
dataIndex: 'status',
width: 100,
render: (_, data) => (
- {data.status ? '正常' : '异常'}
+ {data.status ? '上线' : '下线'}
)
},
{
@@ -178,44 +163,11 @@ function NotificationPage() {
]
}}
- headerTitle={(
-
-
-
-
- )}
rowKey="id"
search={false}
bordered
/>
+
上线
- 下线
+ 下线
@@ -341,48 +293,6 @@ function NotificationPage() {
- {
- putAdminConfig({
- [edidContentModal.key]: edidContentModal.content
- }).then((res) => {
- if (res.code) {
- message.error('保存失败')
- return
- }
- setEdidContentModal({
- open: false,
- title: '',
- content: '',
- key: ''
- })
- message.success('保存成功')
- onGetConfigs()
- })
- }}
- onCancel={() => {
- setEdidContentModal({
- open: false,
- content: '',
- key: ''
- })
- }}
- title={edidContentModal.title}
- >
- {
- setEdidContentModal((editInfo) => {
- return {
- ...editInfo,
- content: value
- }
- })
- }}
- />
-
)
}
diff --git a/src/pages/admin/product/index.tsx b/src/pages/admin/product/index.tsx
index 0f0e55e..9e161ca 100644
--- a/src/pages/admin/product/index.tsx
+++ b/src/pages/admin/product/index.tsx
@@ -15,7 +15,7 @@ import {
ProFormText
} from '@ant-design/pro-components'
import { ProTable } from '@ant-design/pro-components'
-import { Button, Form, Tag, message } from 'antd'
+import { Button, Form, Tag, Tooltip, message } from 'antd'
import { useRef, useState } from 'react'
function ProductPage() {
@@ -72,6 +72,18 @@ function ProductPage() {
return 暂无级别
}
},
+ {
+ title: '商品描述',
+ dataIndex: 'describe',
+ ellipsis: {
+ showTitle: false,
+ },
+ render: (_, data) => (
+
+ {data.describe}
+
+ ),
+ },
{
title: '状态值',
dataIndex: 'status',
@@ -237,7 +249,7 @@ function ProductPage() {
rules={[{ required: true, message: '请输入角标' }]}
/>
-
+
diff --git a/src/pages/chat/components/ChatMessage/index.module.less b/src/pages/chat/components/ChatMessage/index.module.less
index 9191a39..b80f483 100644
--- a/src/pages/chat/components/ChatMessage/index.module.less
+++ b/src/pages/chat/components/ChatMessage/index.module.less
@@ -1,10 +1,17 @@
.chatMessage{
display: flex;
margin-top: 12px;
- &_avatar{
- width: 34px;
- height: 34px;
- border-radius: 4px;
+ &_avatarCard{
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: space-between;
+ img {
+ width: 34px;
+ height: 34px;
+ border-radius: 4px;
+ }
+
}
&_content{
display: flex;
@@ -20,6 +27,22 @@
max-width: calc(100% - 42px);
display: inline-block;
padding: 12px;
+ position: relative;
+ }
+ &_operate{
+ position: absolute;
+ bottom: 2px;
+ // left: -20px;
+ // right: -20px;
+ cursor: pointer;
+ &_icon{
+ width: 20px;
+ height: 20px;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ font-size: 20px;
+ }
}
.left{
margin-right: auto;
diff --git a/src/pages/chat/components/ChatMessage/index.tsx b/src/pages/chat/components/ChatMessage/index.tsx
index 0e40bf4..4f915e5 100644
--- a/src/pages/chat/components/ChatMessage/index.tsx
+++ b/src/pages/chat/components/ChatMessage/index.tsx
@@ -2,13 +2,45 @@ import React, { useEffect, useMemo, useRef } from 'react'
import { copyToClipboard, joinTrim } from '@/utils'
import styles from './index.module.less'
import OpenAiLogo from '@/components/OpenAiLogo'
-import { Space, Popconfirm, message } from 'antd'
+import { Space, Popconfirm, message, Dropdown } from 'antd'
import MarkdownIt from 'markdown-it'
import mdKatex from '@traptitech/markdown-it-katex'
import mila from 'markdown-it-link-attributes'
import hljs from 'highlight.js'
-import { DeleteOutlined } from '@ant-design/icons'
+import { CopyOutlined, DeleteOutlined, MoreOutlined, RedoOutlined } from '@ant-design/icons'
+
+const dropdownItems = [
+ {
+ icon: ,
+ label: '复制',
+ key: 'copyout',
+ },
+ {
+ icon: ,
+ label: '重试',
+ key: 'refurbish',
+ },
+ {
+ icon: ,
+ label: '删除',
+ key: 'delete',
+ },
+]
+
+function screenDropdownItems(status: string, position: 'left' | 'right') {
+ const newList = dropdownItems.filter((item) => {
+ if (status !== 'error' && item.key === 'delete') {
+ return false
+ }
+ if (position !== 'left' && (item.key === 'redoOut' || item.key === 'delete')) {
+ return false
+ }
+ return true;
+ });
+
+ return [...newList]
+}
function ChatMessage({
position,
@@ -16,7 +48,8 @@ function ChatMessage({
status,
time,
model,
- onDelChatMessage
+ onDelChatMessage,
+ onRefurbishChatMessage
}: {
position: 'left' | 'right'
content?: string
@@ -24,10 +57,30 @@ function ChatMessage({
time: string
model?: string
onDelChatMessage?: () => void
+ onRefurbishChatMessage?: () => void
}) {
const copyMessageKey = 'copyMessageKey'
const markdownBodyRef = useRef(null)
+ function onCopyOut(text: string) {
+ copyToClipboard(text)
+ .then(() => {
+ message.open({
+ key: copyMessageKey,
+ type: 'success',
+ content: '复制成功'
+ })
+ })
+ .catch(() => {
+ message.open({
+ key: copyMessageKey,
+ type: 'error',
+ content: '复制失败'
+ })
+ })
+ }
+
+
function addCopyEvents() {
if (markdownBodyRef.current) {
const copyBtn = markdownBodyRef.current.querySelectorAll('.code-block-header__copy')
@@ -35,21 +88,7 @@ function ChatMessage({
btn.addEventListener('click', () => {
const code = btn.parentElement?.nextElementSibling?.textContent
if (code) {
- copyToClipboard(code)
- .then(() => {
- message.open({
- key: copyMessageKey,
- type: 'success',
- content: '复制成功'
- })
- })
- .catch(() => {
- message.open({
- key: copyMessageKey,
- type: 'error',
- content: '复制失败'
- })
- })
+ onCopyOut(code);
}
})
})
@@ -101,25 +140,12 @@ function ChatMessage({
function chatAvatar({ icon, style }: { icon: string; style?: React.CSSProperties }) {
return (
-
-
- {status === 'error' && (
- {
- onDelChatMessage?.()
- }}
- onCancel={() => {
- // === 无操作 ===
- }}
- okText="Yes"
- cancelText="No"
- >
-
-
- )}
-
+
+
+
)
}
@@ -130,10 +156,13 @@ function ChatMessage({
justifyContent: position === 'right' ? 'flex-end' : 'flex-start'
}}
>
+ {/* https://u1.dl0.cn/icon/chat_gpt_3.png */}
+ {/* https://u1.dl0.cn/icon/chat_gpt_4.png */}
+ {/* https://u1.dl0.cn/icon/openailogo.svg */}
{position === 'left' &&
chatAvatar({
style: { marginRight: 8 },
- icon: model && model.indexOf('gpt-4') !== -1 ? 'https://files.catbox.moe/x5v8wq.png' : 'https://files.catbox.moe/lnulfa.png'
+ icon: model && model.indexOf('gpt-4') !== -1 ? 'https://u1.dl0.cn/icon/chat_gpt_4.png' : 'https://u1.dl0.cn/icon/openailogo.svg'
})}
)}
+
+
+
{
+ console.log(key)
+ if (key === 'delete') {
+ onDelChatMessage?.()
+ }
+
+ if(key === 'refurbish'){
+ onRefurbishChatMessage?.()
+ }
+
+ if (key === 'copyout' && content) {
+ onCopyOut(content);
+ }
+ },
+ }}
+ >
+
+
+
+
+
{position === 'right' &&
diff --git a/src/pages/chat/components/RoleLocal/index.tsx b/src/pages/chat/components/RoleLocal/index.tsx
index 0714758..4559278 100644
--- a/src/pages/chat/components/RoleLocal/index.tsx
+++ b/src/pages/chat/components/RoleLocal/index.tsx
@@ -166,7 +166,7 @@ function RoleLocal() {