mirror of
https://github.com/labring/FastGPT.git
synced 2026-05-07 01:02:55 +08:00
fix: index (#5458)
* doc * fix: home app name * fix: char init error status * fix: index * fix: secret input
This commit is contained in:
@@ -25,6 +25,7 @@ import { secretInputTypeToInputType } from '@/components/core/app/formRender/uti
|
||||
import { getSystemPlugTemplates } from '@/web/core/app/api/plugin';
|
||||
import type { NodeTemplateListItemType } from '@fastgpt/global/core/workflow/type/node';
|
||||
import { useRequest2 } from '@fastgpt/web/hooks/useRequest';
|
||||
import { InputTypeEnum } from '@/components/core/app/formRender/constant';
|
||||
|
||||
export type ToolParamsFormType = {
|
||||
type: SystemToolInputTypeEnum;
|
||||
@@ -262,18 +263,33 @@ const SecretInputModal = ({
|
||||
<Controller
|
||||
control={control}
|
||||
name={inputKey}
|
||||
rules={{ required: item.required }}
|
||||
render={({ field: { onChange, value }, fieldState: { error } }) => (
|
||||
<InputRender
|
||||
inputType={secretInputTypeToInputType(item.inputType)}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
placeholder={item.description}
|
||||
bg={'myGray.50'}
|
||||
list={item.list}
|
||||
isInvalid={!!error}
|
||||
/>
|
||||
)}
|
||||
rules={{
|
||||
required:
|
||||
item.required &&
|
||||
secretInputTypeToInputType(item.inputType) !==
|
||||
InputTypeEnum.switch
|
||||
? true
|
||||
: false,
|
||||
validate:
|
||||
item.required &&
|
||||
secretInputTypeToInputType(item.inputType) ===
|
||||
InputTypeEnum.switch
|
||||
? (value) => value !== undefined && value !== null
|
||||
: undefined
|
||||
}}
|
||||
render={({ field: { onChange, value }, fieldState: { error } }) => {
|
||||
return (
|
||||
<InputRender
|
||||
inputType={secretInputTypeToInputType(item.inputType)}
|
||||
value={value}
|
||||
onChange={onChange}
|
||||
placeholder={item.description}
|
||||
bg={'myGray.50'}
|
||||
list={item.list}
|
||||
isInvalid={!!error}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
@@ -217,7 +217,7 @@ const HomeChatWindow = ({ myApps }: Props) => {
|
||||
variables,
|
||||
responseChatItemId,
|
||||
appId,
|
||||
appName: t('chat:home.chat_app', { name: 'FastGPT' }),
|
||||
appName: t('chat:home.chat_app'),
|
||||
chatId,
|
||||
...form2AppWorkflow(formData, t)
|
||||
},
|
||||
|
||||
@@ -62,8 +62,8 @@ async function handler(
|
||||
}
|
||||
|
||||
async function processChatRecord(chat: ChatSchemaType) {
|
||||
async function calculateChatItemStats(chatId: string) {
|
||||
const chatItems = await MongoChatItem.find({ chatId }).lean();
|
||||
async function calculateChatItemStats() {
|
||||
const chatItems = await MongoChatItem.find({ appId: chat.appId, chatId: chat.chatId }).lean();
|
||||
|
||||
let chatItemCount = chatItems.length;
|
||||
let errorCount = 0;
|
||||
@@ -122,21 +122,21 @@ async function processChatRecord(chat: ChatSchemaType) {
|
||||
};
|
||||
}
|
||||
|
||||
async function checkIsFirstChat(chat: any): Promise<boolean> {
|
||||
async function checkIsFirstChat(): Promise<boolean> {
|
||||
const earliestChat = await MongoChat.findOne(
|
||||
{
|
||||
userId: chat.userId,
|
||||
appId: chat.appId
|
||||
appId: chat.appId,
|
||||
tmbId: chat.tmbId,
|
||||
...(chat.outLinkUid && { outLinkUid: chat.outLinkUid })
|
||||
},
|
||||
{},
|
||||
{ sort: { createTime: 1 } }
|
||||
'_id'
|
||||
).lean();
|
||||
|
||||
return earliestChat?._id.toString() === chat._id.toString();
|
||||
}
|
||||
|
||||
const chatItemStats = await calculateChatItemStats(chat.chatId);
|
||||
const isFirstChat = await checkIsFirstChat(chat);
|
||||
const chatItemStats = await calculateChatItemStats();
|
||||
const isFirstChat = await checkIsFirstChat();
|
||||
|
||||
const chatLogData = {
|
||||
appId: chat.appId,
|
||||
|
||||
@@ -152,12 +152,12 @@ export const pushQuestionGuideUsage = ({
|
||||
createUsage({
|
||||
teamId,
|
||||
tmbId,
|
||||
appName: 'core.app.Question Guide',
|
||||
appName: i18nT('common:core.app.Question Guide'),
|
||||
totalPoints,
|
||||
source: UsageSourceEnum.fastgpt,
|
||||
list: [
|
||||
{
|
||||
moduleName: 'core.app.Question Guide',
|
||||
moduleName: i18nT('common:core.app.Question Guide'),
|
||||
amount: totalPoints,
|
||||
model: modelName,
|
||||
inputTokens,
|
||||
|
||||
@@ -77,8 +77,6 @@ const ChatRecordContextProvider = ({
|
||||
scrollToBottom();
|
||||
}
|
||||
|
||||
setIsChatRecordsLoaded(true);
|
||||
|
||||
return {
|
||||
...res,
|
||||
list: res.list.map((item) => ({
|
||||
@@ -93,7 +91,10 @@ const ChatRecordContextProvider = ({
|
||||
refreshDeps: [params],
|
||||
params,
|
||||
scrollLoadType: 'top',
|
||||
showErrorToast: false
|
||||
showErrorToast: false,
|
||||
onFinally() {
|
||||
setIsChatRecordsLoaded(true);
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user