Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
30511c7
Merge pull request #78 from nodite/release
Oscaner Nov 24, 2025
15a2da1
chore(deps): bump pydantic in the production-dependencies group
dependabot[bot] Dec 1, 2025
3d0f67f
Merge pull request #80 from nodite/dependabot/pip/production-dependen…
Oscaner Dec 1, 2025
18b51c4
chore(deps-dev): bump mypy in the development-dependencies group
dependabot[bot] Dec 1, 2025
e9dc2e4
Merge pull request #79 from nodite/dependabot/pip/development-depende…
Oscaner Dec 1, 2025
7537aaa
chore(deps-dev): bump the development-dependencies group across 1 dir…
dependabot[bot] Dec 15, 2025
871e841
Merge pull request #83 from nodite/dependabot/pip/development-depende…
Oscaner Dec 18, 2025
1f32b8a
ci(deps): bump actions/cache from 4 to 5
dependabot[bot] Dec 15, 2025
29f02a4
Merge pull request #82 from nodite/dependabot/github_actions/actions/…
Oscaner Dec 18, 2025
91f0556
chore(deps-dev): bump the development-dependencies group with 2 updates
dependabot[bot] Dec 22, 2025
8ea9aa4
Merge pull request #84 from nodite/dependabot/pip/development-depende…
Oscaner Dec 25, 2025
b9ef288
chore(deps-dev): bump filelock from 3.19.1 to 3.20.1
dependabot[bot] Jan 6, 2026
93cf85c
Merge pull request #85 from nodite/dependabot/pip/filelock-3.20.1
Oscaner Jan 6, 2026
ba6c468
chore(deps): update ruff to version 0.14.10 and related dependencies
Oscaner Jan 8, 2026
0616796
chore(deps-dev): bump ruff in the development-dependencies group
dependabot[bot] Jan 12, 2026
9534c12
style: update type annotations to modern Python syntax
Oscaner Jan 12, 2026
66624c7
Merge pull request #86 from nodite/dependabot/pip/development-depende…
Oscaner Jan 12, 2026
3e964af
refactor: migrate pre-commit config to local mode with unified tool c…
Oscaner Jan 20, 2026
46933a6
ci: update linting configuration in workflows and pre-commit
Oscaner Jan 20, 2026
3f56bdc
chore(deps-dev): bump black from 25.12.0 to 26.1.0
dependabot[bot] Jan 20, 2026
5fa1fa8
Merge pull request #88 from nodite/dependabot/pip/black-26.1.0
Oscaner Jan 20, 2026
1a6b5b8
chore(deps-dev): bump ruff in the development-dependencies group
dependabot[bot] Jan 20, 2026
ce74a4c
Merge pull request #87 from nodite/dependabot/pip/development-depende…
Oscaner Jan 20, 2026
fceeec5
chore(deps-dev): bump filelock from 3.20.1 to 3.20.3
dependabot[bot] Jan 20, 2026
30e997c
Merge pull request #89 from nodite/dependabot/pip/filelock-3.20.3
Oscaner Jan 20, 2026
08e0d2a
chore(deps-dev): bump virtualenv from 20.34.0 to 20.36.1
dependabot[bot] Jan 20, 2026
2d6c8af
Merge pull request #90 from nodite/dependabot/pip/virtualenv-20.36.1
Oscaner Jan 20, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,19 @@ jobs:

- name: Load cached venv
id: cached-poetry-dependencies
uses: actions/cache@v4
uses: actions/cache@v5
with:
path: .venv
key: venv-${{ runner.os }}-${{ matrix.python-version }}-${{ hashFiles('**/poetry.lock') }}

- name: Install dependencies
if: steps.cached-poetry-dependencies.outputs.cache-hit != 'true'
run: poetry install --with dev,format

- name: Run linting
run: |
poetry run ruff check .
poetry run mypy .
poetry run pylint .

- name: Run tests
run: poetry run pytest tests/ -v --tb=short
Expand Down
56 changes: 37 additions & 19 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,29 +1,47 @@
repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.12.11
- repo: local
hooks:
- id: ruff
args: [--config=pyproject.toml]
- id: ruff-check
name: ruff check
entry: poetry run ruff check .
language: system
pass_filenames: false
always_run: true

- id: ruff-format
args: [--config=pyproject.toml]
name: ruff format
entry: poetry run ruff format .
language: system
pass_filenames: false
always_run: true

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.17.1
hooks:
- id: mypy
args: [--config-file=pyproject.toml]
files: ^dify_oapi/
exclude: ^(examples/|tests/)
name: mypy
entry: poetry run mypy .
language: system
pass_filenames: false
always_run: true

- repo: https://github.com/pylint-dev/pylint
rev: v3.3.8
hooks:
- id: pylint
args: [--rcfile=pyproject.toml]
files: ^dify_oapi/
name: pylint
entry: poetry run pylint .
language: system
pass_filenames: false
always_run: true

- repo: https://github.com/commitizen-tools/commitizen
rev: v4.8.3
hooks:
- id: commitizen
name: commitizen check
entry: poetry run cz check
language: system
stages: [commit-msg]
args: [--commit-msg-file]
pass_filenames: true

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v6.0.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
- id: check-merge-conflict
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,4 @@
"problemMatcher": []
}
]
}
}
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
recursive-include dify_oapi *.py
recursive-include dify_oapi *.py
1 change: 0 additions & 1 deletion dify_oapi/api/chat/v1/resource/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@

2 changes: 1 addition & 1 deletion dify_oapi/api/chatflow/v1/model/chatflow_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

# Response mode types for chat messages
ResponseMode = Literal["streaming", "blocking"]
"""Response mode for chat messages.
"""Response mode for chat messages.
- streaming: Real-time streaming response
- blocking: Complete response after processing (Cloudflare timeout is 100s)
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

class SendChatMessageRequestBody(BaseModel):
query: str | None = None
#TODO: Create a more specific models for inputs values
# TODO: Create a more specific models for inputs values
inputs: dict[str, Any] | None = None
response_mode: ResponseMode | None = None
user: str | None = None
Expand Down
6 changes: 2 additions & 4 deletions dify_oapi/api/chatflow/v1/model/tool_icon.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
from typing import Union

from pydantic import BaseModel


Expand Down Expand Up @@ -29,7 +27,7 @@ def content(self, content: str) -> "ToolIconDetailBuilder":


class AppMeta(BaseModel):
tool_icons: dict[str, Union[str, ToolIconDetail]] | None = None
tool_icons: dict[str, str | ToolIconDetail] | None = None

@staticmethod
def builder() -> "AppMetaBuilder":
Expand All @@ -43,6 +41,6 @@ def __init__(self):
def build(self) -> AppMeta:
return self._app_meta

def tool_icons(self, tool_icons: dict[str, Union[str, ToolIconDetail]]) -> "AppMetaBuilder":
def tool_icons(self, tool_icons: dict[str, str | ToolIconDetail]) -> "AppMetaBuilder":
self._app_meta.tool_icons = tool_icons
return self
26 changes: 12 additions & 14 deletions dify_oapi/api/knowledge/v1/model/batch_info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Batch information model for Knowledge Base API."""

from typing import Optional

from pydantic import BaseModel

from .knowledge_types import IndexingStatus
Expand All @@ -10,18 +8,18 @@
class BatchInfo(BaseModel):
"""Batch information model with builder pattern."""

id: Optional[str] = None
indexing_status: Optional[IndexingStatus] = None
processing_started_at: Optional[float] = None
parsing_completed_at: Optional[float] = None
cleaning_completed_at: Optional[float] = None
splitting_completed_at: Optional[float] = None
completed_at: Optional[float] = None
paused_at: Optional[float] = None
error: Optional[str] = None
stopped_at: Optional[float] = None
completed_segments: Optional[int] = None
total_segments: Optional[int] = None
id: str | None = None
indexing_status: IndexingStatus | None = None
processing_started_at: float | None = None
parsing_completed_at: float | None = None
cleaning_completed_at: float | None = None
splitting_completed_at: float | None = None
completed_at: float | None = None
paused_at: float | None = None
error: str | None = None
stopped_at: float | None = None
completed_segments: int | None = None
total_segments: int | None = None

@staticmethod
def builder() -> "BatchInfoBuilder":
Expand Down
32 changes: 15 additions & 17 deletions dify_oapi/api/knowledge/v1/model/child_chunk_info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Child chunk information model for Knowledge Base API."""

from typing import Optional

from pydantic import BaseModel

from .knowledge_types import ChunkStatus
Expand All @@ -10,21 +8,21 @@
class ChildChunkInfo(BaseModel):
"""Child chunk information model with builder pattern."""

id: Optional[str] = None
segment_id: Optional[str] = None
content: Optional[str] = None
word_count: Optional[int] = None
tokens: Optional[int] = None
keywords: Optional[list[str]] = None
index_node_id: Optional[str] = None
index_node_hash: Optional[str] = None
status: Optional[ChunkStatus] = None
created_by: Optional[str] = None
created_at: Optional[float] = None
indexing_at: Optional[float] = None
completed_at: Optional[float] = None
error: Optional[str] = None
stopped_at: Optional[float] = None
id: str | None = None
segment_id: str | None = None
content: str | None = None
word_count: int | None = None
tokens: int | None = None
keywords: list[str] | None = None
index_node_id: str | None = None
index_node_hash: str | None = None
status: ChunkStatus | None = None
created_by: str | None = None
created_at: float | None = None
indexing_at: float | None = None
completed_at: float | None = None
error: str | None = None
stopped_at: float | None = None

@staticmethod
def builder() -> "ChildChunkInfoBuilder":
Expand Down
18 changes: 8 additions & 10 deletions dify_oapi/api/knowledge/v1/model/data_source_detail.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,21 @@
"""Data source detail models."""

from typing import Optional

from pydantic import BaseModel


class UploadFileDetail(BaseModel):
"""Upload file detail information."""

id: Optional[str] = None
name: Optional[str] = None
size: Optional[int] = None
extension: Optional[str] = None
mime_type: Optional[str] = None
created_by: Optional[str] = None
created_at: Optional[float] = None
id: str | None = None
name: str | None = None
size: int | None = None
extension: str | None = None
mime_type: str | None = None
created_by: str | None = None
created_at: float | None = None


class DataSourceDetailDict(BaseModel):
"""Data source detail dictionary."""

upload_file: Optional[UploadFileDetail] = None
upload_file: UploadFileDetail | None = None
6 changes: 2 additions & 4 deletions dify_oapi/api/knowledge/v1/model/data_source_info.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
"""Data source info model for Knowledge Base API."""

from typing import Optional

from pydantic import BaseModel


class DataSourceInfo(BaseModel):
"""Data source info model with builder pattern."""

upload_file_id: Optional[str] = None
original_document_id: Optional[str] = None
upload_file_id: str | None = None
original_document_id: str | None = None

@staticmethod
def builder() -> "DataSourceInfoBuilder":
Expand Down
50 changes: 24 additions & 26 deletions dify_oapi/api/knowledge/v1/model/dataset_info.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Dataset information model for Knowledge Base API."""

from typing import Optional

from pydantic import BaseModel

from .dataset_metadata import DatasetMetadata
Expand All @@ -15,30 +13,30 @@
class DatasetInfo(BaseModel):
"""Dataset information model with builder pattern."""

id: Optional[str] = None
name: Optional[str] = None
description: Optional[str] = None
provider: Optional[str] = None
permission: Optional[Permission] = None
data_source_type: Optional[DataSourceType] = None
indexing_technique: Optional[IndexingTechnique] = None
app_count: Optional[int] = None
document_count: Optional[int] = None
word_count: Optional[int] = None
created_by: Optional[str] = None
created_at: Optional[int] = None
updated_by: Optional[str] = None
updated_at: Optional[int] = None
embedding_model: Optional[str] = None
embedding_model_provider: Optional[str] = None
embedding_available: Optional[bool] = None
retrieval_model_dict: Optional[RetrievalModel] = None
tags: Optional[list[TagInfo]] = None
doc_form: Optional[DocumentForm] = None
external_knowledge_info: Optional[ExternalKnowledgeInfo] = None
external_retrieval_model: Optional[ExternalRetrievalModel] = None
doc_metadata: Optional[list[DatasetMetadata]] = None
built_in_field_enabled: Optional[bool] = None
id: str | None = None
name: str | None = None
description: str | None = None
provider: str | None = None
permission: Permission | None = None
data_source_type: DataSourceType | None = None
indexing_technique: IndexingTechnique | None = None
app_count: int | None = None
document_count: int | None = None
word_count: int | None = None
created_by: str | None = None
created_at: int | None = None
updated_by: str | None = None
updated_at: int | None = None
embedding_model: str | None = None
embedding_model_provider: str | None = None
embedding_available: bool | None = None
retrieval_model_dict: RetrievalModel | None = None
tags: list[TagInfo] | None = None
doc_form: DocumentForm | None = None
external_knowledge_info: ExternalKnowledgeInfo | None = None
external_retrieval_model: ExternalRetrievalModel | None = None
doc_metadata: list[DatasetMetadata] | None = None
built_in_field_enabled: bool | None = None

@staticmethod
def builder() -> "DatasetInfoBuilder":
Expand Down
6 changes: 2 additions & 4 deletions dify_oapi/api/knowledge/v1/model/dataset_metadata.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"""Dataset metadata model."""

from typing import Optional

from pydantic import BaseModel


Expand All @@ -10,5 +8,5 @@ class DatasetMetadata(BaseModel):

# Based on API response, this is typically an empty array
# Can be extended when actual metadata structure is known
key: Optional[str] = None
value: Optional[str] = None
key: str | None = None
value: str | None = None
Loading