Conversation
…Alibaba Bailian. (#3350)
* 🐛 Bugfix: Thinking content displays incorrectly after refreshing * 🧪 Add test files * 🧪 Add test files * 🧪 Add test files
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates Nexent’s versioning, streaming message buffering, and DashScope model classification logic, alongside frontend UUID generation hardening and substantial test expansions to cover the new/updated behaviors.
Changes:
- Resolve
APP_VERSIONdynamically fromVERSIONfiles (env/container/local) instead of a hardcoded constant, with dedicated unit tests. - Improve
MessageObservertoken buffering by flushing overflow as accumulated chunks to reduce message fragmentation, with new edge/overflow tests. - Rework DashScope model classification to support multi-bucket capability tagging (e.g., one model appearing in
vlm,vlm3, andllm), plus frontend updates to requestvlm2/vlm3directly.
Reviewed changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
backend/consts/const.py |
Adds version candidate enumeration + resolver and uses it to set APP_VERSION at import time. |
test/backend/consts/test_app_version.py |
Adds unit tests for the new version-resolution helpers. |
sdk/nexent/core/utils/observer.py |
Changes buffer-overflow behavior to flush accumulated content rather than one token at a time. |
test/sdk/core/utils/test_observer.py |
Adds extensive tests for observer overflow, fragmentation, flush, and edge cases. |
backend/services/providers/dashscope_provider.py |
Adds helper functions and changes model classification to allow multi-bucket membership. |
test/backend/services/providers/test_dashscope_provider.py |
Rewrites/expands provider tests to validate helper functions, new classification rules, pagination, and retry logic. |
backend/database/conversation_db.py |
Sorts units by unit_index when present to normalize ordering. |
test/backend/database/test_conversation_db.py |
Adds many tests to cover previously uncovered conversation_db branches (filters, parsing, empty cases, unit sorting). |
sdk/nexent/core/agents/agent_model.py |
Changes AgentVerificationConfig.enabled default to False. |
test/sdk/core/agents/test_agent_model.py |
Updates verification-config default expectations to match new default. |
frontend/lib/utils.ts |
Adds safeUUID() helper with crypto.randomUUID() primary + non-secure fallback. |
frontend/app/[locale]/chat/components/chatInput.tsx |
Uses safeUUID() instead of direct crypto.randomUUID() for file IDs. |
frontend/app/[locale]/agents/components/agentInfo/DebugConfig.tsx |
Uses safeUUID() instead of direct crypto.randomUUID() for file IDs. |
frontend/hooks/model/useDashscopeModelList.ts |
Stops mapping vlm2/vlm3 to vlm when building DashScope model_type requests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+213
to
+215
| # Fallback to llm when no specialized modality is present | ||
| if 'Text' in req_mod or 'Text' in res_mod: | ||
| cleaned_model.update({"model_tag": "chat", "model_type": "llm"}) | ||
| categorized_models['chat'].append(cleaned_model) | ||
| llm_model = cleaned_model.copy() |
Comment on lines
+513
to
+518
| """Return the parsed version string from ``candidate`` or ``None``. | ||
|
|
||
| Reads only the first non-blank line and strips surrounding whitespace. | ||
| Returns ``None`` if the file is missing, unreadable, or its first line | ||
| is empty after trimming. | ||
| """ |
Comment on lines
+115
to
+120
| def test_override_must_be_non_empty(self, monkeypatch): | ||
| # ``os.getenv`` with no default returns ``""`` when the var is set | ||
| # but empty; the helper should *not* treat that as a candidate. | ||
| monkeypatch.setenv("APP_VERSION_FILE", "") | ||
| candidates = [_str_path(p) for p in _collect_version_candidates()] | ||
| assert "/some/explicit/path" not in candidates |
Comment on lines
+858
to
+862
| # Should have processed content (mode behavior varies based on implementation) | ||
| # Just verify the observer doesn't crash | ||
| messages = observer.get_cached_message() | ||
| assert len(messages) >= 0 | ||
|
|
Comment on lines
+196
to
198
| # Multimodal / general-purpose types - non-exclusive, no continue. | ||
| # Each check is independent; one model can qualify for multiple buckets. | ||
| if _is_dashscope_image_generation_model(m_id, desc, req_mods, res_mods): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.