mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-22 20:37:48 +00:00
@@ -49,3 +49,4 @@ weight: 810
|
|||||||
17. 修复 - 反选知识库引用后可能会报错。
|
17. 修复 - 反选知识库引用后可能会报错。
|
||||||
18. 修复 - 简易模式转工作流,不是使用最新编辑记录进行转移。
|
18. 修复 - 简易模式转工作流,不是使用最新编辑记录进行转移。
|
||||||
19. 修复 - 表单输入的说明文字不显示。
|
19. 修复 - 表单输入的说明文字不显示。
|
||||||
|
20. 修复 - API 无法使用 base64 图片。
|
||||||
|
@@ -23,6 +23,11 @@ export const parseUrlToFileType = (url: string): UserChatItemValueItemType['file
|
|||||||
const parseUrl = new URL(url, 'https://locaohost:3000');
|
const parseUrl = new URL(url, 'https://locaohost:3000');
|
||||||
|
|
||||||
const filename = (() => {
|
const filename = (() => {
|
||||||
|
// Check base64 image
|
||||||
|
if (url.startsWith('data:image/')) {
|
||||||
|
const mime = url.split(',')[0].split(':')[1].split(';')[0];
|
||||||
|
return `image.${mime.split('/')[1]}`;
|
||||||
|
}
|
||||||
// Old version file url: https://xxx.com/file/read?filename=xxx.pdf
|
// Old version file url: https://xxx.com/file/read?filename=xxx.pdf
|
||||||
const filenameQuery = parseUrl.searchParams.get('filename');
|
const filenameQuery = parseUrl.searchParams.get('filename');
|
||||||
if (filenameQuery) return filenameQuery;
|
if (filenameQuery) return filenameQuery;
|
||||||
|
@@ -118,6 +118,11 @@ export const loadRequestMessages = async ({
|
|||||||
return item.image_url.url;
|
return item.image_url.url;
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
// base64 image
|
||||||
|
if (imgUrl.startsWith('data:image/')) {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// If imgUrl is a local path, load image from local, and set url to base64
|
// If imgUrl is a local path, load image from local, and set url to base64
|
||||||
if (imgUrl.startsWith('/')) {
|
if (imgUrl.startsWith('/')) {
|
||||||
|
@@ -129,7 +129,11 @@ export const valueTypeFormat = (value: any, type?: WorkflowIOValueTypeEnum) => {
|
|||||||
return value;
|
return value;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const checkQuoteQAValue = (quoteQA: SearchDataResponseItemType[] = []) => {
|
export const checkQuoteQAValue = (quoteQA?: SearchDataResponseItemType[]) => {
|
||||||
|
if (!quoteQA) return undefined;
|
||||||
|
if (quoteQA.length === 0) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
if (quoteQA.some((item) => !item.q || !item.datasetId)) {
|
if (quoteQA.some((item) => !item.q || !item.datasetId)) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
@@ -199,6 +199,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// save chat
|
// save chat
|
||||||
|
if (!res.closed) {
|
||||||
const isInteractiveRequest = !!getLastInteractiveValue(histories);
|
const isInteractiveRequest = !!getLastInteractiveValue(histories);
|
||||||
const { text: userInteractiveVal } = chatValue2RuntimePrompt(userQuestion.value);
|
const { text: userInteractiveVal } = chatValue2RuntimePrompt(userQuestion.value);
|
||||||
|
|
||||||
@@ -236,6 +237,7 @@ async function handler(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
content: [userQuestion, aiResponse]
|
content: [userQuestion, aiResponse]
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pushChatUsage({
|
pushChatUsage({
|
||||||
appName,
|
appName,
|
||||||
|
Reference in New Issue
Block a user