mirror of
https://github.com/labring/FastGPT.git
synced 2025-07-24 13:53:50 +00:00
fix: share page data;Adapt findLastIndex api (#3147)
* perf: share page data * perf: adapt findLastIndex
This commit is contained in:
@@ -78,11 +78,15 @@ export const getHistoryPreview = (
|
||||
};
|
||||
|
||||
export const filterPublicNodeResponseData = ({
|
||||
flowResponses = []
|
||||
flowResponses = [],
|
||||
responseDetail = false
|
||||
}: {
|
||||
flowResponses?: ChatHistoryItemResType[];
|
||||
responseDetail?: boolean;
|
||||
}) => {
|
||||
const filedList = ['quoteList', 'moduleType', 'pluginOutput', 'runningTime'];
|
||||
const filedList = responseDetail
|
||||
? ['quoteList', 'moduleType', 'pluginOutput', 'runningTime']
|
||||
: ['moduleType', 'pluginOutput', 'runningTime'];
|
||||
const filterModuleTypeList: any[] = [
|
||||
FlowNodeTypeEnum.pluginModule,
|
||||
FlowNodeTypeEnum.datasetSearchNode,
|
||||
|
@@ -65,6 +65,18 @@ export async function dispatchDatasetSearch(
|
||||
}
|
||||
|
||||
if (!userChatInput) {
|
||||
return {
|
||||
quoteQA: [],
|
||||
[DispatchNodeResponseKeyEnum.nodeResponse]: {
|
||||
totalPoints: 0,
|
||||
query: '',
|
||||
limit,
|
||||
searchMode
|
||||
},
|
||||
nodeDispatchUsages: [],
|
||||
[DispatchNodeResponseKeyEnum.toolResponses]: []
|
||||
};
|
||||
|
||||
return Promise.reject(i18nT('common:core.chat.error.User input empty'));
|
||||
}
|
||||
|
||||
|
@@ -11,11 +11,14 @@ export const useWidthVariable = <T = any>({
|
||||
}) => {
|
||||
const value = useMemo(() => {
|
||||
// 根据 width 计算,找到第一个大于 width 的值
|
||||
const index = widthList.findLastIndex((item) => width > item);
|
||||
const reversedWidthList = [...widthList].reverse();
|
||||
const reversedList = [...list].reverse();
|
||||
const index = reversedWidthList.findIndex((item) => width > item);
|
||||
|
||||
if (index === -1) {
|
||||
return list[0];
|
||||
return reversedList[0];
|
||||
}
|
||||
return list[index];
|
||||
return reversedList[index];
|
||||
}, [list, width, widthList]);
|
||||
|
||||
return value;
|
||||
|
Reference in New Issue
Block a user