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
469a66b5
Unverified
Commit
469a66b5
authored
Jan 31, 2024
by
Yeuoly
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: upload image
parent
7582871e
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
10 additions
and
5 deletions
+10
-5
message_file_parser.py
api/core/file/message_file_parser.py
+4
-1
model_tool.py
api/core/tools/tool/model_tool.py
+4
-2
chat-item.tsx
...nfiguration/debug/debug-with-multiple-model/chat-item.tsx
+1
-1
index.tsx
...app/configuration/debug/debug-with-single-model/index.tsx
+1
-1
No files found.
api/core/file/message_file_parser.py
View file @
469a66b5
...
...
@@ -54,7 +54,10 @@ class MessageFileParser:
image_config
=
file_upload_config
.
get
(
'image'
)
# check if image file feature is enabled or it's agent
if
not
image_config
[
'enabled'
]
and
not
(
app_model_config
.
agent_mode_dict
.
get
(
'enabled'
,
''
)
in
[
'react'
,
'function_call'
,
'cot'
]):
if
not
image_config
[
'enabled'
]
and
not
(
app_model_config
.
agent_mode_dict
.
get
(
'enabled'
,
False
)
and
app_model_config
.
agent_mode_dict
.
get
(
'strategy'
,
''
)
in
[
'react'
,
'function_call'
,
'cot'
]
):
continue
# Validate number of files
...
...
api/core/tools/tool/model_tool.py
View file @
469a66b5
from
typing
import
Any
,
Dict
,
List
,
cast
from
enum
import
Enum
from
pydantic
import
validator
from
base64
import
b64encode
from
core.tools.entities.tool_entities
import
ToolInvokeMessage
...
...
@@ -60,7 +59,8 @@ class ModelTool(Tool):
identity
=
self
.
identity
.
copy
()
if
self
.
identity
else
None
,
parameters
=
self
.
parameters
.
copy
()
if
self
.
parameters
else
None
,
description
=
self
.
description
.
copy
()
if
self
.
description
else
None
,
model_configuration
=
self
.
model_configuration
.
copy
()
if
self
.
model_configuration
else
None
,
model_instance
=
self
.
model_configuration
[
'model_instance'
],
model
=
self
.
model_configuration
[
'model'
],
tool_type
=
self
.
tool_type
,
runtime
=
Tool
.
Runtime
(
**
meta
)
)
...
...
@@ -80,6 +80,8 @@ class ModelTool(Tool):
if
self
.
tool_type
==
ModelTool
.
ModelToolType
.
VISION
:
return
self
.
_invoke_llm
(
user_id
,
tool_parameters
)
else
:
return
self
.
create_text_message
(
'the tool is not configured correctly'
)
def
_invoke_llm
(
self
,
user_id
:
str
,
tool_parameters
:
Dict
[
str
,
Any
])
->
ToolInvokeMessage
|
List
[
ToolInvokeMessage
]:
# get image
...
...
web/app/components/app/configuration/debug/debug-with-multiple-model/chat-item.tsx
View file @
469a66b5
...
...
@@ -82,7 +82,7 @@ const ChatItem: FC<ChatItemProps> = ({
model_config
:
configData
,
}
if
(
visionConfig
.
enabled
&&
files
?.
length
&&
supportVision
)
if
(
((
visionConfig
.
enabled
&&
supportVision
)
||
config
.
agent_mode
.
enabled
)
&&
files
?.
length
)
data
.
files
=
files
handleSend
(
...
...
web/app/components/app/configuration/debug/debug-with-single-model/index.tsx
View file @
469a66b5
...
...
@@ -91,7 +91,7 @@ const DebugWithSingleModel = forwardRef<DebugWithSingleModelRefType, DebugWithSi
model_config
:
configData
,
}
if
(
visionConfig
.
enabled
&&
files
?.
length
&&
supportVision
)
if
(
((
visionConfig
.
enabled
&&
supportVision
)
||
config
.
agent_mode
.
enabled
)
&&
files
?.
length
)
data
.
files
=
files
handleSend
(
...
...
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