mirror of
https://github.com/langgenius/dify.git
synced 2026-10-04 13:47:55 +08:00
Merge branch 'main' into feat/dify-builder
This commit is contained in:
266 files changed
+9891
-3597
No files matched your search
@@ -115,7 +115,7 @@ class DatasourceManager:
|
||||
"""
|
||||
get the datasource runtime
|
||||
|
||||
:param provider_type: the type of the provider
|
||||
:param datasource_type: the type of the datasource
|
||||
:param provider_id: the id of the provider
|
||||
:param datasource_name: the name of the datasource
|
||||
:param tenant_id: the tenant id
|
||||
|
||||
@@ -93,7 +93,7 @@ class DatasourceParameter(PluginParameter):
|
||||
:param required: if the parameter is required
|
||||
:param options: the options of the parameter
|
||||
"""
|
||||
# convert options to ToolParameterOption
|
||||
# convert options to PluginParameterOption
|
||||
# FIXME fix the type error
|
||||
if options:
|
||||
option_objs = [
|
||||
|
||||
@@ -64,7 +64,9 @@ class TokenBufferMemory:
|
||||
"""
|
||||
match self.conversation.mode:
|
||||
case AppMode.AGENT_CHAT | AppMode.COMPLETION | AppMode.CHAT:
|
||||
file_extra_config = FileUploadConfigManager.convert(self.conversation.model_config)
|
||||
file_extra_config = FileUploadConfigManager.convert(
|
||||
self.conversation.model_config_with_session(session=db.session())
|
||||
)
|
||||
case AppMode.ADVANCED_CHAT | AppMode.WORKFLOW:
|
||||
app = self.conversation.app
|
||||
if not app:
|
||||
|
||||
@@ -1188,7 +1188,7 @@ class TraceTask:
|
||||
dataset_retrieval_trace_info = DatasetRetrievalTraceInfo(
|
||||
trace_id=self.trace_id,
|
||||
message_id=message_id,
|
||||
inputs=message_data.query or message_data.inputs,
|
||||
inputs=message_data.query or message_data.inputs_with_session(session=db.session()),
|
||||
documents=doc_list,
|
||||
start_time=timer.get("start"),
|
||||
end_time=timer.get("end"),
|
||||
|
||||
@@ -281,7 +281,10 @@ class PluginAppBackwardsInvocation(BaseBackwardsInvocation):
|
||||
@classmethod
|
||||
def _get_workflow(cls, app: App) -> Workflow | None:
|
||||
"""
|
||||
get workflow without relying on App.workflow's request-scoped session property
|
||||
get workflow with an owned session, additionally scoped by tenant and app
|
||||
|
||||
`App.workflow_with_session` resolves by `workflow_id` alone; a plugin
|
||||
invocation must also confirm the workflow belongs to this tenant and app.
|
||||
"""
|
||||
if not app.workflow_id:
|
||||
return None
|
||||
|
||||
@@ -83,10 +83,12 @@ class ExtractProcessor:
|
||||
suffix = Path(url).suffix
|
||||
if not suffix and suffix != ".":
|
||||
# get content-type
|
||||
if response.headers.get("Content-Type"):
|
||||
suffix = "." + response.headers.get("Content-Type").split("/")[-1]
|
||||
content_type = response.headers.get("Content-Type")
|
||||
if content_type:
|
||||
# strip parameters such as "; charset=utf-8" before using the subtype as suffix
|
||||
suffix = "." + content_type.split(";")[0].strip().split("/")[-1]
|
||||
else:
|
||||
content_disposition = response.headers.get("Content-Disposition")
|
||||
content_disposition = response.headers.get("Content-Disposition", "")
|
||||
filename_match = re.search(r'filename="([^"]+)"', content_disposition)
|
||||
if filename_match:
|
||||
filename = unquote(filename_match.group(1))
|
||||
|
||||
Reference in new issue
Block a user