Commit 463b02d1 by Archer Committed by GitHub

perf log (#6107)

* perf: html2md

* perf: index

* Add model log

* update next version

* log index
parent abc2b6d2
......@@ -116,6 +116,7 @@ description: FastGPT 文档目录
- [/docs/upgrading/4-14/4142](/docs/upgrading/4-14/4142)
- [/docs/upgrading/4-14/4143](/docs/upgrading/4-14/4143)
- [/docs/upgrading/4-14/4144](/docs/upgrading/4-14/4144)
- [/docs/upgrading/4-14/4145](/docs/upgrading/4-14/4145)
- [/docs/upgrading/4-8/40](/docs/upgrading/4-8/40)
- [/docs/upgrading/4-8/41](/docs/upgrading/4-8/41)
- [/docs/upgrading/4-8/42](/docs/upgrading/4-8/42)
......
---
title: 'V4.14.5(进行中)'
description: 'FastGPT V4.14.5 更新说明'
---
## 🚀 新增内容
## ⚙️ 优化
## 🐛 修复
1. MCP 工具创建时,使用自定义鉴权头会报错。
## 插件
{
"title": "4.14.x",
"description": "",
"pages": ["4144", "4143", "4142", "4141", "4140"]
"pages": ["4145", "4144", "4143", "4142", "4141", "4140"]
}
......@@ -119,7 +119,7 @@
"document/content/docs/upgrading/4-14/4141.mdx": "2025-11-19T10:15:27+08:00",
"document/content/docs/upgrading/4-14/4142.mdx": "2025-11-18T19:27:14+08:00",
"document/content/docs/upgrading/4-14/4143.mdx": "2025-11-26T20:52:05+08:00",
"document/content/docs/upgrading/4-14/4144.mdx": "2025-12-16T01:50:09+08:00",
"document/content/docs/upgrading/4-14/4144.mdx": "2025-12-16T14:56:04+08:00",
"document/content/docs/upgrading/4-8/40.mdx": "2025-08-02T19:38:37+08:00",
"document/content/docs/upgrading/4-8/41.mdx": "2025-08-02T19:38:37+08:00",
"document/content/docs/upgrading/4-8/42.mdx": "2025-08-02T19:38:37+08:00",
......
......@@ -13,7 +13,7 @@
"jschardet": "3.1.1",
"json5": "^2.2.3",
"nanoid": "^5.1.3",
"next": "14.2.32",
"next": "14.2.35",
"openai": "4.61.0",
"openapi-types": "^12.1.3",
"timezones-list": "^3.0.2",
......
......@@ -63,9 +63,7 @@ export const teamFrequencyLimit = async ({
if (currentCount > limit) {
const remainingTime = await redis.ttl(key);
addLog.info(
`[Completion Limit] Team ${teamId} reached the limit of ${limit} requests per ${seconds} seconds. Remaining time: ${remainingTime} seconds.`
);
addLog.info(`[Completion Limit] Over qpm limit`, { teamId, currentCount, limit });
jsonRes(res, {
code: 429,
error: `Rate limit exceeded. Maximum ${limit} requests per ${seconds} seconds for this team. Please try again in ${remainingTime} seconds.`
......
import { simpleMarkdownText } from '@fastgpt/global/common/string/markdown';
import { WorkerNameEnum, runWorker } from '../../worker/utils';
import { type ImageType } from '../../worker/readFile/type';
......@@ -8,5 +7,5 @@ export const htmlToMarkdown = async (html?: string | null) => {
imageList: ImageType[];
}>(WorkerNameEnum.htmlStr2Md, { html: html || '' });
return simpleMarkdownText(md.rawText);
return md.rawText;
};
......@@ -150,6 +150,7 @@ export const addLog = {
},
error(msg: string, error?: any) {
this.log(LogLevelEnum.error, msg, {
...(error?.data && { data: error?.data }),
message: error?.message || error,
stack: error?.stack,
...(error?.config && {
......
......@@ -59,13 +59,17 @@ export async function getVectorsByText({ model, input, type, headers }: GetVecto
)
.then(async (res) => {
if (!res.data) {
addLog.error('Embedding API is not responding', res);
addLog.error('[Embedding] API is not responding', res);
return Promise.reject('Embedding API is not responding');
}
if (!res?.data?.[0]?.embedding) {
console.log(res);
// @ts-ignore
return Promise.reject(res.data?.err?.message || 'Embedding API Error');
const msg = res.data?.err?.message || 'Embedding API Error';
addLog.error('[Embedding] API Error', {
message: msg,
data: res
});
return Promise.reject(msg);
}
const [tokens, vectors] = await Promise.all([
......@@ -93,7 +97,7 @@ export async function getVectorsByText({ model, input, type, headers }: GetVecto
vectors: allVectors
};
} catch (error) {
addLog.error(`Embedding Error`, error);
addLog.error(`[Embedding] request error`, error);
return Promise.reject(error);
}
......
......@@ -35,7 +35,7 @@ export function reRankRecall({
headers?: Record<string, string>;
}): Promise<ReRankCallResult> {
if (!model) {
return Promise.reject('no rerank model');
return Promise.reject('[Rerank] No rerank model');
}
if (documents.length === 0) {
return Promise.resolve({
......@@ -67,7 +67,7 @@ export function reRankRecall({
addLog.info('ReRank finish:', { time: Date.now() - start });
if (!data?.results || data?.results?.length === 0) {
addLog.error('ReRank error, empty result', data);
addLog.error('[Rerank] Empty result', { data });
}
return {
......@@ -81,7 +81,7 @@ export function reRankRecall({
};
})
.catch((err) => {
addLog.error('rerank error', err);
addLog.error('[Rerank] request error', err);
return Promise.reject(err);
});
......
......@@ -75,6 +75,9 @@ ChatLogSchema.index({ isFirstChat: 1, teamId: 1, appId: 1, source: 1, createTime
// Get userStats
ChatLogSchema.index({ teamId: 1, appId: 1, userId: 1 });
// Admin get chat form data - optimized for aggregation with appId/chatId grouping
ChatLogSchema.index({ createTime: -1, appId: 1, chatId: 1 });
// Init shell
ChatLogSchema.index({ teamId: 1, appId: 1, chatId: 1 });
......
......@@ -99,7 +99,4 @@ ChatItemSchema.index({ appId: 1, chatId: 1, _id: -1 });
// timer, clear history
ChatItemSchema.index({ teamId: 1, time: -1 });
// Admin charts
ChatItemSchema.index({ obj: 1, time: -1 }, { partialFilterExpression: { obj: 'Human' } });
export const MongoChatItem = getMongoModel<ChatItemType>(ChatItemCollectionName, ChatItemSchema);
......@@ -42,7 +42,7 @@
"mongoose": "^8.10.1",
"multer": "2.0.2",
"mysql2": "^3.11.3",
"next": "14.2.32",
"next": "14.2.35",
"nextjs-cors": "^2.2.0",
"node-cron": "^3.0.3",
"node-xlsx": "^0.24.0",
......
import TurndownService from 'turndown';
import { type ImageType } from '../readFile/type';
import { getNanoid } from '@fastgpt/global/common/string/tools';
import { simpleMarkdownText } from '@fastgpt/global/common/string/markdown';
// @ts-ignore
const turndownPluginGfm = require('joplin-turndown-plugin-gfm');
......@@ -78,7 +79,7 @@ export const html2md = (
// const { text, imageList } = matchMdImg(md);
return {
rawText: md,
rawText: simpleMarkdownText(md),
imageList: images
};
} catch (error) {
......
......@@ -25,7 +25,7 @@
"ahooks": "^3.9.5",
"date-fns": "2.30.0",
"dayjs": "^1.11.7",
"next": "14.2.32",
"next": "14.2.35",
"i18next": "23.16.8",
"js-cookie": "^3.0.5",
"lexical": "0.12.6",
......
......@@ -48,7 +48,7 @@
"mermaid": "^10.9.4",
"minio": "^8.0.5",
"nanoid": "^5.1.3",
"next": "14.2.32",
"next": "14.2.35",
"next-i18next": "15.4.2",
"nprogress": "^0.2.0",
"p-limit": "^7.2.0",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment