Toggle navigation
Toggle navigation
This project
Loading...
Sign in
万朱浩
/
Venue-Ops
Go to a project
Toggle navigation
Projects
Groups
Snippets
Help
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
lintsinghua
2025-11-04 01:41:21 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
BaiFu
2025-11-04 01:51:24 +0800
Commit
66af69d958c49baf54e8093942c36d440f663638
66af69d9
1 parent
e1c201af
Fix agent temporal perception error by adding current real-world time to LLM prompt.
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
0 deletions
ForumEngine/llm_host.py
InsightEngine/llms/base.py
MediaEngine/llms/base.py
QueryEngine/llms/base.py
ForumEngine/llm_host.py
View file @
66af69d
...
...
@@ -211,6 +211,13 @@ class ForumHost:
def
_call_qwen_api
(
self
,
system_prompt
:
str
,
user_prompt
:
str
)
->
Dict
[
str
,
Any
]:
"""调用Qwen API"""
try
:
current_time
=
datetime
.
now
()
.
strftime
(
"
%
Y年
%
m月
%
d日
%
H时
%
M分"
)
time_prefix
=
f
"今天的实际时间是{current_time}"
if
user_prompt
:
user_prompt
=
f
"{time_prefix}
\n
{user_prompt}"
else
:
user_prompt
=
time_prefix
response
=
self
.
client
.
chat
.
completions
.
create
(
model
=
self
.
model
,
messages
=
[
...
...
InsightEngine/llms/base.py
View file @
66af69d
...
...
@@ -4,6 +4,7 @@ Unified OpenAI-compatible LLM client for the Insight Engine, with retry support.
import
os
import
sys
from
datetime
import
datetime
from
typing
import
Any
,
Dict
,
Optional
from
openai
import
OpenAI
...
...
@@ -54,6 +55,12 @@ class LLMClient:
@with_retry
(
LLM_RETRY_CONFIG
)
def
invoke
(
self
,
system_prompt
:
str
,
user_prompt
:
str
,
**
kwargs
)
->
str
:
current_time
=
datetime
.
now
()
.
strftime
(
"
%
Y年
%
m月
%
d日
%
H时
%
M分"
)
time_prefix
=
f
"今天的实际时间是{current_time}"
if
user_prompt
:
user_prompt
=
f
"{time_prefix}
\n
{user_prompt}"
else
:
user_prompt
=
time_prefix
messages
=
[
{
"role"
:
"system"
,
"content"
:
system_prompt
},
{
"role"
:
"user"
,
"content"
:
user_prompt
},
...
...
MediaEngine/llms/base.py
View file @
66af69d
...
...
@@ -4,6 +4,7 @@ Unified OpenAI-compatible LLM client for the Media Engine, with retry support.
import
os
import
sys
from
datetime
import
datetime
from
typing
import
Any
,
Dict
,
Optional
from
openai
import
OpenAI
...
...
@@ -57,6 +58,12 @@ class LLMClient:
@with_retry
(
LLM_RETRY_CONFIG
)
def
invoke
(
self
,
system_prompt
:
str
,
user_prompt
:
str
,
**
kwargs
)
->
str
:
current_time
=
datetime
.
now
()
.
strftime
(
"
%
Y年
%
m月
%
d日
%
H时
%
M分"
)
time_prefix
=
f
"今天的实际时间是{current_time}"
if
user_prompt
:
user_prompt
=
f
"{time_prefix}
\n
{user_prompt}"
else
:
user_prompt
=
time_prefix
messages
=
[
{
"role"
:
"system"
,
"content"
:
system_prompt
},
{
"role"
:
"user"
,
"content"
:
user_prompt
},
...
...
QueryEngine/llms/base.py
View file @
66af69d
...
...
@@ -4,6 +4,7 @@ Unified OpenAI-compatible LLM client for the Query Engine, with retry support.
import
os
import
sys
from
datetime
import
datetime
from
typing
import
Any
,
Dict
,
Optional
from
openai
import
OpenAI
...
...
@@ -54,6 +55,12 @@ class LLMClient:
@with_retry
(
LLM_RETRY_CONFIG
)
def
invoke
(
self
,
system_prompt
:
str
,
user_prompt
:
str
,
**
kwargs
)
->
str
:
current_time
=
datetime
.
now
()
.
strftime
(
"
%
Y年
%
m月
%
d日
%
H时
%
M分"
)
time_prefix
=
f
"今天的实际时间是{current_time}"
if
user_prompt
:
user_prompt
=
f
"{time_prefix}
\n
{user_prompt}"
else
:
user_prompt
=
time_prefix
messages
=
[
{
"role"
:
"system"
,
"content"
:
system_prompt
},
{
"role"
:
"user"
,
"content"
:
user_prompt
},
...
...
Please
register
or
login
to post a comment