Commit Graph

72 Commits

Author SHA1 Message Date
Harry 3f1899a1dd feat(session): session context and tool backwards invocation credential support 2025-07-13 01:33:41 +08:00
Harry 2aedda0652 chore: fix ruff issue 2025-07-06 16:37:04 +08:00
kurokobo c61fa1282a fix: improve buffer handling for multimodal input (#128)
* fix: improve buffer handling

* tests:add tests for StdioRequestReader

- Introduced a new private method `_read_async` to handle asynchronous reading from stdin.
- Updated `_read_stream` to utilize the new `_read_async` method for improved code clarity and maintainability.
- Added a new test file `test_stdio.py` to validate the functionality of the StdioRequestReader, ensuring correct handling of input data streams.

* fix: remove useless code

* fix: handle empty lines in StdioRequestReader

- Updated the StdioRequestReader to strip and skip empty lines during input processing.
- Added a new test to validate the handling of empty lines, ensuring the reader correctly processes a stream with mixed content.

* apply ruff

---------

Co-authored-by: Yeuoly <admin@srmxy.cn>
2025-05-06 16:37:41 +08:00
Darlewo a35cb4c5e6 fix: remove unnecessary locking in _recv_from_sock method (#125) 2025-04-30 15:40:48 +08:00
Chieh Wang 8b63710a06 fix: debug mode cannot get app_id (#106) 2025-04-25 13:51:21 +08:00
Yeuoly 9c324aab14 optimize: replace json.loads with TypeAdapter for JSON unmarshaling (#103)
* refactor: replace json.loads with TypeAdapter for JSON validation in request readers and model

- Updated JSON parsing in BackwardsInvocation, StdioRequestReader, and TCPReaderWriter to use TypeAdapter for improved validation.
- Enhanced error handling in OAICompatLargeLanguageModel by replacing json.loads with TypeAdapter, ensuring better compliance with expected JSON schema.

* fix: linter
2025-04-17 16:31:40 +08:00
QuantumGhost 5cb24625c3 ci(python): Add CI Pipeline for Python SDK (#72)
* 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
2025-04-14 20:25:19 +08:00
晴天娃娃 94e36a4e48 Fix: Convert shared class variables to instance variables in RequestReader to solve lock contention and CPU deadlock issues (#81) 2025-04-11 15:20:35 +08:00
Yeuoly 957aab49cd fix: improve gevent socket connection handling, avoid blocking except… (#86)
* fix: improve gevent socket connection handling, avoid blocking exceptions

* fix: enhance TCP socket handling with thread safety and improved data transmission
2025-04-10 13:42:35 +08:00
helojo 996ca2af6c socket recv cache up to 1M (#75)
Co-authored-by: zqgame <zqgame@zqgame.local>
2025-04-07 11:14:52 +09:00
QuantumGhost 22ae421dd6 feat(python): Integrate flake8-builtins (A) ruleset with ruff (#66)
Introduce the flake8-builtins (A) ruleset to prevent accidental shadowing
of Python's built-in functions.

Address existing issues primarily by adding `# noqa` to suppress warnings where necessary.
2025-03-24 18:58:50 +08:00
Yeuoly eb19d27501 feat: Add connection lifetime timeout for serverless request reader (#38)
- Implement timeout mechanism for single connection lifetime
- Prevent indefinite blocking on queue retrieval
- Refresh connection timer on each successful response
- Handle queue timeout gracefully
2025-03-12 17:57:15 +08:00
Yeuoly b936b1be9f fix: flush output when initialize 2025-03-07 16:14:16 +08:00
Yeuoly 7cb4b8a00a chore: Bump version to 0.0.1-beta71 and add server startup logging 2025-03-06 17:53:03 +08:00
Yeuoly 7e29231d24 fix: replace flask.run with gevent.pywsgi.WSGIServer 2025-03-06 17:50:06 +08:00
Yeuoly 0354eda546 feat: Add health check endpoint and token counting optimization 2025-03-04 15:48:14 +08:00
Yeuoly 46c029bf65 refactor: aws_lambda to serverless 2025-02-10 14:58:05 +08:00
Yeuoly f69257db40 fix: add AWS_LAMBDA_HOST 2025-01-21 14:32:12 +08:00
Yeuoly e6b20c91b9 fix: exit smoothly 2024-12-10 00:21:27 +08:00
Yeuoly 435c0da60e refactor: use absolute paths 2024-12-03 15:19:19 +08:00
-LAN- 71b5791c2c chore: Remove unused variables
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 22:20:45 +08:00
-LAN- da41fbf0ab refactor: suppressible-exception
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 22:13:06 +08:00
-LAN- 061cf9e456 chore: prevent if-else-block-instead-of-if-exp
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 22:05:48 +08:00
-LAN- 105606e34b refactor: Remove un-needed bool
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 21:53:23 +08:00
-LAN- b3e0612e53 chore: Apply format
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 21:18:36 +08:00
-LAN- 37128aeadd chore: Apply unsafe auto-fixes and check manually
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 21:17:21 +08:00
-LAN- 5858fe715e chore: Apply formet and auto fix
Signed-off-by: -LAN- <laipz8200@outlook.com>
2024-12-02 21:10:36 +08:00
Yeuoly 642308f123 feat: support detail logs for DEBUGGING 2024-12-02 14:10:00 +08:00
Yeuoly 9bddcd4745 fix: decoding error when chunking messages 2024-11-15 19:27:35 +08:00
Yeuoly e71e7575d7 fix: endless aws transaction 2024-11-08 21:22:18 +08:00
Yeuoly 0ad327fa7f feat: automatically exit when parent process has dead 2024-11-05 20:59:36 +08:00
Yeuoly c10330ebea feat: colorful warnings 2024-11-05 20:46:01 +08:00
Yeuoly 37b1fcace4 refactor: initialization process 2024-11-05 16:43:39 +08:00
Yeuoly 041df019b0 feat: add app_id/conversation_id/message_id/endpoint_id into sessions 2024-10-16 15:22:08 +08:00
Yeuoly efac3f6365 cleanup 2024-09-29 14:02:00 +08:00
Yeuoly 57dc0ef655 refactor: add detailed args to error session message 2024-09-29 12:40:11 +08:00
Yeuoly c325ff7193 fix: aws runtime lifetime 2024-09-12 23:18:23 +08:00
Yeuoly 69fe86e029 release: beta 2024-09-11 16:19:46 +08:00
Yeuoly 3ac5a201e1 fix: relative import 2024-09-11 15:45:53 +08:00
takatost f611636766 remove unused files 2024-09-04 19:51:15 +08:00
takatost 26d3b944b3 Merge remote-tracking branch 'origin/main'
# Conflicts:
#	python/dify_plugin/core/runtime/abstract/request.py
#	python/dify_plugin/core/runtime/request.py
#	python/dify_plugin/plugin.py
2024-08-30 03:31:24 +08:00
takatost a6d55f604d refactor: move runtime request into separate modules 2024-08-30 03:28:09 +08:00
Yeuoly 3d3e6fbd9b feat: support persistence storage 2024-08-29 01:27:10 +08:00
Yeuoly 83b0cf34dc feat: add logger to tcp stream 2024-08-28 12:49:22 +08:00
Yeuoly fba4ee198a fix 2024-08-27 18:07:18 +08:00
Yeuoly 73ab4e0c49 fix 2024-08-27 17:20:52 +08:00
Yeuoly 55443ac092 refactor: move entities to core 2024-08-27 17:09:38 +08:00
Yeuoly 8a471941dc refactor 2024-08-27 12:45:00 +08:00
Yeuoly 9ea78ed55d feat: aws http backwards invoke 2024-08-26 13:14:58 +08:00
Yeuoly 2ff7635ae6 refactor: plugin stream reader 2024-08-26 10:33:19 +08:00