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
0a4a1def
authored
Sep 19, 2023
by
Archer
Committed by
GitHub
Sep 19, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: connected error (#318)
parent
35f4deca
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
16 additions
and
18 deletions
+16
-18
client/pnpm-lock.yaml
+0
-0
client/src/components/ChatBox/index.tsx
+1
-0
client/src/constants/flow/ModuleTemplate.ts
+2
-1
client/src/pages/app/detail/components/AdEdit/index.tsx
+1
-1
client/src/service/moduleDispatch/chat/oneapi.ts
+5
-9
client/src/service/response.ts
+2
-2
client/src/utils/file.ts
+4
-4
docSite/content/docs/installation/upgrading/442.md
+1
-1
No files found.
client/pnpm-lock.yaml
View file @
0a4a1def
This diff is collapsed.
Click to expand it.
client/src/components/ChatBox/index.tsx
View file @
0a4a1def
...
@@ -665,6 +665,7 @@ const ChatBox = (
...
@@ -665,6 +665,7 @@ const ChatBox = (
{
...
MessageCardStyle
}
{
...
MessageCardStyle
}
bg=
{
'myBlue.300'
}
bg=
{
'myBlue.300'
}
borderRadius=
{
'8px 0 8px 8px'
}
borderRadius=
{
'8px 0 8px 8px'
}
textAlign=
{
'left'
}
>
>
<
Box
as=
{
'p'
}
>
{
item
.
value
}
</
Box
>
<
Box
as=
{
'p'
}
>
{
item
.
value
}
</
Box
>
</
Card
>
</
Card
>
...
...
client/src/constants/flow/ModuleTemplate.ts
View file @
0a4a1def
...
@@ -182,7 +182,8 @@ export const ChatModule: FlowModuleTemplateType = {
...
@@ -182,7 +182,8 @@ export const ChatModule: FlowModuleTemplateType = {
type: FlowInputItemTypeEnum.custom,
type: FlowInputItemTypeEnum.custom,
label: '引用内容',
label: '引用内容',
description: "对象数组格式,结构:\n [{q:'问题',a:'回答'}]",
description: "对象数组格式,结构:\n [{q:'问题',a:'回答'}]",
valueType: FlowValueTypeEnum.kbQuote
valueType: FlowValueTypeEnum.kbQuote,
connected: false
},
},
Input_Template_History,
Input_Template_History,
Input_Template_UserChatInput
Input_Template_UserChatInput
...
...
client/src/pages/app/detail/components/AdEdit/index.tsx
View file @
0a4a1def
...
@@ -238,7 +238,7 @@ const AppEdit = ({ app, onCloseSettings }: Props) => {
...
@@ -238,7 +238,7 @@ const AppEdit = ({ app, onCloseSettings }: Props) => {
position
:
item
.
position
,
position
:
item
.
position
,
inputs
:
item
.
data
.
inputs
.
map
((
item
)
=>
({
inputs
:
item
.
data
.
inputs
.
map
((
item
)
=>
({
...
item
,
...
item
,
connected
:
item
.
type
!==
FlowInputItemTypeEnum
.
target
connected
:
item
.
connected
??
item
.
type
!==
FlowInputItemTypeEnum
.
target
})),
})),
outputs
:
item
.
data
.
outputs
.
map
((
item
)
=>
({
outputs
:
item
.
data
.
outputs
.
map
((
item
)
=>
({
...
item
,
...
item
,
...
...
client/src/service/moduleDispatch/chat/oneapi.ts
View file @
0a4a1def
...
@@ -69,7 +69,7 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
...
@@ -69,7 +69,7 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
return
Promise
.
reject
(
'The chat model is undefined, you need to select a chat model.'
);
return
Promise
.
reject
(
'The chat model is undefined, you need to select a chat model.'
);
}
}
const
{
filterQuoteQA
,
quoteText
,
hasQuoteOutput
}
=
filterQuote
({
const
{
filterQuoteQA
,
quoteText
}
=
filterQuote
({
quoteQA
,
quoteQA
,
model
:
modelConstantsData
,
model
:
modelConstantsData
,
quoteTemplate
quoteTemplate
...
@@ -91,8 +91,7 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
...
@@ -91,8 +91,7 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
quotePrompt
,
quotePrompt
,
userChatInput
,
userChatInput
,
systemPrompt
,
systemPrompt
,
limitPrompt
,
limitPrompt
hasQuoteOutput
});
});
const
{
max_tokens
}
=
getMaxTokens
({
const
{
max_tokens
}
=
getMaxTokens
({
model
:
modelConstantsData
,
model
:
modelConstantsData
,
...
@@ -219,8 +218,7 @@ function filterQuote({
...
@@ -219,8 +218,7 @@ function filterQuote({
return
{
return
{
filterQuoteQA
,
filterQuoteQA
,
quoteText
,
quoteText
hasQuoteOutput
:
!!
filterQuoteQA
.
find
((
item
)
=>
item
.
a
)
};
};
}
}
function
getChatMessages
({
function
getChatMessages
({
...
@@ -230,8 +228,7 @@ function getChatMessages({
...
@@ -230,8 +228,7 @@ function getChatMessages({
systemPrompt
,
systemPrompt
,
limitPrompt
,
limitPrompt
,
userChatInput
,
userChatInput
,
model
,
model
hasQuoteOutput
}:
{
}:
{
quotePrompt
?:
string
;
quotePrompt
?:
string
;
quoteText
:
string
;
quoteText
:
string
;
...
@@ -240,9 +237,8 @@ function getChatMessages({
...
@@ -240,9 +237,8 @@ function getChatMessages({
limitPrompt
?:
string
;
limitPrompt
?:
string
;
userChatInput
:
string
;
userChatInput
:
string
;
model
:
ChatModelItemType
;
model
:
ChatModelItemType
;
hasQuoteOutput
:
boolean
;
})
{
})
{
const
question
=
hasQuoteOutpu
t
const
question
=
quoteTex
t
?
replaceVariable
(
quotePrompt
||
defaultQuotePrompt
,
{
?
replaceVariable
(
quotePrompt
||
defaultQuotePrompt
,
{
quote
:
quoteText
,
quote
:
quoteText
,
question
:
userChatInput
question
:
userChatInput
...
...
client/src/service/response.ts
View file @
0a4a1def
...
@@ -38,7 +38,7 @@ export const jsonRes = <T = any>(
...
@@ -38,7 +38,7 @@ export const jsonRes = <T = any>(
}
}
// another error
// another error
let
msg
=
message
||
error
?.
message
;
let
msg
=
error
?.
response
?.
statusText
||
error
?.
message
||
'请求错误'
;
if
((
code
<
200
||
code
>=
400
)
&&
!
message
)
{
if
((
code
<
200
||
code
>=
400
)
&&
!
message
)
{
msg
=
error
?.
message
||
'请求错误'
;
msg
=
error
?.
message
||
'请求错误'
;
if
(
typeof
error
===
'string'
)
{
if
(
typeof
error
===
'string'
)
{
...
@@ -81,7 +81,7 @@ export const sseErrRes = (res: NextApiResponse, error: any) => {
...
@@ -81,7 +81,7 @@ export const sseErrRes = (res: NextApiResponse, error: any) => {
});
});
}
}
let
msg
=
error
?.
message
||
'请求错误'
;
let
msg
=
error
?.
response
?.
statusText
||
error
?.
message
||
'请求错误'
;
if
(
typeof
error
===
'string'
)
{
if
(
typeof
error
===
'string'
)
{
msg
=
error
;
msg
=
error
;
}
else
if
(
proxyError
[
error
?.
code
])
{
}
else
if
(
proxyError
[
error
?.
code
])
{
...
...
client/src/utils/file.ts
View file @
0a4a1def
...
@@ -135,13 +135,13 @@ export const readDocContent = (file: File) =>
...
@@ -135,13 +135,13 @@ export const readDocContent = (file: File) =>
export
const
readCsvContent
=
async
(
file
:
File
)
=>
{
export
const
readCsvContent
=
async
(
file
:
File
)
=>
{
try
{
try
{
const
textArr
=
await
readTxtContent
(
file
);
const
textArr
=
await
readTxtContent
(
file
);
const
json
=
Papa
.
parse
(
textArr
).
data
as
string
[][];
const
csvArr
=
Papa
.
parse
(
textArr
).
data
as
string
[][];
if
(
json
.
length
===
0
)
{
if
(
csvArr
.
length
===
0
)
{
throw
new
Error
(
'csv 解析失败'
);
throw
new
Error
(
'csv 解析失败'
);
}
}
return
{
return
{
header
:
json
.
shift
()?.
filter
((
item
)
=>
item
)
as
string
[],
header
:
csvArr
.
shift
(
)
as
string
[],
data
:
json
.
map
((
item
)
=>
item
?.
filter
((
item
)
=>
item
)
)
data
:
csvArr
.
map
((
item
)
=>
item
)
};
};
}
catch
(
error
)
{
}
catch
(
error
)
{
return
Promise
.
reject
(
'解析 csv 文件失败'
);
return
Promise
.
reject
(
'解析 csv 文件失败'
);
...
...
docSite/content/docs/installation/upgrading/442.md
View file @
0a4a1def
...
@@ -4,7 +4,7 @@ description: 'FastGPT 从旧版本升级到 V4.4.2 操作指南'
...
@@ -4,7 +4,7 @@ description: 'FastGPT 从旧版本升级到 V4.4.2 操作指南'
icon
:
'
upgrade'
icon
:
'
upgrade'
draft
:
false
draft
:
false
toc
:
true
toc
:
true
weight
:
99
4
weight
:
99
3
---
---
## 执行初始化 API
## 执行初始化 API
...
...
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