fix: rerank model cannot use ai proxy (#3945)
* fix: collection list count * fix: collection list count * fix: rerank model cannot use ai proxy * mongo init
This commit is contained in:
parent
4bc7f21182
commit
efac5312b4
@ -16,16 +16,30 @@ export async function connectMongo(): Promise<Mongoose> {
|
|||||||
|
|
||||||
console.log('mongo start connect');
|
console.log('mongo start connect');
|
||||||
try {
|
try {
|
||||||
|
// Remove existing listeners to prevent duplicates
|
||||||
|
connectionMongo.connection.removeAllListeners('error');
|
||||||
|
connectionMongo.connection.removeAllListeners('disconnected');
|
||||||
connectionMongo.set('strictQuery', false);
|
connectionMongo.set('strictQuery', false);
|
||||||
|
|
||||||
connectionMongo.connection.on('error', async (error) => {
|
connectionMongo.connection.on('error', async (error) => {
|
||||||
console.log('mongo error', error);
|
console.log('mongo error', error);
|
||||||
await connectionMongo.disconnect();
|
try {
|
||||||
await delay(1000);
|
if (connectionMongo.connection.readyState !== 0) {
|
||||||
connectMongo();
|
await connectionMongo.disconnect();
|
||||||
|
await delay(1000);
|
||||||
|
await connectMongo();
|
||||||
|
}
|
||||||
|
} catch (error) {}
|
||||||
});
|
});
|
||||||
connectionMongo.connection.on('disconnected', () => {
|
connectionMongo.connection.on('disconnected', async () => {
|
||||||
console.log('mongo disconnected');
|
console.log('mongo disconnected');
|
||||||
|
try {
|
||||||
|
if (connectionMongo.connection.readyState !== 0) {
|
||||||
|
await connectionMongo.disconnect();
|
||||||
|
await delay(1000);
|
||||||
|
await connectMongo();
|
||||||
|
}
|
||||||
|
} catch (error) {}
|
||||||
});
|
});
|
||||||
|
|
||||||
await connectionMongo.connect(process.env.MONGODB_URI as string, {
|
await connectionMongo.connect(process.env.MONGODB_URI as string, {
|
||||||
|
|||||||
@ -35,7 +35,7 @@ export const getAxiosConfig = (props?: { userKey?: OpenaiAccountType }) => {
|
|||||||
const { userKey } = props || {};
|
const { userKey } = props || {};
|
||||||
|
|
||||||
const baseUrl = userKey?.baseUrl || global?.systemEnv?.oneapiUrl || openaiBaseUrl;
|
const baseUrl = userKey?.baseUrl || global?.systemEnv?.oneapiUrl || openaiBaseUrl;
|
||||||
const apiKey = userKey?.key || global?.systemEnv?.chatApiKey || process.env.CHAT_API_KEY || '';
|
const apiKey = userKey?.key || global?.systemEnv?.chatApiKey || openaiBaseKey;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
baseUrl,
|
baseUrl,
|
||||||
|
|||||||
@ -1,4 +1,10 @@
|
|||||||
{
|
{
|
||||||
"provider": "AliCloud",
|
"provider": "AliCloud",
|
||||||
"list": []
|
"list": [
|
||||||
|
{
|
||||||
|
"model": "SenseVoiceSmall",
|
||||||
|
"name": "SenseVoiceSmall",
|
||||||
|
"type": "stt"
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
@ -24,6 +24,7 @@
|
|||||||
"key_type": "API key format:",
|
"key_type": "API key format:",
|
||||||
"log": "Call log",
|
"log": "Call log",
|
||||||
"log_detail": "Log details",
|
"log_detail": "Log details",
|
||||||
|
"log_request_id_search": "Search by requestId",
|
||||||
"log_status": "Status",
|
"log_status": "Status",
|
||||||
"mapping": "Model Mapping",
|
"mapping": "Model Mapping",
|
||||||
"mapping_tip": "A valid Json is required. \nThe model can be mapped when sending a request to the actual address. \nFor example:\n{\n \n \"gpt-4o\": \"gpt-4o-test\"\n\n}\n\nWhen FastGPT requests the gpt-4o model, the gpt-4o-test model is sent to the actual address, instead of gpt-4o.",
|
"mapping_tip": "A valid Json is required. \nThe model can be mapped when sending a request to the actual address. \nFor example:\n{\n \n \"gpt-4o\": \"gpt-4o-test\"\n\n}\n\nWhen FastGPT requests the gpt-4o model, the gpt-4o-test model is sent to the actual address, instead of gpt-4o.",
|
||||||
|
|||||||
@ -24,6 +24,7 @@
|
|||||||
"key_type": "API key 格式: ",
|
"key_type": "API key 格式: ",
|
||||||
"log": "调用日志",
|
"log": "调用日志",
|
||||||
"log_detail": "日志详情",
|
"log_detail": "日志详情",
|
||||||
|
"log_request_id_search": "根据 requestId 搜索",
|
||||||
"log_status": "状态",
|
"log_status": "状态",
|
||||||
"mapping": "模型映射",
|
"mapping": "模型映射",
|
||||||
"mapping_tip": "需填写一个有效 Json。可在向实际地址发送请求时,对模型进行映射。例如:\n{\n \"gpt-4o\": \"gpt-4o-test\"\n}\n当 FastGPT 请求 gpt-4o 模型时,会向实际地址发送 gpt-4o-test 的模型,而不是 gpt-4o。",
|
"mapping_tip": "需填写一个有效 Json。可在向实际地址发送请求时,对模型进行映射。例如:\n{\n \"gpt-4o\": \"gpt-4o-test\"\n}\n当 FastGPT 请求 gpt-4o 模型时,会向实际地址发送 gpt-4o-test 的模型,而不是 gpt-4o。",
|
||||||
|
|||||||
@ -22,6 +22,7 @@
|
|||||||
"key_type": "API key 格式:",
|
"key_type": "API key 格式:",
|
||||||
"log": "調用日誌",
|
"log": "調用日誌",
|
||||||
"log_detail": "日誌詳情",
|
"log_detail": "日誌詳情",
|
||||||
|
"log_request_id_search": "根據 requestId 搜索",
|
||||||
"log_status": "狀態",
|
"log_status": "狀態",
|
||||||
"mapping": "模型映射",
|
"mapping": "模型映射",
|
||||||
"mapping_tip": "需填寫一個有效 Json。\n可在向實際地址發送請求時,對模型進行映射。\n例如:\n{\n \n \"gpt-4o\": \"gpt-4o-test\"\n\n}\n\n當 FastGPT 請求 gpt-4o 模型時,會向實際地址發送 gpt-4o-test 的模型,而不是 gpt-4o。",
|
"mapping_tip": "需填寫一個有效 Json。\n可在向實際地址發送請求時,對模型進行映射。\n例如:\n{\n \n \"gpt-4o\": \"gpt-4o-test\"\n\n}\n\n當 FastGPT 請求 gpt-4o 模型時,會向實際地址發送 gpt-4o-test 的模型,而不是 gpt-4o。",
|
||||||
|
|||||||
@ -32,6 +32,7 @@ import MyIcon from '@fastgpt/web/components/common/Icon';
|
|||||||
import { formatTime2YMDHMS } from '@fastgpt/global/common/string/time';
|
import { formatTime2YMDHMS } from '@fastgpt/global/common/string/time';
|
||||||
import MyModal from '@fastgpt/web/components/common/MyModal';
|
import MyModal from '@fastgpt/web/components/common/MyModal';
|
||||||
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
import QuestionTip from '@fastgpt/web/components/common/MyTooltip/QuestionTip';
|
||||||
|
import SearchInput from '@fastgpt/web/components/common/Input/SearchInput';
|
||||||
|
|
||||||
type LogDetailType = {
|
type LogDetailType = {
|
||||||
id: number;
|
id: number;
|
||||||
@ -55,11 +56,13 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
|
|||||||
|
|
||||||
const isRoot = userInfo?.username === 'root';
|
const isRoot = userInfo?.username === 'root';
|
||||||
const [filterProps, setFilterProps] = useState<{
|
const [filterProps, setFilterProps] = useState<{
|
||||||
|
request_id?: string;
|
||||||
channelId?: string;
|
channelId?: string;
|
||||||
model?: string;
|
model?: string;
|
||||||
code_type: 'all' | 'success' | 'error';
|
code_type: 'all' | 'success' | 'error';
|
||||||
dateRange: DateRangeType;
|
dateRange: DateRangeType;
|
||||||
}>({
|
}>({
|
||||||
|
request_id: '',
|
||||||
code_type: 'all',
|
code_type: 'all',
|
||||||
dateRange: {
|
dateRange: {
|
||||||
from: (() => {
|
from: (() => {
|
||||||
@ -125,6 +128,7 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
|
|||||||
pageSize: 20,
|
pageSize: 20,
|
||||||
refreshDeps: [filterProps],
|
refreshDeps: [filterProps],
|
||||||
params: {
|
params: {
|
||||||
|
request_id: filterProps.request_id,
|
||||||
channel: filterProps.channelId,
|
channel: filterProps.channelId,
|
||||||
model_name: filterProps.model,
|
model_name: filterProps.model,
|
||||||
code_type: filterProps.code_type,
|
code_type: filterProps.code_type,
|
||||||
@ -172,6 +176,13 @@ const ChannelLog = ({ Tab }: { Tab: React.ReactNode }) => {
|
|||||||
<Flex alignItems={'center'}>
|
<Flex alignItems={'center'}>
|
||||||
{Tab}
|
{Tab}
|
||||||
<Box flex={1} />
|
<Box flex={1} />
|
||||||
|
<Box flex={'0 0 200px'}>
|
||||||
|
<SearchInput
|
||||||
|
placeholder={t('account_model:log_request_id_search')}
|
||||||
|
defaultValue={filterProps.request_id}
|
||||||
|
onBlur={(e) => setFilterProps({ ...filterProps, request_id: e.target.value })}
|
||||||
|
/>
|
||||||
|
</Box>
|
||||||
</Flex>
|
</Flex>
|
||||||
)}
|
)}
|
||||||
<HStack spacing={4}>
|
<HStack spacing={4}>
|
||||||
|
|||||||
@ -152,6 +152,7 @@ export const putChannel = (data: ChannelInfoType) =>
|
|||||||
export const deleteChannel = (id: number) => DELETE(`/channel/${id}`);
|
export const deleteChannel = (id: number) => DELETE(`/channel/${id}`);
|
||||||
|
|
||||||
export const getChannelLog = (params: {
|
export const getChannelLog = (params: {
|
||||||
|
request_id?: string;
|
||||||
channel?: string;
|
channel?: string;
|
||||||
model_name?: string;
|
model_name?: string;
|
||||||
code_type?: 'all' | 'success' | 'error';
|
code_type?: 'all' | 'success' | 'error';
|
||||||
@ -164,6 +165,7 @@ export const getChannelLog = (params: {
|
|||||||
logs: ChannelLogListItemType[];
|
logs: ChannelLogListItemType[];
|
||||||
total: number;
|
total: number;
|
||||||
}>(`/logs/search`, {
|
}>(`/logs/search`, {
|
||||||
|
request_id: params.request_id,
|
||||||
channel: params.channel,
|
channel: params.channel,
|
||||||
model_name: params.model_name,
|
model_name: params.model_name,
|
||||||
code_type: params.code_type,
|
code_type: params.code_type,
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user