mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-06-04 03:04:11 +08:00
fix: LLM may not return <think>
tag, cause thinking time keep increase (#13962)
This commit is contained in:
parent
6fc234183a
commit
ece25bce1a
@ -10,10 +10,10 @@ NEXT_PUBLIC_API_PREFIX=http://localhost:5001/console/api
|
||||
# console or api domain.
|
||||
# example: http://udify.app/api
|
||||
NEXT_PUBLIC_PUBLIC_API_PREFIX=http://localhost:5001/api
|
||||
# The APIFREX for MARKETPLACE
|
||||
NEXT_PUBLIC_MARKETPLACE_API_PREFIX=http://localhost:5002/api
|
||||
# The API PREFIX for MARKETPLACE
|
||||
NEXT_PUBLIC_MARKETPLACE_API_PREFIX=https://marketplace.dify.ai/api/v1
|
||||
# The URL for MARKETPLACE
|
||||
NEXT_PUBLIC_MARKETPLACE_URL_PREFIX=
|
||||
NEXT_PUBLIC_MARKETPLACE_URL_PREFIX=https://marketplace.dify.ai
|
||||
|
||||
# SENTRY
|
||||
NEXT_PUBLIC_SENTRY_DSN=
|
||||
|
@ -68,12 +68,13 @@ const preprocessLaTeX = (content: string) => {
|
||||
}
|
||||
|
||||
const preprocessThinkTag = (content: string) => {
|
||||
if (!content.trim().startsWith('<think>\n'))
|
||||
if (!(content.trim().startsWith('<think>\n') || content.trim().startsWith('<details style=')))
|
||||
return content
|
||||
|
||||
return flow([
|
||||
(str: string) => str.replace('<think>\n', '<details>\n'),
|
||||
(str: string) => str.replace('\n</think>', '\n[ENDTHINKFLAG]</details>'),
|
||||
(str: string) => str.replaceAll('<think>\n', '<details>\n'),
|
||||
(str: string) => str.replaceAll('\n</think>', '\n[ENDTHINKFLAG]</details>'),
|
||||
(str: string) => str.replaceAll('\n</details>', '\n[ENDTHINKFLAG]</details>'),
|
||||
])(content)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user