Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
d36a7cb1
authored
May 29, 2023
by
archer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
perf: avatar
parent
2fc31a70
Hide whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
33 additions
and
17 deletions
+33
-17
public/docs/chatProblem.md
+1
-1
public/docs/intro.md
+1
-1
public/docs/versionIntro.md
+9
-3
public/icon/human.png
+0
-0
src/api/response/chat.d.ts
+1
-0
src/components/Avatar/index.tsx
+4
-1
src/components/Layout/navbar.tsx
+2
-1
src/components/WxConcat/index.tsx
+1
-1
src/constants/chat.ts
+0
-0
src/pages/api/chat/shareChat/init.ts
+5
-1
src/pages/chat/components/Empty.tsx
+0
-1
src/pages/chat/index.tsx
+3
-3
src/pages/chat/share.tsx
+3
-4
src/service/models/user.ts
+1
-0
src/store/chat.ts
+2
-0
No files found.
public/docs/chatProblem.md
View file @
d36a7cb1
...
...
@@ -21,7 +21,7 @@
| 文件拆分 | 0.025 |
**其他问题**
请 WX 联系:
fastgpt123
请 WX 联系:
YNyiqi
| 交流群 | 小助手 |
| ----------------------- | -------------------- |
| !
[
](https://otnvvf-imgs.oss.laf.run/wxqun300.jpg) | 
|
public/docs/intro.md
View file @
d36a7cb1
...
...
@@ -27,7 +27,7 @@ FastGpt 项目完全开源,可随意私有化部署,去除平台风险忧虑
### 交流群/问题反馈
如果群满了,可加个小助手,定时拉
wx 号:
fastgpt123
wx 号:
YNyiqi
| 交流群 | 小助手 |
| ------------------------------------------------- | ---------------------------------------------- |
...
...
public/docs/versionIntro.md
View file @
d36a7cb1
### Fast GPT V3.8
### Fast GPT V3.8
.1
-
新增 - 知识库引用反馈。
-
新增 - 知识库与 AI 助手对多对关系,一个知识库可以被多个 AI 助手关联,一个 AI 助手可以关联多个知识库。
1.
新增 - 自定义历史记录标题。
2.
新增 - 置顶历史记录。
3.
新增 - 自动置顶最近聊天的模型。
4.
优化 - 索引和 QA 队列,支持多节点和并发(目前线上大概 2500 条/分钟)
5.
优化 - 随机任务,不再按线性等待。
6.
优化 - 内容分段导入和进度查看,不再担心大文件无法导入
7.
优化 - 导出的 csv 大小。最大支持 100M 导出。
8.
知识库数量说明,由于线上数据太多,没法创建索引,所以目前如果超过 5w 组数据,大概率会失败。
public/icon/human.png
View file @
d36a7cb1
56.2 KB
|
W:
|
H:
51.8 KB
|
W:
|
H:
2-up
Swipe
Onion skin
src/api/response/chat.d.ts
View file @
d36a7cb1
...
...
@@ -16,6 +16,7 @@ export interface InitChatResponse {
export
interface
InitShareChatResponse
{
maxContext
:
number
;
userAvatar
:
string
;
model
:
{
name
:
string
;
avatar
:
string
;
...
...
src/components/Avatar/index.tsx
View file @
d36a7cb1
import
React
from
'react'
;
import
{
Image
}
from
'@chakra-ui/react'
;
import
type
{
ImageProps
}
from
'@chakra-ui/react'
;
import
{
LOGO_ICON
}
from
'@/constants/chat'
;
const
Avatar
=
({
w
=
'30px'
,
...
props
}:
ImageProps
)
=>
{
console
.
log
(
props
.
src
);
return
(
<
Image
fallbackSrc=
"/icon/logo.png"
fallbackSrc=
{
LOGO_ICON
}
borderRadius=
{
'50%'
}
objectFit=
{
'cover'
}
alt=
""
w=
{
w
}
h=
{
w
}
p=
{
'1px'
}
{
...
props
}
/>
);
...
...
src/components/Layout/navbar.tsx
View file @
d36a7cb1
...
...
@@ -5,6 +5,7 @@ import MyIcon from '../Icon';
import
{
useUserStore
}
from
'@/store/user'
;
import
{
useChatStore
}
from
'@/store/chat'
;
import
Avatar
from
'../Avatar'
;
import
{
HUMAN_ICON
}
from
'@/constants/chat'
;
export
enum
NavbarTypeEnum
{
normal
=
'normal'
,
...
...
@@ -83,7 +84,7 @@ const Navbar = () => {
cursor=
{
'pointer'
}
onClick=
{
()
=>
router
.
push
(
'/number'
)
}
>
<
Avatar
w=
{
'36px'
}
h=
{
'36px'
}
src=
{
userInfo
?.
avatar
}
fallbackSrc=
{
'/icon/human.png'
}
/>
<
Avatar
w=
{
'36px'
}
h=
{
'36px'
}
src=
{
userInfo
?.
avatar
}
fallbackSrc=
{
HUMAN_ICON
}
/>
</
Box
>
{
/* 导航列表 */
}
<
Box
flex=
{
1
}
>
...
...
src/components/WxConcat/index.tsx
View file @
d36a7cb1
...
...
@@ -31,7 +31,7 @@ const WxConcat = ({ onClose }: { onClose: () => void }) => {
<
Box
mt=
{
2
}
>
微信号:
<
Box
as=
{
'span'
}
userSelect=
{
'all'
}
>
fastgpt123
YNyiqi
</
Box
>
</
Box
>
</
ModalBody
>
...
...
src/constants/chat.ts
View file @
d36a7cb1
This source diff could not be displayed because it is too large. You can
view the blob
instead.
src/pages/api/chat/shareChat/init.ts
View file @
d36a7cb1
import
type
{
NextApiRequest
,
NextApiResponse
}
from
'next'
;
import
{
jsonRes
}
from
'@/service/response'
;
import
{
connectToDatabase
,
ShareChat
}
from
'@/service/mongo'
;
import
{
connectToDatabase
,
ShareChat
,
User
}
from
'@/service/mongo'
;
import
type
{
InitShareChatResponse
}
from
'@/api/response/chat'
;
import
{
authModel
}
from
'@/service/utils/auth'
;
import
{
hashPassword
}
from
'@/service/utils/tools'
;
import
{
HUMAN_ICON
}
from
'@/constants/chat'
;
/* 初始化我的聊天框,需要身份验证 */
export
default
async
function
handler
(
req
:
NextApiRequest
,
res
:
NextApiResponse
)
{
...
...
@@ -40,9 +41,12 @@ export default async function handler(req: NextApiRequest, res: NextApiResponse)
authOwner
:
false
});
const
user
=
await
User
.
findById
(
shareChat
.
userId
,
'avatar'
);
jsonRes
<
InitShareChatResponse
>
(
res
,
{
data
:
{
maxContext
:
shareChat
.
maxContext
,
userAvatar
:
user
?.
avatar
||
HUMAN_ICON
,
model
:
{
name
:
model
.
name
,
avatar
:
model
.
avatar
,
...
...
src/pages/chat/components/Empty.tsx
View file @
d36a7cb1
...
...
@@ -2,7 +2,6 @@ import React from 'react';
import
{
Card
,
Box
,
Flex
}
from
'@chakra-ui/react'
;
import
{
useMarkdown
}
from
'@/hooks/useMarkdown'
;
import
Markdown
from
'@/components/Markdown'
;
import
{
LOGO_ICON
}
from
'@/constants/chat'
;
import
Avatar
from
'@/components/Avatar'
;
const
Empty
=
({
...
...
src/pages/chat/index.tsx
View file @
d36a7cb1
...
...
@@ -36,7 +36,6 @@ import { streamFetch } from '@/api/fetch';
import
MyIcon
from
'@/components/Icon'
;
import
{
throttle
}
from
'lodash'
;
import
{
Types
}
from
'mongoose'
;
import
{
LOGO_ICON
}
from
'@/constants/chat'
;
import
{
ChatModelMap
}
from
'@/constants/model'
;
import
{
useChatStore
}
from
'@/store/chat'
;
import
{
useLoading
}
from
'@/hooks/useLoading'
;
...
...
@@ -49,6 +48,7 @@ import SideBar from '@/components/SideBar';
import
Avatar
from
'@/components/Avatar'
;
import
Empty
from
'./components/Empty'
;
import
QuoteModal
from
'./components/QuoteModal'
;
import
{
HUMAN_ICON
}
from
'@/constants/chat'
;
const
PhoneSliderBar
=
dynamic
(()
=>
import
(
'./components/PhoneSliderBar'
),
{
ssr
:
false
...
...
@@ -713,8 +713,8 @@ const Chat = ({ modelId, chatId }: { modelId: string; chatId: string }) => {
className="
avatar
"
src={
item.obj === 'Human'
? userInfo?.avatar ||
'/icon/human.png'
: chatData.model.avatar
|| LOGO_ICON
? userInfo?.avatar ||
HUMAN_ICON
: chatData.model.avatar
}
w={['20px', '34px']}
h={['20px', '34px']}
...
...
src/pages/chat/share.tsx
View file @
d36a7cb1
...
...
@@ -38,7 +38,6 @@ import { streamFetch } from '@/api/fetch';
import
MyIcon
from
'@/components/Icon'
;
import
{
throttle
}
from
'lodash'
;
import
{
Types
}
from
'mongoose'
;
import
{
LOGO_ICON
}
from
'@/constants/chat'
;
import
{
useChatStore
}
from
'@/store/chat'
;
import
{
useLoading
}
from
'@/hooks/useLoading'
;
import
{
fileDownload
}
from
'@/utils/file'
;
...
...
@@ -49,6 +48,7 @@ import Markdown from '@/components/Markdown';
import
SideBar
from
'@/components/SideBar'
;
import
Avatar
from
'@/components/Avatar'
;
import
Empty
from
'./components/Empty'
;
import
{
HUMAN_ICON
}
from
'@/constants/chat'
;
const
ShareHistory
=
dynamic
(()
=>
import
(
'./components/ShareHistory'
),
{
loading
:
()
=>
<
Loading
fixed=
{
false
}
/>,
...
...
@@ -101,7 +101,6 @@ const Chat = ({ shareId, historyId }: { shareId: string; historyId: string }) =>
const
{
copyData
}
=
useCopyData
();
const
{
isPc
}
=
useGlobalStore
();
const
{
Loading
,
setIsLoading
}
=
useLoading
();
const
{
userInfo
}
=
useUserStore
();
const
{
isOpen
:
isOpenSlider
,
onClose
:
onCloseSlider
,
onOpen
:
onOpenSlider
}
=
useDisclosure
();
const
{
isOpen
:
isOpenPassword
,
...
...
@@ -628,8 +627,8 @@ const Chat = ({ shareId, historyId }: { shareId: string; historyId: string }) =>
<Avatar
src={
item.obj === 'Human'
?
userInfo?.avatar || '/icon/human.png'
: shareChatData.model.avatar
|| LOGO_ICON
?
shareChatData.userAvatar || HUMAN_ICON
: shareChatData.model.avatar
}
w={['20px', '34px']}
h={['20px', '34px']}
...
...
src/service/models/user.ts
View file @
d36a7cb1
...
...
@@ -2,6 +2,7 @@ import { Schema, model, models, Model } from 'mongoose';
import
{
hashPassword
}
from
'@/service/utils/tools'
;
import
{
PRICE_SCALE
}
from
'@/constants/common'
;
import
{
UserModelSchema
}
from
'@/types/mongoSchema'
;
const
UserSchema
=
new
Schema
({
username
:
{
// 可以是手机/邮箱,新的验证都只用手机
...
...
src/store/chat.ts
View file @
d36a7cb1
...
...
@@ -11,6 +11,7 @@ import {
ShareChatType
}
from
'@/types/chat'
;
import
{
getChatHistory
}
from
'@/api/chat'
;
import
{
HUMAN_ICON
}
from
'@/constants/chat'
;
type
SetShareChatHistoryItem
=
{
historyId
:
string
;
...
...
@@ -57,6 +58,7 @@ const defaultChatData = {
};
const
defaultShareChatData
:
ShareChatType
=
{
maxContext
:
5
,
userAvatar
:
HUMAN_ICON
,
model
:
{
name
:
''
,
avatar
:
'/icon/logo.png'
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment