Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
赵月辉
/
fastgpt-migrated
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
4ac2a2f4
authored
Apr 20, 2025
by
Archer
Committed by
GitHub
Apr 20, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: timezone count (#4604)
* fix: timezone count * fix: ts * fix: test llm
parent
61aa91b3
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
73 additions
and
50 deletions
+73
-50
docSite/content/zh-cn/docs/development/upgrading/497.md
+3
-0
packages/global/common/time/timezone.ts
+18
-1
packages/global/support/wallet/usage/api.d.ts
+2
-2
packages/service/core/ai/config.ts
+5
-0
packages/service/core/ai/config/utils.ts
+36
-37
packages/web/components/common/MySelect/TimezoneSelect.tsx
+2
-2
projects/app/src/pageComponents/account/usage/Dashboard.tsx
+4
-4
projects/app/src/pageComponents/account/usage/UsageTable.tsx
+2
-2
projects/app/src/pages/account/usage/index.tsx
+0
-2
projects/app/src/service/common/system/index.ts
+1
-0
No files found.
docSite/content/zh-cn/docs/development/upgrading/497.md
View file @
4ac2a2f4
...
@@ -18,4 +18,7 @@ weight: 793
...
@@ -18,4 +18,7 @@ weight: 793
## 🐛 修复
## 🐛 修复
1.
文件上传分块大小限制,避免超出 MongoDB 限制。
1.
文件上传分块大小限制,避免超出 MongoDB 限制。
2.
使用记录仪表盘,无法获取指定成员的使用统计。
3.
仪表盘接口,因未考虑时区问题,统计异常。
4.
LLM 模型测试接口,无法测试未启用的 LLM。
packages/global/common/time/timezone.ts
View file @
4ac2a2f4
...
@@ -30,7 +30,7 @@ export const getTimezoneOffset = (timeZone: string): number => {
...
@@ -30,7 +30,7 @@ export const getTimezoneOffset = (timeZone: string): number => {
*
*
* Generated by Trelent
* Generated by Trelent
*/
*/
export
const
timez
oneList
=
()
=>
{
export
const
getTimeZ
oneList
=
()
=>
{
const
result
=
timezones
const
result
=
timezones
.
map
((
timezone
)
=>
{
.
map
((
timezone
)
=>
{
try
{
try
{
...
@@ -71,6 +71,23 @@ export const timezoneList = () => {
...
@@ -71,6 +71,23 @@ export const timezoneList = () => {
time
:
number
;
time
:
number
;
}[];
}[];
};
};
export
const
timeZoneList
=
getTimeZoneList
();
export
const
getMongoTimezoneCode
=
(
timeString
:
string
)
=>
{
if
(
!
timeString
.
includes
(
':'
))
{
return
'+00:00'
;
}
if
(
timeString
.
includes
(
'+'
))
{
const
timezoneMatch
=
timeString
.
split
(
'+'
);
return
`+
${
timezoneMatch
[
1
]}
`
;
}
else
if
(
timeString
.
includes
(
'-'
))
{
const
timezoneMatch
=
timeString
.
split
(
'-'
);
return
`-
${
timezoneMatch
[
1
]}
`
;
}
else
{
return
'+00:00'
;
}
};
export
const
getSystemTime
=
(
timeZone
:
string
)
=>
{
export
const
getSystemTime
=
(
timeZone
:
string
)
=>
{
const
timezoneDiff
=
getTimezoneOffset
(
timeZone
);
const
timezoneDiff
=
getTimezoneOffset
(
timeZone
);
...
...
packages/global/support/wallet/usage/api.d.ts
View file @
4ac2a2f4
...
@@ -7,8 +7,8 @@ export type CreateTrainingUsageProps = {
...
@@ -7,8 +7,8 @@ export type CreateTrainingUsageProps = {
};
};
export
type
GetUsageProps
=
{
export
type
GetUsageProps
=
{
dateStart
:
Date
;
dateStart
:
string
;
dateEnd
:
Date
;
dateEnd
:
string
;
sources
?:
UsageSourceEnum
[];
sources
?:
UsageSourceEnum
[];
teamMemberIds
?:
string
[];
teamMemberIds
?:
string
[];
projectName
?:
string
;
projectName
?:
string
;
...
...
packages/service/core/ai/config.ts
View file @
4ac2a2f4
...
@@ -10,6 +10,7 @@ import { addLog } from '../../common/system/log';
...
@@ -10,6 +10,7 @@ import { addLog } from '../../common/system/log';
import
{
i18nT
}
from
'../../../web/i18n/utils'
;
import
{
i18nT
}
from
'../../../web/i18n/utils'
;
import
{
OpenaiAccountType
}
from
'@fastgpt/global/support/user/team/type'
;
import
{
OpenaiAccountType
}
from
'@fastgpt/global/support/user/team/type'
;
import
{
getLLMModel
}
from
'./model'
;
import
{
getLLMModel
}
from
'./model'
;
import
{
LLMModelItemType
}
from
'@fastgpt/global/core/ai/model.d'
;
const
aiProxyBaseUrl
=
process
.
env
.
AIPROXY_API_ENDPOINT
const
aiProxyBaseUrl
=
process
.
env
.
AIPROXY_API_ENDPOINT
?
`
${
process
.
env
.
AIPROXY_API_ENDPOINT
}
/v1`
?
`
${
process
.
env
.
AIPROXY_API_ENDPOINT
}
/v1`
...
@@ -68,7 +69,11 @@ export const createChatCompletion = async ({
...
@@ -68,7 +69,11 @@ export const createChatCompletion = async ({
)
)
>
=>
{
>
=>
{
try
{
try
{
// Rewrite model
const
modelConstantsData
=
getLLMModel
(
body
.
model
);
const
modelConstantsData
=
getLLMModel
(
body
.
model
);
if
(
!
modelConstantsData
)
{
return
Promise
.
reject
(
`
${
body
.
model
}
not found`
);
}
const
formatTimeout
=
timeout
?
timeout
:
body
.
stream
?
60000
:
600000
;
const
formatTimeout
=
timeout
?
timeout
:
body
.
stream
?
60000
:
600000
;
const
ai
=
getAIApi
({
const
ai
=
getAIApi
({
...
...
packages/service/core/ai/config/utils.ts
View file @
4ac2a2f4
...
@@ -45,43 +45,42 @@ export const loadSystemModels = async (init = false) => {
...
@@ -45,43 +45,42 @@ export const loadSystemModels = async (init = false) => {
if
(
model
.
isActive
)
{
if
(
model
.
isActive
)
{
global
.
systemActiveModelList
.
push
(
model
);
global
.
systemActiveModelList
.
push
(
model
);
}
if
(
model
.
type
===
ModelTypeEnum
.
llm
)
{
if
(
model
.
type
===
ModelTypeEnum
.
llm
)
{
global
.
llmModelMap
.
set
(
model
.
model
,
model
);
global
.
llmModelMap
.
set
(
model
.
model
,
model
);
global
.
llmModelMap
.
set
(
model
.
name
,
model
);
global
.
llmModelMap
.
set
(
model
.
name
,
model
);
if
(
model
.
isDefault
)
{
if
(
model
.
isDefault
)
{
global
.
systemDefaultModel
.
llm
=
model
;
global
.
systemDefaultModel
.
llm
=
model
;
}
}
if
(
model
.
isDefaultDatasetTextModel
)
{
if
(
model
.
isDefaultDatasetTextModel
)
{
global
.
systemDefaultModel
.
datasetTextLLM
=
model
;
global
.
systemDefaultModel
.
datasetTextLLM
=
model
;
}
}
if
(
model
.
isDefaultDatasetImageModel
)
{
if
(
model
.
isDefaultDatasetImageModel
)
{
global
.
systemDefaultModel
.
datasetImageLLM
=
model
;
global
.
systemDefaultModel
.
datasetImageLLM
=
model
;
}
}
}
else
if
(
model
.
type
===
ModelTypeEnum
.
embedding
)
{
}
else
if
(
model
.
type
===
ModelTypeEnum
.
embedding
)
{
global
.
embeddingModelMap
.
set
(
model
.
model
,
model
);
global
.
embeddingModelMap
.
set
(
model
.
model
,
model
);
global
.
embeddingModelMap
.
set
(
model
.
name
,
model
);
global
.
embeddingModelMap
.
set
(
model
.
name
,
model
);
if
(
model
.
isDefault
)
{
if
(
model
.
isDefault
)
{
global
.
systemDefaultModel
.
embedding
=
model
;
global
.
systemDefaultModel
.
embedding
=
model
;
}
}
}
else
if
(
model
.
type
===
ModelTypeEnum
.
tts
)
{
}
else
if
(
model
.
type
===
ModelTypeEnum
.
tts
)
{
global
.
ttsModelMap
.
set
(
model
.
model
,
model
);
global
.
ttsModelMap
.
set
(
model
.
model
,
model
);
global
.
ttsModelMap
.
set
(
model
.
name
,
model
);
global
.
ttsModelMap
.
set
(
model
.
name
,
model
);
if
(
model
.
isDefault
)
{
if
(
model
.
isDefault
)
{
global
.
systemDefaultModel
.
tts
=
model
;
global
.
systemDefaultModel
.
tts
=
model
;
}
}
}
else
if
(
model
.
type
===
ModelTypeEnum
.
stt
)
{
}
else
if
(
model
.
type
===
ModelTypeEnum
.
stt
)
{
global
.
sttModelMap
.
set
(
model
.
model
,
model
);
global
.
sttModelMap
.
set
(
model
.
model
,
model
);
global
.
sttModelMap
.
set
(
model
.
name
,
model
);
global
.
sttModelMap
.
set
(
model
.
name
,
model
);
if
(
model
.
isDefault
)
{
if
(
model
.
isDefault
)
{
global
.
systemDefaultModel
.
stt
=
model
;
global
.
systemDefaultModel
.
stt
=
model
;
}
}
}
else
if
(
model
.
type
===
ModelTypeEnum
.
rerank
)
{
}
else
if
(
model
.
type
===
ModelTypeEnum
.
rerank
)
{
global
.
reRankModelMap
.
set
(
model
.
model
,
model
);
global
.
reRankModelMap
.
set
(
model
.
model
,
model
);
global
.
reRankModelMap
.
set
(
model
.
name
,
model
);
global
.
reRankModelMap
.
set
(
model
.
name
,
model
);
if
(
model
.
isDefault
)
{
if
(
model
.
isDefault
)
{
global
.
systemDefaultModel
.
rerank
=
model
;
global
.
systemDefaultModel
.
rerank
=
model
;
}
}
}
}
}
};
};
...
...
packages/web/components/common/MySelect/TimezoneSelect.tsx
View file @
4ac2a2f4
import
React
,
{
useRef
}
from
'react'
;
import
React
,
{
useRef
}
from
'react'
;
import
{
timez
oneList
}
from
'@fastgpt/global/common/time/timezone'
;
import
{
getTimeZ
oneList
}
from
'@fastgpt/global/common/time/timezone'
;
import
{
Select
}
from
'@chakra-ui/react'
;
import
{
Select
}
from
'@chakra-ui/react'
;
const
TimezoneSelect
=
({
value
,
onChange
}:
{
value
?:
string
;
onChange
:
(
e
:
string
)
=>
void
})
=>
{
const
TimezoneSelect
=
({
value
,
onChange
}:
{
value
?:
string
;
onChange
:
(
e
:
string
)
=>
void
})
=>
{
const
timezones
=
useRef
(
timez
oneList
());
const
timezones
=
useRef
(
getTimeZ
oneList
());
return
(
return
(
<
Select
<
Select
...
...
projects/app/src/pageComponents/account/usage/Dashboard.tsx
View file @
4ac2a2f4
...
@@ -70,11 +70,11 @@ const UsageDashboard = ({
...
@@ -70,11 +70,11 @@ const UsageDashboard = ({
()
=>
()
=>
getDashboardData
({
getDashboardData
({
dateStart
:
dateRange
.
from
dateStart
:
dateRange
.
from
?
new
Date
(
dateRange
.
from
.
setHours
(
0
,
0
,
0
,
0
)
)
?
dayjs
(
dateRange
.
from
.
setHours
(
0
,
0
,
0
,
0
)).
format
(
)
:
new
Date
(
new
Date
().
setHours
(
0
,
0
,
0
,
0
)
),
:
dayjs
(
new
Date
().
setHours
(
0
,
0
,
0
,
0
)).
format
(
),
dateEnd
:
dateRange
.
to
dateEnd
:
dateRange
.
to
?
new
Date
(
addDays
(
dateRange
.
to
,
1
).
setHours
(
0
,
0
,
0
,
0
)
)
?
dayjs
(
addDays
(
dateRange
.
to
,
1
).
setHours
(
0
,
0
,
0
,
0
)).
format
(
)
:
new
Date
(
addDays
(
new
Date
(),
1
).
setHours
(
0
,
0
,
0
,
0
)
),
:
dayjs
(
addDays
(
new
Date
(),
1
).
setHours
(
0
,
0
,
0
,
0
)).
format
(
),
sources
:
isSelectAllSource
?
undefined
:
usageSources
,
sources
:
isSelectAllSource
?
undefined
:
usageSources
,
teamMemberIds
:
isSelectAllTmb
?
undefined
:
selectTmbIds
,
teamMemberIds
:
isSelectAllTmb
?
undefined
:
selectTmbIds
,
unit
unit
...
...
projects/app/src/pageComponents/account/usage/UsageTable.tsx
View file @
4ac2a2f4
...
@@ -45,8 +45,8 @@ const UsageTableList = ({
...
@@ -45,8 +45,8 @@ const UsageTableList = ({
filterParams
;
filterParams
;
const
requestParams
=
useMemo
(()
=>
{
const
requestParams
=
useMemo
(()
=>
{
return
{
return
{
dateStart
:
da
teRange
.
from
||
new
Date
(),
dateStart
:
da
yjs
(
dateRange
.
from
||
new
Date
()).
format
(),
dateEnd
:
addDays
(
dateRange
.
to
||
new
Date
(),
1
),
dateEnd
:
dayjs
(
addDays
(
dateRange
.
to
||
new
Date
(),
1
)).
format
(
),
sources
:
isSelectAllSource
?
undefined
:
usageSources
,
sources
:
isSelectAllSource
?
undefined
:
usageSources
,
teamMemberIds
:
isSelectAllTmb
?
undefined
:
selectTmbIds
,
teamMemberIds
:
isSelectAllTmb
?
undefined
:
selectTmbIds
,
projectName
projectName
...
...
projects/app/src/pages/account/usage/index.tsx
View file @
4ac2a2f4
...
@@ -16,8 +16,6 @@ import FillRowTabs from '@fastgpt/web/components/common/Tabs/FillRowTabs';
...
@@ -16,8 +16,6 @@ import FillRowTabs from '@fastgpt/web/components/common/Tabs/FillRowTabs';
import
MultipleSelect
,
{
import
MultipleSelect
,
{
useMultipleSelect
useMultipleSelect
}
from
'@fastgpt/web/components/common/MySelect/MultipleSelect'
;
}
from
'@fastgpt/web/components/common/MySelect/MultipleSelect'
;
import
SearchInput
from
'@fastgpt/web/components/common/Input/SearchInput'
;
import
MySelect
from
'@fastgpt/web/components/common/MySelect'
;
import
{
useRouter
}
from
'next/router'
;
import
{
useRouter
}
from
'next/router'
;
import
dynamic
from
'next/dynamic'
;
import
dynamic
from
'next/dynamic'
;
...
...
projects/app/src/service/common/system/index.ts
View file @
4ac2a2f4
...
@@ -51,6 +51,7 @@ export const readConfigData = async (name: string) => {
...
@@ -51,6 +51,7 @@ export const readConfigData = async (name: string) => {
export
function
initGlobalVariables
()
{
export
function
initGlobalVariables
()
{
function
initPlusRequest
()
{
function
initPlusRequest
()
{
global
.
textCensorHandler
=
function
textCensorHandler
({
text
}:
{
text
:
string
})
{
global
.
textCensorHandler
=
function
textCensorHandler
({
text
}:
{
text
:
string
})
{
if
(
!
isProVersion
())
return
Promise
.
resolve
({
code
:
200
});
return
POST
<
{
code
:
number
;
message
?:
string
}
>
(
'/common/censor/check'
,
{
text
});
return
POST
<
{
code
:
number
;
message
?:
string
}
>
(
'/common/censor/check'
,
{
text
});
};
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment