mirror of
https://git.mirrors.martin98.com/https://github.com/langgenius/dify.git
synced 2025-08-20 21:49:12 +08:00
Ruff: reformatter
This commit is contained in:
parent
ae1eeb9b2a
commit
dd551e6ca8
@ -137,6 +137,7 @@ class PluginConfig(BaseSettings):
|
||||
default=5003,
|
||||
)
|
||||
|
||||
|
||||
class MarketplaceConfig(BaseSettings):
|
||||
"""
|
||||
Configuration for marketplace
|
||||
|
@ -1 +1 @@
|
||||
from .plugin import *
|
||||
import plugin
|
@ -5,7 +5,10 @@ from core.helper.download import download_with_size_limit
|
||||
|
||||
|
||||
def get_plugin_pkg_url(plugin_unique_identifier: str):
|
||||
return (URL(str(dify_config.MARKETPLACE_API_URL)) / "api/v1/plugins/download").with_query(unique_identifier=plugin_unique_identifier)
|
||||
return (
|
||||
URL(str(dify_config.MARKETPLACE_API_URL))
|
||||
/ "api/v1/plugins/download"
|
||||
).with_query(unique_identifier=plugin_unique_identifier)
|
||||
|
||||
|
||||
def download_plugin_pkg(plugin_unique_identifier: str):
|
||||
|
@ -85,7 +85,6 @@ class LargeLanguageModel(AIModel):
|
||||
)
|
||||
|
||||
try:
|
||||
<<<<<<< HEAD
|
||||
plugin_model_manager = PluginModelManager()
|
||||
result = plugin_model_manager.invoke_llm(
|
||||
tenant_id=self.tenant_id,
|
||||
@ -117,10 +116,6 @@ class LargeLanguageModel(AIModel):
|
||||
break
|
||||
|
||||
result = LLMResult(
|
||||
=======
|
||||
if "response_format" in model_parameters and model_parameters["response_format"] in {"JSON", "XML"}:
|
||||
result = self._code_block_mode_wrapper(
|
||||
>>>>>>> main
|
||||
model=model,
|
||||
prompt_messages=prompt_messages,
|
||||
message=AssistantPromptMessage(content=content or content_list),
|
||||
|
@ -1,11 +1,5 @@
|
||||
import logging
|
||||
<<<<<<< HEAD
|
||||
from typing import Optional
|
||||
=======
|
||||
import re
|
||||
from abc import abstractmethod
|
||||
from typing import Any, Optional
|
||||
>>>>>>> main
|
||||
|
||||
from pydantic import ConfigDict
|
||||
|
||||
@ -65,7 +59,6 @@ class TTSModel(AIModel):
|
||||
:param credentials: model credentials
|
||||
:return: voices lists
|
||||
"""
|
||||
<<<<<<< HEAD
|
||||
plugin_model_manager = PluginModelManager()
|
||||
return plugin_model_manager.get_tts_model_voices(
|
||||
tenant_id=self.tenant_id,
|
||||
@ -76,85 +69,3 @@ class TTSModel(AIModel):
|
||||
credentials=credentials,
|
||||
language=language,
|
||||
)
|
||||
=======
|
||||
model_schema = self.get_model_schema(model, credentials)
|
||||
|
||||
if model_schema and ModelPropertyKey.VOICES in model_schema.model_properties:
|
||||
voices = model_schema.model_properties[ModelPropertyKey.VOICES]
|
||||
if language:
|
||||
return [
|
||||
{"name": d["name"], "value": d["mode"]}
|
||||
for d in voices
|
||||
if language and language in d.get("language")
|
||||
]
|
||||
else:
|
||||
return [{"name": d["name"], "value": d["mode"]} for d in voices]
|
||||
|
||||
def _get_model_default_voice(self, model: str, credentials: dict) -> Any:
|
||||
"""
|
||||
Get voice for given tts model
|
||||
|
||||
:param model: model name
|
||||
:param credentials: model credentials
|
||||
:return: voice
|
||||
"""
|
||||
model_schema = self.get_model_schema(model, credentials)
|
||||
|
||||
if model_schema and ModelPropertyKey.DEFAULT_VOICE in model_schema.model_properties:
|
||||
return model_schema.model_properties[ModelPropertyKey.DEFAULT_VOICE]
|
||||
|
||||
def _get_model_audio_type(self, model: str, credentials: dict) -> str:
|
||||
"""
|
||||
Get audio type for given tts model
|
||||
|
||||
:param model: model name
|
||||
:param credentials: model credentials
|
||||
:return: voice
|
||||
"""
|
||||
model_schema = self.get_model_schema(model, credentials)
|
||||
|
||||
if model_schema and ModelPropertyKey.AUDIO_TYPE in model_schema.model_properties:
|
||||
return model_schema.model_properties[ModelPropertyKey.AUDIO_TYPE]
|
||||
|
||||
def _get_model_word_limit(self, model: str, credentials: dict) -> int:
|
||||
"""
|
||||
Get audio type for given tts model
|
||||
:return: audio type
|
||||
"""
|
||||
model_schema = self.get_model_schema(model, credentials)
|
||||
|
||||
if model_schema and ModelPropertyKey.WORD_LIMIT in model_schema.model_properties:
|
||||
return model_schema.model_properties[ModelPropertyKey.WORD_LIMIT]
|
||||
|
||||
def _get_model_workers_limit(self, model: str, credentials: dict) -> int:
|
||||
"""
|
||||
Get audio max workers for given tts model
|
||||
:return: audio type
|
||||
"""
|
||||
model_schema = self.get_model_schema(model, credentials)
|
||||
|
||||
if model_schema and ModelPropertyKey.MAX_WORKERS in model_schema.model_properties:
|
||||
return model_schema.model_properties[ModelPropertyKey.MAX_WORKERS]
|
||||
|
||||
@staticmethod
|
||||
def _split_text_into_sentences(org_text, max_length=2000, pattern=r"[。.!?]"):
|
||||
match = re.compile(pattern)
|
||||
tx = match.finditer(org_text)
|
||||
start = 0
|
||||
result = []
|
||||
one_sentence = ""
|
||||
for i in tx:
|
||||
end = i.regs[0][1]
|
||||
tmp = org_text[start:end]
|
||||
if len(one_sentence + tmp) > max_length:
|
||||
result.append(one_sentence)
|
||||
one_sentence = ""
|
||||
one_sentence += tmp
|
||||
start = end
|
||||
last_sens = org_text[start:]
|
||||
if last_sens:
|
||||
one_sentence += last_sens
|
||||
if one_sentence != "":
|
||||
result.append(one_sentence)
|
||||
return result
|
||||
>>>>>>> main
|
||||
|
@ -1,4 +1,3 @@
|
||||
from typing import Optional
|
||||
|
||||
from core.model_runtime.entities.llm_entities import LLMResult
|
||||
from core.model_runtime.entities.message_entities import PromptMessage, SystemPromptMessage, UserPromptMessage
|
||||
|
@ -3,7 +3,6 @@ import uuid
|
||||
from json import dumps as json_dumps
|
||||
from json import loads as json_loads
|
||||
from json.decoder import JSONDecodeError
|
||||
from typing import Optional
|
||||
|
||||
from requests import get
|
||||
from yaml import YAMLError, safe_load
|
||||
|
1861
api/poetry.lock
generated
1861
api/poetry.lock
generated
File diff suppressed because it is too large
Load Diff
@ -107,6 +107,7 @@ package-mode = false
|
||||
############################################################
|
||||
|
||||
[tool.poetry.dependencies]
|
||||
anthropic = "~0.23.1"
|
||||
authlib = "1.3.1"
|
||||
azure-ai-inference = "~1.0.0b3"
|
||||
azure-ai-ml = "~1.20.0"
|
||||
@ -128,20 +129,26 @@ flask-restful = "~0.3.10"
|
||||
flask-sqlalchemy = "~3.1.1"
|
||||
gevent = "~23.9.1"
|
||||
gmpy2 = "~2.2.1"
|
||||
google-ai-generativelanguage = "0.6.9"
|
||||
google-api-core = "2.18.0"
|
||||
google-api-python-client = "2.90.0"
|
||||
google-auth = "2.29.0"
|
||||
google-auth-httplib2 = "0.2.0"
|
||||
google-cloud-storage = "2.16.0"
|
||||
google-cloud-aiplatform = "1.49.0"
|
||||
google-generativeai = "0.8.1"
|
||||
googleapis-common-protos = "1.63.0"
|
||||
gunicorn = "~22.0.0"
|
||||
httpx = { version = "~0.27.0", extras = ["socks"] }
|
||||
huggingface-hub = "~0.16.4"
|
||||
jieba = "0.42.1"
|
||||
langfuse = "^2.48.0"
|
||||
langsmith = "^0.1.77"
|
||||
langfuse = "~2.51.3"
|
||||
langsmith = "~0.1.77"
|
||||
mailchimp-transactional = "~1.0.50"
|
||||
markdown = "~3.5.1"
|
||||
nltk = "3.8.1"
|
||||
nomic = "~3.1.2"
|
||||
novita-client = "~0.5.7"
|
||||
numpy = "~1.26.4"
|
||||
oci = "~2.135.1"
|
||||
openai = "~1.29.0"
|
||||
openpyxl = "~3.1.5"
|
||||
pandas = { version = "~2.2.2", extras = ["performance", "excel"] }
|
||||
@ -156,16 +163,26 @@ python = ">=3.10,<3.13"
|
||||
python-docx = "~1.1.0"
|
||||
python-dotenv = "1.0.0"
|
||||
pyyaml = "~6.0.1"
|
||||
readabilipy = "0.2.0"
|
||||
redis = { version = "~5.0.3", extras = ["hiredis"] }
|
||||
replicate = "~0.22.0"
|
||||
resend = "~0.7.0"
|
||||
sagemaker = "2.231.0"
|
||||
scikit-learn = "~1.5.1"
|
||||
sentry-sdk = { version = "~1.44.1", extras = ["flask"] }
|
||||
sqlalchemy = "~2.0.29"
|
||||
tencentcloud-sdk-python-hunyuan = "~3.0.1158"
|
||||
tiktoken = "~0.7.0"
|
||||
tokenizers = "~0.15.0"
|
||||
transformers = "~4.35.0"
|
||||
unstructured = { version = "~0.10.27", extras = ["docx", "epub", "md", "msg", "ppt", "pptx"] }
|
||||
validators = "0.21.0"
|
||||
volcengine-python-sdk = {extras = ["ark"], version = "~1.0.98"}
|
||||
websocket-client = "~1.7.0"
|
||||
werkzeug = "~3.0.1"
|
||||
xinference-client = "0.15.2"
|
||||
yarl = "~1.9.4"
|
||||
zhipuai = "~2.1.5"
|
||||
# Before adding new dependency, consider place it in alphabet order (a-z) and suitable group.
|
||||
|
||||
############################################################
|
||||
@ -173,21 +190,28 @@ yarl = "~1.9.4"
|
||||
# Related transparent dependencies with pinned version
|
||||
# required by main implementations
|
||||
############################################################
|
||||
volcengine-python-sdk = {extras = ["ark"], version = "^1.0.98"}
|
||||
oci = "^2.133.0"
|
||||
tos = "^2.7.1"
|
||||
[tool.poetry.group.indriect.dependencies]
|
||||
[tool.poetry.group.indirect.dependencies]
|
||||
kaleido = "0.2.1"
|
||||
rank-bm25 = "~0.2.2"
|
||||
safetensors = "~0.4.3"
|
||||
|
||||
############################################################
|
||||
# [ Tools ] dependency group
|
||||
############################################################
|
||||
|
||||
[tool.poetry.group.tool.dependencies]
|
||||
[tool.poetry.group.tools.dependencies]
|
||||
arxiv = "2.1.0"
|
||||
cloudscraper = "1.2.71"
|
||||
duckduckgo-search = "~6.3.0"
|
||||
jsonpath-ng = "1.6.1"
|
||||
matplotlib = "~3.8.2"
|
||||
newspaper3k = "0.2.8"
|
||||
nltk = "3.8.1"
|
||||
numexpr = "~2.9.0"
|
||||
qrcode = "~7.4.2"
|
||||
############################################################
|
||||
# VDB dependencies required by vector store clients
|
||||
############################################################
|
||||
twilio = "~9.0.4"
|
||||
vanna = { version = "0.7.3", extras = ["postgres", "mysql", "clickhouse", "duckdb"] }
|
||||
wikipedia = "1.4.0"
|
||||
yfinance = "~0.2.40"
|
||||
|
||||
############################################################
|
||||
# [ Storage ] dependency group
|
||||
@ -246,4 +270,4 @@ pytest-mock = "~3.14.0"
|
||||
optional = true
|
||||
[tool.poetry.group.lint.dependencies]
|
||||
dotenv-linter = "~0.5.0"
|
||||
ruff = "~0.6.9"
|
||||
ruff = "~0.6.9"
|
0
api/services/plugin/github_service.py
Normal file
0
api/services/plugin/github_service.py
Normal file
@ -1,6 +1,5 @@
|
||||
import json
|
||||
import logging
|
||||
from typing import Optional
|
||||
|
||||
from httpx import get
|
||||
|
||||
|
@ -1,6 +1,5 @@
|
||||
import json
|
||||
from datetime import datetime
|
||||
from typing import Optional
|
||||
|
||||
from sqlalchemy import or_
|
||||
|
||||
|
@ -1,4 +1,3 @@
|
||||
from core.tools.__base.tool import Tool
|
||||
from core.tools.__base.tool_runtime import ToolRuntime
|
||||
from core.tools.custom_tool.tool import ApiTool
|
||||
from core.tools.entities.common_entities import I18nObject
|
||||
|
Loading…
x
Reference in New Issue
Block a user