4.8.21 feature (#3720)
* agent search demo * edit form force close image select * feat: llm params and doubao1.5 * perf: model error tip * fix: template register path * package
This commit is contained in:
@@ -16,6 +16,7 @@ import { reRankRecall } from '@fastgpt/service/core/ai/rerank';
|
||||
import { aiTranscriptions } from '@fastgpt/service/core/ai/audio/transcriptions';
|
||||
import { isProduction } from '@fastgpt/global/common/system/constants';
|
||||
import * as fs from 'fs';
|
||||
import { llmCompletionsBodyFormat } from '@fastgpt/service/core/ai/utils';
|
||||
|
||||
export type testQuery = { model: string };
|
||||
|
||||
@@ -57,22 +58,23 @@ export default NextAPI(handler);
|
||||
|
||||
const testLLMModel = async (model: LLMModelItemType) => {
|
||||
const ai = getAIApi({});
|
||||
const response = await ai.chat.completions.create(
|
||||
const requestBody = llmCompletionsBodyFormat(
|
||||
{
|
||||
model: model.model,
|
||||
messages: [{ role: 'user', content: 'hi' }],
|
||||
stream: false,
|
||||
max_tokens: 10
|
||||
},
|
||||
{
|
||||
...(model.requestUrl ? { path: model.requestUrl } : {}),
|
||||
headers: model.requestAuth
|
||||
? {
|
||||
Authorization: `Bearer ${model.requestAuth}`
|
||||
}
|
||||
: undefined
|
||||
}
|
||||
model
|
||||
);
|
||||
const response = await ai.chat.completions.create(requestBody, {
|
||||
...(model.requestUrl ? { path: model.requestUrl } : {}),
|
||||
headers: model.requestAuth
|
||||
? {
|
||||
Authorization: `Bearer ${model.requestAuth}`
|
||||
}
|
||||
: undefined
|
||||
});
|
||||
|
||||
const responseText = response.choices?.[0]?.message?.content;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import { NextAPI } from '@/service/middleware/entry';
|
||||
import { ReadPermissionVal } from '@fastgpt/global/support/permission/constant';
|
||||
import { CommonErrEnum } from '@fastgpt/global/common/error/code/common';
|
||||
import { useIPFrequencyLimit } from '@fastgpt/service/common/middle/reqFrequencyLimit';
|
||||
import { agentSearchDatasetData } from '@fastgpt/service/core/dataset/search/agent';
|
||||
|
||||
async function handler(req: NextApiRequest) {
|
||||
const {
|
||||
@@ -59,6 +60,7 @@ async function handler(req: NextApiRequest) {
|
||||
});
|
||||
|
||||
const { searchRes, tokens, ...result } = await searchDatasetData({
|
||||
histories: [],
|
||||
teamId,
|
||||
reRankQuery: rewriteQuery,
|
||||
queries: concatQueries,
|
||||
|
||||
Reference in New Issue
Block a user