mirror of
https://github.com/langgenius/dify-plugin-sdks.git
synced 2026-07-22 18:35:29 -04:00
5cb24625c3
* chore(python): temporarily disable `UP007` rule in Ruff Disable the `UP007` rule temporarily due to numerous existing violations in the current codebase. * ci(python): add lint and test for Python SDK * ci: Add mega-linter * chore(python): Add final newline to markdown files * fix(python): Fix linter issues by using ruff's auto fix * fix(python): Fix TRY400 linter violations Ruff suggests using `logger.exception` to log when logging an exception, instead of using `logging.error`. The former logs the exception and the traceback automatically. ref: https://docs.astral.sh/ruff/rules/error-instead-of-exception/ * fix(python): fix ruff linter violations * test(python): Add Test cases for LLM entities Test the initialization of `LLMResult` and `LLMResultChunk`. * test(python): Add test for `AgentModelConfig` Ensures that the `history_prompt_messages` attribute is not shared between instances of `AgentModelConfig`. * chore(python): output diffs in Ruff's format check * style(python): format code with Ruff * chore(python): Add a bash script for fix and format python code * chore: add `persist-credentials: false` to checkout action Enhances security by preventing subsequent steps from accessing GitHub credentials, reducing potential attack surfaces. Ref: https://github.com/actions/checkout#checkout-v4
18 lines
590 B
Python
18 lines
590 B
Python
import os
|
|
from collections.abc import Mapping
|
|
|
|
from werkzeug import Request, Response
|
|
|
|
from dify_plugin import Endpoint
|
|
|
|
|
|
class NekoEndpoint(Endpoint):
|
|
def _invoke(self, r: Request, values: Mapping, settings: Mapping) -> Response:
|
|
# read file from girls.html using current python file relative path
|
|
with open(os.path.join(os.path.dirname(__file__), "girls.html")) as f:
|
|
return Response(
|
|
f.read().replace("{{ bot_name }}", settings.get("bot_name", "Candy")),
|
|
status=200,
|
|
content_type="text/html",
|
|
)
|