Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
D
dify
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ai-tech
dify
Commits
83fdac0e
Commit
83fdac0e
authored
Jul 27, 2023
by
John Wang
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/optimize-current-time' into deploy/dev
parents
51da1340
f494371a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
completion.py
api/core/completion.py
+2
-2
orchestrator_rule_parser.py
api/core/orchestrator_rule_parser.py
+2
-1
helper.py
api/libs/helper.py
+1
-1
No files found.
api/core/completion.py
View file @
83fdac0e
...
...
@@ -27,13 +27,13 @@ from core.orchestrator_rule_parser import OrchestratorRuleParser
from
core.prompt.prompt_builder
import
PromptBuilder
from
core.prompt.prompt_template
import
JinjaPromptTemplate
from
core.prompt.prompts
import
MORE_LIKE_THIS_GENERATE_PROMPT
from
models.model
import
App
,
AppModelConfig
,
Account
,
Conversation
,
Message
from
models.model
import
App
,
AppModelConfig
,
Account
,
Conversation
,
Message
,
EndUser
class
Completion
:
@
classmethod
def
generate
(
cls
,
task_id
:
str
,
app
:
App
,
app_model_config
:
AppModelConfig
,
query
:
str
,
inputs
:
dict
,
user
:
Account
,
conversation
:
Optional
[
Conversation
],
streaming
:
bool
,
is_override
:
bool
=
False
):
user
:
Union
[
Account
,
EndUser
]
,
conversation
:
Optional
[
Conversation
],
streaming
:
bool
,
is_override
:
bool
=
False
):
"""
errors: ProviderTokenNotInitError
"""
...
...
api/core/orchestrator_rule_parser.py
View file @
83fdac0e
...
...
@@ -250,7 +250,8 @@ class OrchestratorRuleParser:
def
to_current_datetime_tool
(
self
)
->
Optional
[
BaseTool
]:
tool
=
Tool
(
name
=
"current_datetime"
,
description
=
"A tool when you want to get the current date or time. "
,
description
=
"A tool when you want to get the current date, time, week, month or year, "
"and the time zone is UTC+0000."
,
func
=
helper
.
get_current_datetime
,
callbacks
=
[
DifyStdOutCallbackHandler
()]
)
...
...
api/libs/helper.py
View file @
83fdac0e
...
...
@@ -158,4 +158,4 @@ def generate_text_hash(text: str) -> str:
def
get_current_datetime
(
type
:
str
)
->
str
:
# get current time
current_time
=
datetime
.
utcnow
()
return
current_time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S
%
Z
%
z
"
)
return
current_time
.
strftime
(
"
%
Y-
%
m-
%
d
%
H:
%
M:
%
S
UTC+0000
%
A
"
)
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