mirror of
https://github.com/langgenius/dify.git
synced 2026-04-29 20:48:01 +08:00
feat: adapt to plugin_daemon endpoint
This commit is contained in:
parent
7db77cf9f8
commit
11f4743624
@ -656,7 +656,9 @@ class PluginReadmeApi(Resource):
|
|||||||
return jsonable_encoder(
|
return jsonable_encoder(
|
||||||
{
|
{
|
||||||
"readme": PluginService.fetch_plugin_readme(
|
"readme": PluginService.fetch_plugin_readme(
|
||||||
tenant_id, args["plugin_unique_identifier"], args.get("language", "en-US")
|
tenant_id,
|
||||||
|
args["plugin_unique_identifier"],
|
||||||
|
args.get("language", "en-US")
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@ -196,3 +196,7 @@ class PluginListResponse(BaseModel):
|
|||||||
|
|
||||||
class PluginDynamicSelectOptionsResponse(BaseModel):
|
class PluginDynamicSelectOptionsResponse(BaseModel):
|
||||||
options: Sequence[PluginParameterOption] = Field(description="The options of the dynamic select.")
|
options: Sequence[PluginParameterOption] = Field(description="The options of the dynamic select.")
|
||||||
|
|
||||||
|
class PluginReadmeResponse(BaseModel):
|
||||||
|
content: str = Field(description="The readme of the plugin.")
|
||||||
|
language: str = Field(description="The language of the readme.")
|
||||||
|
|||||||
@ -1,5 +1,7 @@
|
|||||||
from collections.abc import Sequence
|
from collections.abc import Sequence
|
||||||
|
|
||||||
|
from requests import HTTPError
|
||||||
|
|
||||||
from core.plugin.entities.bundle import PluginBundleDependency
|
from core.plugin.entities.bundle import PluginBundleDependency
|
||||||
from core.plugin.entities.plugin import (
|
from core.plugin.entities.plugin import (
|
||||||
GenericProviderID,
|
GenericProviderID,
|
||||||
@ -14,6 +16,7 @@ from core.plugin.entities.plugin_daemon import (
|
|||||||
PluginInstallTask,
|
PluginInstallTask,
|
||||||
PluginInstallTaskStartResponse,
|
PluginInstallTaskStartResponse,
|
||||||
PluginListResponse,
|
PluginListResponse,
|
||||||
|
PluginReadmeResponse,
|
||||||
)
|
)
|
||||||
from core.plugin.impl.base import BasePluginClient
|
from core.plugin.impl.base import BasePluginClient
|
||||||
|
|
||||||
@ -23,12 +26,23 @@ class PluginInstaller(BasePluginClient):
|
|||||||
"""
|
"""
|
||||||
Fetch plugin readme
|
Fetch plugin readme
|
||||||
"""
|
"""
|
||||||
return self._request_with_plugin_daemon_response(
|
try:
|
||||||
"GET",
|
response = self._request_with_plugin_daemon_response(
|
||||||
f"plugin/{tenant_id}/management/fetch/readme",
|
"GET",
|
||||||
str,
|
f"plugin/{tenant_id}/management/fetch/readme",
|
||||||
params={"plugin_unique_identifier": plugin_unique_identifier, "language": language},
|
PluginReadmeResponse,
|
||||||
)
|
params={
|
||||||
|
"tenant_id":tenant_id,
|
||||||
|
"plugin_unique_identifier": plugin_unique_identifier,
|
||||||
|
"language": language
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return response.content
|
||||||
|
except HTTPError as e:
|
||||||
|
message = e.args[0]
|
||||||
|
if "404" in message:
|
||||||
|
return ""
|
||||||
|
raise e
|
||||||
|
|
||||||
def fetch_plugin_by_identifier(
|
def fetch_plugin_by_identifier(
|
||||||
self,
|
self,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user