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
293c0cdb
authored
Apr 28, 2025
by
heheer
Committed by
GitHub
Apr 28, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
url params filter logic (#4694)
parent
ca8adbbf
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
46 additions
and
12 deletions
+46
-12
projects/app/src/components/Markdown/A.tsx
+1
-1
projects/app/src/web/context/useInitApp.ts
+45
-11
No files found.
projects/app/src/components/Markdown/A.tsx
View file @
293c0cdb
...
@@ -89,7 +89,7 @@ const A = ({ children, ...props }: any) => {
...
@@ -89,7 +89,7 @@ const A = ({ children, ...props }: any) => {
/>
/>
</
Button
>
</
Button
>
</
PopoverTrigger
>
</
PopoverTrigger
>
<
PopoverContent
boxShadow=
{
'lg'
}
w=
{
'500px'
}
py=
{
4
}
>
<
PopoverContent
boxShadow=
{
'lg'
}
w=
{
'500px'
}
maxW=
{
'90vw'
}
py=
{
4
}
>
<
MyBox
isLoading=
{
loading
}
>
<
MyBox
isLoading=
{
loading
}
>
<
PopoverArrow
/>
<
PopoverArrow
/>
<
PopoverBody
py=
{
0
}
px=
{
0
}
fontSize=
{
'sm'
}
>
<
PopoverBody
py=
{
0
}
px=
{
0
}
fontSize=
{
'sm'
}
>
...
...
projects/app/src/web/context/useInitApp.ts
View file @
293c0cdb
...
@@ -17,24 +17,57 @@ import {
...
@@ -17,24 +17,57 @@ import {
}
from
'../support/marketing/utils'
;
}
from
'../support/marketing/utils'
;
import
{
ShortUrlParams
}
from
'@fastgpt/global/support/marketing/type'
;
import
{
ShortUrlParams
}
from
'@fastgpt/global/support/marketing/type'
;
type
MarketingQueryParams
=
{
hiId
?:
string
;
bd_vid
?:
string
;
k
?:
string
;
sourceDomain
?:
string
;
utm_source
?:
string
;
utm_medium
?:
string
;
utm_content
?:
string
;
utm_workflow
?:
string
;
};
const
MARKETING_PARAMS
:
(
keyof
MarketingQueryParams
)[]
=
[
'hiId'
,
'bd_vid'
,
'k'
,
'sourceDomain'
,
'utm_source'
,
'utm_medium'
,
'utm_content'
,
'utm_workflow'
];
export
const
useInitApp
=
()
=>
{
export
const
useInitApp
=
()
=>
{
const
router
=
useRouter
();
const
router
=
useRouter
();
const
{
hiId
,
bd_vid
,
k
,
sourceDomain
,
utm_source
,
utm_medium
,
utm_content
,
utm_workflow
}
=
const
{
hiId
,
bd_vid
,
k
,
sourceDomain
,
utm_source
,
utm_medium
,
utm_content
,
utm_workflow
}
=
router
.
query
as
{
router
.
query
as
MarketingQueryParams
;
hiId
?:
string
;
bd_vid
?:
string
;
k
?:
string
;
sourceDomain
?:
string
;
utm_source
?:
string
;
utm_medium
?:
string
;
utm_content
?:
string
;
utm_workflow
?:
string
;
};
const
{
loadGitStar
,
setInitd
,
feConfigs
}
=
useSystemStore
();
const
{
loadGitStar
,
setInitd
,
feConfigs
}
=
useSystemStore
();
const
{
userInfo
}
=
useUserStore
();
const
{
userInfo
}
=
useUserStore
();
const
[
scripts
,
setScripts
]
=
useState
<
FastGPTFeConfigsType
[
'scripts'
]
>
([]);
const
[
scripts
,
setScripts
]
=
useState
<
FastGPTFeConfigsType
[
'scripts'
]
>
([]);
const
[
title
,
setTitle
]
=
useState
(
process
.
env
.
SYSTEM_NAME
||
'AI'
);
const
[
title
,
setTitle
]
=
useState
(
process
.
env
.
SYSTEM_NAME
||
'AI'
);
const
getPathWithoutMarketingParams
=
()
=>
{
const
filteredQuery
=
{
...
router
.
query
};
MARKETING_PARAMS
.
forEach
((
param
)
=>
{
delete
filteredQuery
[
param
];
});
const
newQuery
=
new
URLSearchParams
();
Object
.
entries
(
filteredQuery
).
forEach
(([
key
,
value
])
=>
{
if
(
value
)
{
if
(
Array
.
isArray
(
value
))
{
value
.
forEach
((
v
)
=>
newQuery
.
append
(
key
,
v
));
}
else
{
newQuery
.
append
(
key
,
value
);
}
}
});
return
`
${
router
.
pathname
}${
newQuery
.
toString
()
?
`?
${
newQuery
.
toString
()}
`
:
''
}
`
;
};
const
initFetch
=
useMemoizedFn
(
async
()
=>
{
const
initFetch
=
useMemoizedFn
(
async
()
=>
{
const
{
const
{
feConfigs
:
{
scripts
,
isPlus
,
systemTitle
}
feConfigs
:
{
scripts
,
isPlus
,
systemTitle
}
...
@@ -98,7 +131,8 @@ export const useInitApp = () => {
...
@@ -98,7 +131,8 @@ export const useInitApp = () => {
setUtmParams
(
utmParams
);
setUtmParams
(
utmParams
);
setFastGPTSem
({
keyword
:
k
,
...
utmParams
});
setFastGPTSem
({
keyword
:
k
,
...
utmParams
});
router
.
replace
(
router
.
pathname
);
const
newPath
=
getPathWithoutMarketingParams
();
router
.
replace
(
newPath
);
});
});
return
{
return
{
...
...
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