Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 45 additions & 12 deletions client/pnpm-lock.yaml

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions client/src/components/ChatBox/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -665,6 +665,7 @@ const ChatBox = (
{...MessageCardStyle}
bg={'myBlue.300'}
borderRadius={'8px 0 8px 8px'}
textAlign={'left'}
>
<Box as={'p'}>{item.value}</Box>
</Card>
Expand Down
3 changes: 2 additions & 1 deletion client/src/constants/flow/ModuleTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,8 @@ export const ChatModule: FlowModuleTemplateType = {
type: FlowInputItemTypeEnum.custom,
label: '引用内容',
description: "对象数组格式,结构:\n [{q:'问题',a:'回答'}]",
valueType: FlowValueTypeEnum.kbQuote
valueType: FlowValueTypeEnum.kbQuote,
connected: false
},
Input_Template_History,
Input_Template_UserChatInput
Expand Down
2 changes: 1 addition & 1 deletion client/src/pages/app/detail/components/AdEdit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ const AppEdit = ({ app, onCloseSettings }: Props) => {
position: item.position,
inputs: item.data.inputs.map((item) => ({
...item,
connected: item.type !== FlowInputItemTypeEnum.target
connected: item.connected ?? item.type !== FlowInputItemTypeEnum.target
})),
outputs: item.data.outputs.map((item) => ({
...item,
Expand Down
14 changes: 5 additions & 9 deletions client/src/service/moduleDispatch/chat/oneapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
}

const { filterQuoteQA, quoteText, hasQuoteOutput } = filterQuote({
const { filterQuoteQA, quoteText } = filterQuote({
quoteQA,
model: modelConstantsData,
quoteTemplate
Expand All @@ -91,8 +91,7 @@ export const dispatchChatCompletion = async (props: Record<string, any>): Promis
quotePrompt,
userChatInput,
systemPrompt,
limitPrompt,
hasQuoteOutput
limitPrompt
});
const { max_tokens } = getMaxTokens({
model: modelConstantsData,
Expand Down Expand Up @@ -219,8 +218,7 @@ function filterQuote({

return {
filterQuoteQA,
quoteText,
hasQuoteOutput: !!filterQuoteQA.find((item) => item.a)
quoteText
};
}
function getChatMessages({
Expand All @@ -230,8 +228,7 @@ function getChatMessages({
systemPrompt,
limitPrompt,
userChatInput,
model,
hasQuoteOutput
model
}: {
quotePrompt?: string;
quoteText: string;
Expand All @@ -240,9 +237,8 @@ function getChatMessages({
limitPrompt?: string;
userChatInput: string;
model: ChatModelItemType;
hasQuoteOutput: boolean;
}) {
const question = hasQuoteOutput
const question = quoteText
? replaceVariable(quotePrompt || defaultQuotePrompt, {
quote: quoteText,
question: userChatInput
Expand Down
4 changes: 2 additions & 2 deletions client/src/service/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const jsonRes = <T = any>(
}

// another error
let msg = message || error?.message;
let msg = error?.response?.statusText || error?.message || '请求错误';
if ((code < 200 || code >= 400) && !message) {
msg = error?.message || '请求错误';
if (typeof error === 'string') {
Expand Down Expand Up @@ -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') {
msg = error;
} else if (proxyError[error?.code]) {
Expand Down
8 changes: 4 additions & 4 deletions client/src/utils/file.ts
Original file line number Diff line number Diff line change
Expand Up @@ -135,13 +135,13 @@ export const readDocContent = (file: File) =>
export const readCsvContent = async (file: File) => {
try {
const textArr = await readTxtContent(file);
const json = Papa.parse(textArr).data as string[][];
if (json.length === 0) {
const csvArr = Papa.parse(textArr).data as string[][];
if (csvArr.length === 0) {
throw new Error('csv 解析失败');
}
return {
header: json.shift()?.filter((item) => item) as string[],
data: json.map((item) => item?.filter((item) => item))
header: csvArr.shift() as string[],
data: csvArr.map((item) => item)
};
} catch (error) {
return Promise.reject('解析 csv 文件失败');
Expand Down
2 changes: 1 addition & 1 deletion docSite/content/docs/installation/upgrading/442.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: 'FastGPT 从旧版本升级到 V4.4.2 操作指南'
icon: 'upgrade'
draft: false
toc: true
weight: 994
weight: 993
---

## 执行初始化 API
Expand Down