chore: bump version from 1.7.2 to 1.8.0 (#24539)
Signed-off-by: -LAN- <laipz8200@outlook.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "dify-api"
|
name = "dify-api"
|
||||||
version = "1.7.2"
|
version = "1.8.0"
|
||||||
requires-python = ">=3.11,<3.13"
|
requires-python = ">=3.11,<3.13"
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
@@ -42,7 +42,7 @@ IMPORT_INFO_REDIS_KEY_PREFIX = "app_import_info:"
|
|||||||
CHECK_DEPENDENCIES_REDIS_KEY_PREFIX = "app_check_dependencies:"
|
CHECK_DEPENDENCIES_REDIS_KEY_PREFIX = "app_check_dependencies:"
|
||||||
IMPORT_INFO_REDIS_EXPIRY = 10 * 60 # 10 minutes
|
IMPORT_INFO_REDIS_EXPIRY = 10 * 60 # 10 minutes
|
||||||
DSL_MAX_SIZE = 10 * 1024 * 1024 # 10MB
|
DSL_MAX_SIZE = 10 * 1024 * 1024 # 10MB
|
||||||
CURRENT_DSL_VERSION = "0.3.1"
|
CURRENT_DSL_VERSION = "0.4.0"
|
||||||
|
|
||||||
|
|
||||||
class ImportMode(StrEnum):
|
class ImportMode(StrEnum):
|
||||||
|
@@ -144,127 +144,6 @@ class TestAppDslService:
|
|||||||
}
|
}
|
||||||
return yaml.dump(yaml_data, allow_unicode=True)
|
return yaml.dump(yaml_data, allow_unicode=True)
|
||||||
|
|
||||||
def test_import_app_yaml_content_success(self, db_session_with_containers, mock_external_service_dependencies):
|
|
||||||
"""
|
|
||||||
Test successful app import from YAML content.
|
|
||||||
"""
|
|
||||||
fake = Faker()
|
|
||||||
app, account = self._create_test_app_and_account(db_session_with_containers, mock_external_service_dependencies)
|
|
||||||
|
|
||||||
# Create YAML content
|
|
||||||
yaml_content = self._create_simple_yaml_content(fake.company(), "chat")
|
|
||||||
|
|
||||||
# Import app
|
|
||||||
dsl_service = AppDslService(db_session_with_containers)
|
|
||||||
result = dsl_service.import_app(
|
|
||||||
account=account,
|
|
||||||
import_mode=ImportMode.YAML_CONTENT,
|
|
||||||
yaml_content=yaml_content,
|
|
||||||
name="Imported App",
|
|
||||||
description="Imported app description",
|
|
||||||
)
|
|
||||||
|
|
||||||
# Verify import result
|
|
||||||
assert result.status == ImportStatus.COMPLETED
|
|
||||||
assert result.app_id is not None
|
|
||||||
assert result.app_mode == "chat"
|
|
||||||
assert result.imported_dsl_version == "0.3.0"
|
|
||||||
assert result.error == ""
|
|
||||||
|
|
||||||
# Verify app was created in database
|
|
||||||
imported_app = db_session_with_containers.query(App).filter(App.id == result.app_id).first()
|
|
||||||
assert imported_app is not None
|
|
||||||
assert imported_app.name == "Imported App"
|
|
||||||
assert imported_app.description == "Imported app description"
|
|
||||||
assert imported_app.mode == "chat"
|
|
||||||
assert imported_app.tenant_id == account.current_tenant_id
|
|
||||||
assert imported_app.created_by == account.id
|
|
||||||
|
|
||||||
# Verify model config was created
|
|
||||||
model_config = (
|
|
||||||
db_session_with_containers.query(AppModelConfig).filter(AppModelConfig.app_id == result.app_id).first()
|
|
||||||
)
|
|
||||||
assert model_config is not None
|
|
||||||
# The provider and model_id are stored in the model field as JSON
|
|
||||||
model_dict = model_config.model_dict
|
|
||||||
assert model_dict["provider"] == "openai"
|
|
||||||
assert model_dict["name"] == "gpt-3.5-turbo"
|
|
||||||
|
|
||||||
def test_import_app_yaml_url_success(self, db_session_with_containers, mock_external_service_dependencies):
|
|
||||||
"""
|
|
||||||
Test successful app import from YAML URL.
|
|
||||||
"""
|
|
||||||
fake = Faker()
|
|
||||||
app, account = self._create_test_app_and_account(db_session_with_containers, mock_external_service_dependencies)
|
|
||||||
|
|
||||||
# Create YAML content for mock response
|
|
||||||
yaml_content = self._create_simple_yaml_content(fake.company(), "chat")
|
|
||||||
|
|
||||||
# Setup mock response
|
|
||||||
mock_response = MagicMock()
|
|
||||||
mock_response.content = yaml_content.encode("utf-8")
|
|
||||||
mock_response.raise_for_status.return_value = None
|
|
||||||
mock_external_service_dependencies["ssrf_proxy"].get.return_value = mock_response
|
|
||||||
|
|
||||||
# Import app from URL
|
|
||||||
dsl_service = AppDslService(db_session_with_containers)
|
|
||||||
result = dsl_service.import_app(
|
|
||||||
account=account,
|
|
||||||
import_mode=ImportMode.YAML_URL,
|
|
||||||
yaml_url="https://example.com/app.yaml",
|
|
||||||
name="URL Imported App",
|
|
||||||
description="App imported from URL",
|
|
||||||
)
|
|
||||||
|
|
||||||
# Verify import result
|
|
||||||
assert result.status == ImportStatus.COMPLETED
|
|
||||||
assert result.app_id is not None
|
|
||||||
assert result.app_mode == "chat"
|
|
||||||
assert result.imported_dsl_version == "0.3.0"
|
|
||||||
assert result.error == ""
|
|
||||||
|
|
||||||
# Verify app was created in database
|
|
||||||
imported_app = db_session_with_containers.query(App).filter(App.id == result.app_id).first()
|
|
||||||
assert imported_app is not None
|
|
||||||
assert imported_app.name == "URL Imported App"
|
|
||||||
assert imported_app.description == "App imported from URL"
|
|
||||||
assert imported_app.mode == "chat"
|
|
||||||
assert imported_app.tenant_id == account.current_tenant_id
|
|
||||||
|
|
||||||
# Verify ssrf_proxy was called
|
|
||||||
mock_external_service_dependencies["ssrf_proxy"].get.assert_called_once_with(
|
|
||||||
"https://example.com/app.yaml", follow_redirects=True, timeout=(10, 10)
|
|
||||||
)
|
|
||||||
|
|
||||||
def test_import_app_invalid_yaml_format(self, db_session_with_containers, mock_external_service_dependencies):
|
|
||||||
"""
|
|
||||||
Test app import with invalid YAML format.
|
|
||||||
"""
|
|
||||||
fake = Faker()
|
|
||||||
app, account = self._create_test_app_and_account(db_session_with_containers, mock_external_service_dependencies)
|
|
||||||
|
|
||||||
# Create invalid YAML content
|
|
||||||
invalid_yaml = "invalid: yaml: content: ["
|
|
||||||
|
|
||||||
# Import app with invalid YAML
|
|
||||||
dsl_service = AppDslService(db_session_with_containers)
|
|
||||||
result = dsl_service.import_app(
|
|
||||||
account=account,
|
|
||||||
import_mode=ImportMode.YAML_CONTENT,
|
|
||||||
yaml_content=invalid_yaml,
|
|
||||||
name="Invalid App",
|
|
||||||
)
|
|
||||||
|
|
||||||
# Verify import failed
|
|
||||||
assert result.status == ImportStatus.FAILED
|
|
||||||
assert result.app_id is None
|
|
||||||
assert "Invalid YAML format" in result.error
|
|
||||||
assert result.imported_dsl_version == ""
|
|
||||||
|
|
||||||
# Verify no app was created in database
|
|
||||||
apps_count = db_session_with_containers.query(App).filter(App.tenant_id == account.current_tenant_id).count()
|
|
||||||
assert apps_count == 1 # Only the original test app
|
|
||||||
|
|
||||||
def test_import_app_missing_yaml_content(self, db_session_with_containers, mock_external_service_dependencies):
|
def test_import_app_missing_yaml_content(self, db_session_with_containers, mock_external_service_dependencies):
|
||||||
"""
|
"""
|
||||||
Test app import with missing YAML content.
|
Test app import with missing YAML content.
|
||||||
|
4304
api/uv.lock
generated
4304
api/uv.lock
generated
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,7 @@ x-shared-env: &shared-api-worker-env
|
|||||||
services:
|
services:
|
||||||
# API service
|
# API service
|
||||||
api:
|
api:
|
||||||
image: langgenius/dify-api:1.7.2
|
image: langgenius/dify-api:1.8.0
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
# Use the shared environment variables.
|
# Use the shared environment variables.
|
||||||
@@ -31,7 +31,7 @@ services:
|
|||||||
# worker service
|
# worker service
|
||||||
# The Celery worker for processing the queue.
|
# The Celery worker for processing the queue.
|
||||||
worker:
|
worker:
|
||||||
image: langgenius/dify-api:1.7.2
|
image: langgenius/dify-api:1.8.0
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
# Use the shared environment variables.
|
# Use the shared environment variables.
|
||||||
@@ -58,7 +58,7 @@ services:
|
|||||||
# worker_beat service
|
# worker_beat service
|
||||||
# Celery beat for scheduling periodic tasks.
|
# Celery beat for scheduling periodic tasks.
|
||||||
worker_beat:
|
worker_beat:
|
||||||
image: langgenius/dify-api:1.7.2
|
image: langgenius/dify-api:1.8.0
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
# Use the shared environment variables.
|
# Use the shared environment variables.
|
||||||
@@ -76,7 +76,7 @@ services:
|
|||||||
|
|
||||||
# Frontend web application.
|
# Frontend web application.
|
||||||
web:
|
web:
|
||||||
image: langgenius/dify-web:1.7.2
|
image: langgenius/dify-web:1.8.0
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
CONSOLE_API_URL: ${CONSOLE_API_URL:-}
|
CONSOLE_API_URL: ${CONSOLE_API_URL:-}
|
||||||
|
@@ -580,7 +580,7 @@ x-shared-env: &shared-api-worker-env
|
|||||||
services:
|
services:
|
||||||
# API service
|
# API service
|
||||||
api:
|
api:
|
||||||
image: langgenius/dify-api:1.7.2
|
image: langgenius/dify-api:1.8.0
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
# Use the shared environment variables.
|
# Use the shared environment variables.
|
||||||
@@ -609,7 +609,7 @@ services:
|
|||||||
# worker service
|
# worker service
|
||||||
# The Celery worker for processing the queue.
|
# The Celery worker for processing the queue.
|
||||||
worker:
|
worker:
|
||||||
image: langgenius/dify-api:1.7.2
|
image: langgenius/dify-api:1.8.0
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
# Use the shared environment variables.
|
# Use the shared environment variables.
|
||||||
@@ -636,7 +636,7 @@ services:
|
|||||||
# worker_beat service
|
# worker_beat service
|
||||||
# Celery beat for scheduling periodic tasks.
|
# Celery beat for scheduling periodic tasks.
|
||||||
worker_beat:
|
worker_beat:
|
||||||
image: langgenius/dify-api:1.7.2
|
image: langgenius/dify-api:1.8.0
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
# Use the shared environment variables.
|
# Use the shared environment variables.
|
||||||
@@ -654,7 +654,7 @@ services:
|
|||||||
|
|
||||||
# Frontend web application.
|
# Frontend web application.
|
||||||
web:
|
web:
|
||||||
image: langgenius/dify-web:1.7.2
|
image: langgenius/dify-web:1.8.0
|
||||||
restart: always
|
restart: always
|
||||||
environment:
|
environment:
|
||||||
CONSOLE_API_URL: ${CONSOLE_API_URL:-}
|
CONSOLE_API_URL: ${CONSOLE_API_URL:-}
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "dify-web",
|
"name": "dify-web",
|
||||||
"version": "1.7.2",
|
"version": "1.8.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"packageManager": "pnpm@10.15.0",
|
"packageManager": "pnpm@10.15.0",
|
||||||
"engines": {
|
"engines": {
|
||||||
|
Reference in New Issue
Block a user