4.8.20 update (#3706)

* fix: rerank auth token

* feat: check null value

* bind notify

* perf: reasoning config

* Adapt mongo 4.x index
This commit is contained in:
Archer
2025-02-06 14:34:43 +08:00
committed by GitHub
parent 772c1cde77
commit d857a391b3
14 changed files with 61 additions and 30 deletions

View File

@@ -61,6 +61,9 @@ export const getModelFromList = (
model: string
) => {
const modelData = modelList.find((item) => item.model === model) ?? modelList[0];
if (!modelData) {
throw new Error('No Key model is configured');
}
const provider = getModelProvider(modelData.provider);
return {
...modelData,

View File

@@ -63,6 +63,13 @@ export const getMongoModel = <T>(name: string, schema: mongoose.Schema) => {
const model = connectionMongo.model<T>(name, schema);
// Sync index
syncMongoIndex(model);
return model;
};
const syncMongoIndex = async (model: Model<any>) => {
if (process.env.SYNC_INDEX !== '0' && process.env.NODE_ENV !== 'test') {
try {
model.syncIndexes({ background: true });
@@ -70,8 +77,6 @@ export const getMongoModel = <T>(name: string, schema: mongoose.Schema) => {
addLog.error('Create index error', error);
}
}
return model;
};
export const ReadPreference = connectionMongo.mongo.ReadPreference;

View File

@@ -24,7 +24,7 @@ export const aiTranscriptions = async ({
? { url: modelData.requestUrl }
: {
baseURL: aiAxiosConfig.baseUrl,
url: modelData.requestUrl || '/audio/transcriptions'
url: '/audio/transcriptions'
}),
headers: {
Authorization: modelData.requestAuth

View File

@@ -11,7 +11,11 @@ import {
ReRankModelItemType
} from '@fastgpt/global/core/ai/model.d';
import { debounce } from 'lodash';
import { ModelProviderType } from '@fastgpt/global/core/ai/provider';
import {
getModelProvider,
ModelProviderIdType,
ModelProviderType
} from '@fastgpt/global/core/ai/provider';
import { findModelFromAlldata } from '../model';
import {
reloadFastGPTConfigBuffer,
@@ -91,7 +95,7 @@ export const loadSystemModels = async (init = false) => {
await Promise.all(
providerList.map(async (name) => {
const fileContent = (await import(`./provider/${name}`))?.default as {
provider: ModelProviderType;
provider: ModelProviderIdType;
list: SystemModelItemType[];
};
@@ -101,7 +105,7 @@ export const loadSystemModels = async (init = false) => {
const modelData: any = {
...fileModel,
...dbModel?.metadata,
provider: dbModel?.metadata?.provider || fileContent.provider,
provider: getModelProvider(dbModel?.metadata?.provider || fileContent.provider).id,
type: dbModel?.metadata?.type || fileModel.type,
isCustom: false
};

View File

@@ -32,12 +32,14 @@ export async function getVectorsByText({ model, input, type }: GetVectorProps) {
model: model.model,
input: [input]
},
model.requestUrl && model.requestAuth
model.requestUrl
? {
path: model.requestUrl,
headers: {
headers: model.requestAuth
? {
Authorization: `Bearer ${model.requestAuth}`
}
: undefined
}
: {}
)

View File

@@ -26,7 +26,7 @@ export function reRankRecall({
return Promise.reject('no rerank model');
}
const { baseUrl, authorization } = getAxiosConfig({});
const { baseUrl, authorization } = getAxiosConfig();
let start = Date.now();
return POST<PostReRankResponse>(
@@ -38,7 +38,7 @@ export function reRankRecall({
},
{
headers: {
Authorization: model.requestAuth ? model.requestAuth : authorization
Authorization: model.requestAuth ? `Bearer ${model.requestAuth}` : authorization
},
timeout: 30000
}

View File

@@ -37,12 +37,7 @@ try {
{ teamId: 1, datasetId: 1, fullTextToken: 'text' },
{
name: 'teamId_1_datasetId_1_fullTextToken_text',
default_language: 'none',
collation: {
locale: 'simple', // 使用简单匹配规则
strength: 2, // 忽略大小写
caseLevel: false // 进一步确保大小写不敏感
}
default_language: 'none'
}
);
DatasetDataTextSchema.index({ dataId: 1 }, { unique: true });

View File

@@ -49,6 +49,8 @@
"model.output_price": "Output price",
"model.output_price_tip": "The language model output price. If this item is configured, the model comprehensive price will be invalid.",
"model.param_name": "Parameter name",
"model.reasoning": "Support output thinking",
"model.reasoning_tip": "For example, Deepseek-reasoner can output the thinking process.",
"model.request_auth": "Custom key",
"model.request_auth_tip": "When making a request to a custom request address, carry the request header: Authorization: Bearer xxx to make the request.",
"model.request_url": "Custom url",

View File

@@ -49,6 +49,8 @@
"model.output_price": "模型输出价格",
"model.output_price_tip": "语言模型输出价格,如果配置了该项,则模型综合价格会失效",
"model.param_name": "参数名",
"model.reasoning": "支持输出思考",
"model.reasoning_tip": "例如 Deepseek-reasoner可以输出思考过程。",
"model.request_auth": "自定义请求 Key",
"model.request_auth_tip": "向自定义请求地址发起请求时候携带请求头Authorization: Bearer xxx 进行请求",
"model.request_url": "自定义请求地址",

View File

@@ -48,6 +48,8 @@
"model.output_price": "模型輸出價格",
"model.output_price_tip": "語言模型輸出價格,如果配置了該項,則模型綜合價格會失效",
"model.param_name": "參數名",
"model.reasoning": "支持輸出思考",
"model.reasoning_tip": "例如 Deepseek-reasoner可以輸出思考過程。",
"model.request_auth": "自訂請求 Key",
"model.request_auth_tip": "向自訂請求地址發起請求時候攜帶請求頭Authorization: Bearer xxx 進行請求",
"model.request_url": "自訂請求地址",

View File

@@ -1,11 +1,8 @@
### 常见问题
- [**Git 地址**,点击查看项目地址](https://github.com/labring/FastGPT)
- [本地部署 FastGPT](https://doc.tryfastgpt.ai/docs/installation)
- [API 文档](https://doc.tryfastgpt.ai/docs/development/openapi?pre_pathname=%2Fdrive%2Fhome%2F)
- **反馈问卷**: 如果你遇到任何使用问题或有期望的功能,可以[填写该问卷](https://www.wjx.cn/vm/rLIw1uD.aspx#)
- **问题文档**: [先看文档,再提问](https://kjqvjse66l.feishu.cn/docx/HtrgdT0pkonP4kxGx8qcu6XDnGh)
- [点击查看商业版文档](https://doc.tryfastgpt.ai/docs/commercial)
- [点击查看官方文档](https://doc.tryfastgpt.ai/docs/)
- [点击查看商业版文档](https://doc.tryfastgpt.ai/docs/shopping_cart/intro/)
- [计费规则](https://doc.tryfastgpt.ai/docs/pricing/)
**其他问题**

View File

@@ -73,6 +73,8 @@ const Layout = ({ children }: { children: JSX.Element }) => {
const showUpdateNotification =
isUpdateNotification &&
feConfigs?.bind_notification_method &&
feConfigs?.bind_notification_method.length > 0 &&
!userInfo?.team.notificationAccount &&
!!userInfo?.team.permission.isOwner;

View File

@@ -922,6 +922,19 @@ const ModelEditModal = ({
</Flex>
</Td>
</Tr>
<Tr>
<Td>
<HStack spacing={1}>
<Box>{t('account:model.reasoning')}</Box>
<QuestionTip label={t('account:model.reasoning_tip')} />
</HStack>
</Td>
<Td textAlign={'right'}>
<Flex justifyContent={'flex-end'}>
<Switch {...register('reasoning')} />
</Flex>
</Td>
</Tr>
{feConfigs?.isPlus && (
<Tr>
<Td>

View File

@@ -66,9 +66,11 @@ const testLLMModel = async (model: LLMModelItemType) => {
},
{
...(model.requestUrl ? { path: model.requestUrl } : {}),
headers: {
...(model.requestAuth ? { Authorization: `Bearer ${model.requestAuth}` } : {})
headers: model.requestAuth
? {
Authorization: `Bearer ${model.requestAuth}`
}
: undefined
}
);
@@ -98,12 +100,14 @@ const testTTSModel = async (model: TTSModelType) => {
response_format: 'mp3',
speed: 1
},
model.requestUrl && model.requestAuth
model.requestUrl
? {
path: model.requestUrl,
headers: {
headers: model.requestAuth
? {
Authorization: `Bearer ${model.requestAuth}`
}
: undefined
}
: {}
);