Skip to content

refactor(memory-config): refactor memory config to use workspace models and remove reflection model - #1994

Merged
keeees merged 1 commit into
developfrom
feature/memory_model_config
Aug 12, 2026
Merged

refactor(memory-config): refactor memory config to use workspace models and remove reflection model#1994
keeees merged 1 commit into
developfrom
feature/memory_model_config

Conversation

@myhMARS

@myhMARS myhMARS commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Summary by Sourcery

对内存相关配置与工作区级模型设置进行对齐,简化反射/情绪/抽取配置,并改进 Redis 缓存及缓存失效工具。

New Features:

  • 暴露用于 Redis 支持的缓存的同步缓存失效辅助方法,以补充现有的异步 API。

Bug Fixes:

  • 确保反射、情绪和抽取端点在配置缺失或使用过期配置 ID 时,能够一致地回退到工作区 LLM 及相关模型。

Enhancements:

  • 使用工作区模型字段加载内存、反射、情绪和抽取配置,而非基于每个配置的模型 ID。
  • 标准化内存配置的 Redis 缓存键,并在缓存反序列化中支持 UUID 类型。
  • 重构缓存失效逻辑,在异步和同步路径之间共享 SCAN+UNLINK 行为,并改进参数校验。
  • 更新工作区模型配置更新流程,以主动使相关内存及存储类型缓存失效。

Documentation:

  • 调整 API 和模式文档,移除每个配置的模型 ID 字段,并明确情绪配置中的必填字段。

Chores:

  • 从模式、控制器和仓库中移除未使用的反射和情绪模型 ID 处理,以减少配置表面面积。
Original summary in English

Summary by Sourcery

Align memory-related configuration with workspace-level model settings, simplify reflection/emotion/extraction configs, and improve Redis caching and cache invalidation utilities.

New Features:

  • Expose synchronous cache invalidation helper for Redis-backed caches to complement the existing async API.

Bug Fixes:

  • Ensure reflection, emotion, and extraction endpoints fall back consistently to workspace LLM and related models instead of relying on stale or missing per-config IDs.

Enhancements:

  • Load memory, reflection, emotion, and extraction configurations using workspace model fields instead of per-config model IDs.
  • Standardize Redis cache keys for memory configs and support UUID types in cache deserialization.
  • Refactor cache invalidation logic to share SCAN+UNLINK behavior between async and sync paths and to improve parameter validation.
  • Update workspace model configuration updates to proactively invalidate related memory and storage-type caches.

Documentation:

  • Adjust API and schema documentation to remove per-config model ID fields and clarify required emotion configuration fields.

Chores:

  • Remove unused reflection and emotion model ID handling from schemas, controllers, and repositories to reduce configuration surface area.

…ls and remove reflection model

- Remove reflection_model_id from memory config schema, repository, and service
- Resolve embedding, llm, rerank, vision, and audio models from workspace defaults instead of per-config overrides
- Update redis_cache to support UUID return types and add shared invalidation helpers
- Switch emotion_config_service to AsyncSession and drop emotion_model_id validation
@myhMARS
myhMARS requested a review from keeees August 11, 2026 08:57
@myhMARS myhMARS self-assigned this Aug 11, 2026
@myhMARS myhMARS added enhancement New feature or request feature New feature labels Aug 11, 2026
@sourcery-ai

sourcery-ai Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

审阅者指南(Reviewer's Guide)

重构了内存(memory)及相关配置,使其依赖工作区(workspace)级别的模型分配,而不是每个配置的模型 ID;改进了 Redis 缓存行为及失效逻辑;并从 API 和存储中移除了显式的反思(reflection)/情绪(emotion)模型配置,改为依赖工作区模型。

使用工作区 LLM 模型的 reflection_run 时序图

sequenceDiagram
    actor User
    participant MemoryReflectionController
    participant MemoryConfigRepository
    participant Workspace
    participant ModelConfigService

    User->>MemoryReflectionController: reflection_run(config_id)
    MemoryReflectionController->>MemoryConfigRepository: get_config_with_workspace_async(config_id)
    MemoryConfigRepository-->>MemoryReflectionController: (MemoryConfig, Workspace)
    MemoryReflectionController->>Workspace: read llm
    Workspace-->>MemoryReflectionController: llm_id
    MemoryReflectionController->>ModelConfigService: get_model_by_id_async(db, model_id=llm_id, tenant_id)
    ModelConfigService-->>MemoryReflectionController: model details
    MemoryReflectionController-->>User: reflection result (using workspace.llm)
Loading

文件级变更(File-Level Changes)

变更 详情 文件
内存配置加载现在会直接从工作区模型设置中解析所有模型(LLM、embedding、rerank、vision、audio、video),并相应更新 Redis 缓存键和选项。
  • 移除了同步与异步的 _validate_model_with_fallback 辅助方法,并将其使用处替换为基于工作区模型的 validate_and_resolve_model_id(_async) 直接调用
  • 修改 load_memory_configload_memory_config_async,忽略每个配置自身的模型 ID,改为验证 workspace.llm/embedding/rerank/vision/audio/video
  • 调整 rerank 校验日志,仅依赖 workspace.rerank,并将 Redis 缓存装饰器切换为使用前缀 'memory_config'id_arg='config_id'
api/app/services/memory_config_service.py
Redis 缓存工具增强了返回类型处理能力并抽取了通用的失效逻辑,同时新增了一个供工作区更新使用的同步失效助手。
  • 扩展 redis_cache 支持通过字符串反序列化 UUID 返回类型
  • 将缓存失效逻辑重构为共享辅助函数(_resolve_invalidation_scan_unlink_async_scan_unlink_sync),由 invalidate_cache 和新的 invalidate_cache_sync 复用
  • 更新异步 invalidate_cache,通过共享扫描辅助函数记录被删除键的数量
api/app/utils/redis_cache.py
反思配置不再存储或接收专用的 reflection_model_id,而是始终从工作区 LLM 配置中派生模型。
  • 简化反思配置创建辅助函数,使其总是从 workspace_models.llm 获取 reflection_model_id,并忽略任何传入的 reflection_model_id
  • 更新反思控制器和仓库,移除 reflection_model_id 的持久化,并在 API 响应中将 workspace.llm 暴露为反思模型
  • 调整 reflection_run,改为验证 workspace.llm 而不是每配置的 reflection_model_id
api/app/services/memory_reflection_service.py
api/app/controllers/memory_config_controller.py
api/app/repositories/memory_config_repository.py
api/app/controllers/memory_reflection_controller.py
api/app/schemas/memory_reflection_schemas.py
情绪配置现在使用工作区 LLM 作为其模型来源,从 schema 和存储更新中移除了 emotion_model_id,并切换为异步数据库访问。
  • 修改 EmotionConfigService 以依赖 AsyncSession,移除 emotion_model_id 校验,并在 get_emotion_config_async 中连接 MemoryConfigWorkspace,将 workspace.llm 作为 emotion_model_id 暴露
  • 停止在 MemoryConfig 中更新/存储 emotion_model_id,并将其从 EmotionConfigUpdate/EmotionConfigUpdateRequest schema 和相关控制器中移除
  • 更新 API 文档,说明所有情绪字段(除 model 外)均为必填,而 model 隐式来自工作区
api/app/services/emotion_config_service.py
api/app/schemas/memory_api_schema.py
api/app/controllers/service/memory_config_api_controller.py
api/app/controllers/emotion_config_controller.py
提取的内存配置 API 和存储不再接受每配置的模型 ID,而是返回来自工作区模型的模型 ID,使仓库查询和 schema 保持一致。
  • ConfigUpdateExtractedRequestConfigUpdateExtracted schema 中移除 llm_id/embedding_id/rerank_id/vision_id/audio_id/video_id 字段
  • 更新 MemoryConfigRepository.get_extracted_config_async,连接 Workspace,并从 workspace.llm/embedding/rerank/vision/audio/video 返回模型 ID,而非从 MemoryConfig 字段中返回
api/app/schemas/memory_api_schema.py
api/app/schemas/memory_storage_schema.py
api/app/repositories/memory_config_repository.py
工作区更新现在会利用新的同步/异步失效助手,对 storage_type 和工作区模型变更触发相应的缓存失效。
  • invalidate_cacheinvalidate_cache_sync 注入 workspace_service
  • invalidate_cache_sync 替换基于 asyncio.runstorage_type 异步失效逻辑,并在 llm/embedding/rerank 或工作区模型配置变更时增加 memory_config:... 缓存失效
api/app/services/workspace_service.py
终端用户的租户 ID 查询现在受益于带有 UUID 反序列化能力的 Redis 缓存。
  • get_tenant_id_by_end_user_idget_tenant_id_by_end_user_id_async 上启用 redis_cache,并设置 return_type=uuid.UUID,以便租户 ID 能被正确缓存和重建
api/app/repositories/end_user_repository.py

提示与命令(Tips and commands)

与 Sourcery 交互(Interacting with Sourcery)

  • 触发新的审阅: 在 Pull Request 上评论 @sourcery-ai review
  • 继续讨论: 直接回复 Sourcery 的审阅评论。
  • 从审阅评论生成 GitHub Issue: 在回复某条审阅评论时请求 Sourcery 从该评论创建 Issue。你也可以回复审阅评论 @sourcery-ai issue 来从该评论创建 Issue。
  • 生成 Pull Request 标题: 在 Pull Request 标题的任意位置写入 @sourcery-ai,即可随时生成标题。你也可以在 Pull Request 上评论 @sourcery-ai title 来(重新)生成标题。
  • 生成 Pull Request 摘要: 在 Pull Request 正文任意位置写入 @sourcery-ai summary,即可在该位置生成 PR 摘要。你也可以在 Pull Request 上评论 @sourcery-ai summary 来在任意时间(重新)生成摘要。
  • 生成审阅者指南: 在 Pull Request 上评论 @sourcery-ai guide,即可在任意时间(重新)生成审阅者指南。
  • 解决全部 Sourcery 评论: 在 Pull Request 上评论 @sourcery-ai resolve,将所有 Sourcery 评论标记为已解决。如果你已经处理完所有评论且不希望再看到它们,这将非常有用。
  • 撤销全部 Sourcery 审阅: 在 Pull Request 上评论 @sourcery-ai dismiss,以撤销所有现有的 Sourcery 审阅。若你希望以一次全新的审阅开始,这尤其有用——别忘了再评论 @sourcery-ai review 来触发新的审阅!

自定义你的体验(Customizing Your Experience)

访问你的 dashboard 来:

  • 启用或禁用审阅功能,例如 Sourcery 自动生成的 Pull Request 摘要、审阅者指南等。
  • 更改审阅语言。
  • 添加、移除或编辑自定义审阅指令。
  • 调整其他审阅设置。

获取帮助(Getting Help)

Original review guide in English

Reviewer's Guide

Refactors memory and related configs to rely on workspace-level model assignments instead of per-config model IDs, improves Redis cache behavior and invalidation, and removes explicit reflection/emotion model configuration from APIs and storage in favor of workspace models.

Sequence diagram for reflection_run using workspace LLM model

sequenceDiagram
    actor User
    participant MemoryReflectionController
    participant MemoryConfigRepository
    participant Workspace
    participant ModelConfigService

    User->>MemoryReflectionController: reflection_run(config_id)
    MemoryReflectionController->>MemoryConfigRepository: get_config_with_workspace_async(config_id)
    MemoryConfigRepository-->>MemoryReflectionController: (MemoryConfig, Workspace)
    MemoryReflectionController->>Workspace: read llm
    Workspace-->>MemoryReflectionController: llm_id
    MemoryReflectionController->>ModelConfigService: get_model_by_id_async(db, model_id=llm_id, tenant_id)
    ModelConfigService-->>MemoryReflectionController: model details
    MemoryReflectionController-->>User: reflection result (using workspace.llm)
Loading

File-Level Changes

Change Details Files
Memory config loading now resolves all models (LLM, embedding, rerank, vision, audio, video) directly from workspace model settings and updates Redis caching keys/options accordingly.
  • Removed sync and async _validate_model_with_fallback helpers and replaced their usage with direct validate_and_resolve_model_id(_async) calls using workspace models
  • Changed load_memory_config and load_memory_config_async to ignore per-config model IDs and instead validate workspace.llm/embedding/rerank/vision/audio/video
  • Adjusted rerank validation logging to depend only on workspace.rerank and switched Redis cache decorators to use prefix 'memory_config' and id_arg='config_id'
api/app/services/memory_config_service.py
Redis cache utilities gained richer return type handling and shared invalidate logic, plus a new synchronous invalidation helper used by workspace updates.
  • Extended redis_cache to support UUID return types by deserializing from string
  • Refactored cache invalidation into shared helpers (_resolve_invalidation, _scan_unlink_async, _scan_unlink_sync) used by invalidate_cache and new invalidate_cache_sync
  • Updated async invalidate_cache to log number of deleted keys via the shared scanning helper
api/app/utils/redis_cache.py
Reflection configs no longer store or accept a dedicated reflection_model_id and instead always derive the model from the workspace LLM configuration.
  • Simplified reflection config creation helpers to always fetch workspace_models.llm for reflection_model_id and ignore any provided reflection_model_id
  • Updated reflection controllers and repository to drop reflection_model_id persistence and to expose workspace.llm as the reflection model in API responses
  • Adjusted reflection_run to validate workspace.llm instead of a per-config reflection_model_id
api/app/services/memory_reflection_service.py
api/app/controllers/memory_config_controller.py
api/app/repositories/memory_config_repository.py
api/app/controllers/memory_reflection_controller.py
api/app/schemas/memory_reflection_schemas.py
Emotion config now uses the workspace LLM as its model source, removes emotion_model_id from schemas and storage updates, and switches to async DB usage.
  • Changed EmotionConfigService to depend on AsyncSession, removed emotion_model_id validation, and joined MemoryConfig with Workspace in get_emotion_config_async to expose workspace.llm as emotion_model_id
  • Stopped updating/storing emotion_model_id in MemoryConfig and removed it from EmotionConfigUpdate/EmotionConfigUpdateRequest schemas and related controllers
  • Updated API documentation to reflect that all emotion fields (except model) are required but model is taken implicitly from workspace
api/app/services/emotion_config_service.py
api/app/schemas/memory_api_schema.py
api/app/controllers/service/memory_config_api_controller.py
api/app/controllers/emotion_config_controller.py
Extracted memory config APIs and storage no longer accept per-config model IDs and instead return model IDs from workspace models, aligning repository queries and schemas.
  • Removed llm_id/embedding_id/rerank_id/vision_id/audio_id/video_id fields from ConfigUpdateExtractedRequest and ConfigUpdateExtracted schemas
  • Updated MemoryConfigRepository.get_extracted_config_async to join Workspace and return model IDs from workspace.llm/embedding/rerank/vision/audio/video instead of MemoryConfig fields
api/app/schemas/memory_api_schema.py
api/app/schemas/memory_storage_schema.py
api/app/repositories/memory_config_repository.py
Workspace updates now trigger appropriate cache invalidations for storage_type and workspace model changes using the new sync/async invalidation helpers.
  • Injected invalidate_cache and invalidate_cache_sync into workspace_service
  • Replaced asyncio.run-based async invalidation for storage_type with invalidate_cache_sync and added memory_config:... cache invalidation when llm/embedding/rerank or workspace models configs change
api/app/services/workspace_service.py
Tenant ID lookup by end user now benefits from Redis caching with UUID-aware deserialization.
  • Enabled redis_cache on get_tenant_id_by_end_user_id and get_tenant_id_by_end_user_id_async with return_type=uuid.UUID so tenant IDs are cached and reconstructed correctly
api/app/repositories/end_user_repository.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions

github-actions Bot commented Aug 11, 2026

Copy link
Copy Markdown

API Breaking Change Report

Comparing against develop baseline.

Breaking change approval label: api-breaking-approved = true.

Tool Result
oasdiff ✅ PASS
openapi-diff ✅ PASS

oasdiff

Output
No breaking changes to report, but the specs are different.
Run 'oasdiff diff' to see structural differences.

openapi-diff

Output
Unable to find image 'openapitools/openapi-diff:2.1.0-beta.11' locally
2.1.0-beta.11: Pulling from openapitools/openapi-diff
4abcf2066143: Pulling fs layer
a21a63612cbe: Pulling fs layer
92d6f603e71e: Pulling fs layer
b8be18af9f33: Pulling fs layer
704a4a6d46b8: Pulling fs layer
ffabcbe5d181: Pulling fs layer
c2a172360f79: Pulling fs layer
6b9cfc1f0b01: Pulling fs layer
397b98d1dbc3: Pulling fs layer
b8be18af9f33: Waiting
704a4a6d46b8: Waiting
ffabcbe5d181: Waiting
c2a172360f79: Waiting
6b9cfc1f0b01: Waiting
397b98d1dbc3: Waiting
4abcf2066143: Verifying Checksum
4abcf2066143: Download complete
a21a63612cbe: Verifying Checksum
a21a63612cbe: Download complete
4abcf2066143: Pull complete
92d6f603e71e: Verifying Checksum
92d6f603e71e: Download complete
b8be18af9f33: Verifying Checksum
b8be18af9f33: Download complete
704a4a6d46b8: Verifying Checksum
704a4a6d46b8: Download complete
ffabcbe5d181: Verifying Checksum
ffabcbe5d181: Download complete
6b9cfc1f0b01: Verifying Checksum
6b9cfc1f0b01: Download complete
c2a172360f79: Verifying Checksum
c2a172360f79: Download complete
397b98d1dbc3: Verifying Checksum
397b98d1dbc3: Download complete
a21a63612cbe: Pull complete
92d6f603e71e: Pull complete
b8be18af9f33: Pull complete
704a4a6d46b8: Pull complete
ffabcbe5d181: Pull complete
c2a172360f79: Pull complete
6b9cfc1f0b01: Pull complete
397b98d1dbc3: Pull complete
Digest: sha256:6c6b662418e021d13be871dc5a2e8b09936abce02ce05d377caf426663650aa9
Status: Downloaded newer image for openapitools/openapi-diff:2.1.0-beta.11
==========================================================================
==                            API CHANGE LOG                            ==
==========================================================================
                                MemoryBear                                
--------------------------------------------------------------------------
--                              What's New                              --
--------------------------------------------------------------------------
- POST   /v1/memory/merge
- GET    /v1/memory-display/written
- GET    /v1/memory-display/engines

--------------------------------------------------------------------------
--                            What's Changed                            --
--------------------------------------------------------------------------
- GET    /v1/app/annotations
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/app/annotations/settings
  Request:
        - Changed application/json
          Schema: Backward compatible
- DELETE /v1/app/annotations/{annotation_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/app/variable
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/app/conversations
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/app/conversations/{conversation_id}/messages
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/app/messages/{message_id}/suggested
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/app/info
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/app/conversations/{conversation_id}/messages/feedbacks
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/knowledges/knowledge_graph_entity_types
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/knowledges/knowledges
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/knowledges/{knowledge_id}/knowledge_graph
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/knowledges/{knowledge_id}/knowledge_graph
  Request:
        - Changed application/json
          Schema: Backward compatible
- DELETE /v1/knowledges/{knowledge_id}/knowledge_graph
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/knowledges/check/yuque/auth
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/knowledges/check/feishu/auth
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/knowledges/{knowledge_id}/sync
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/documents/{kb_id}/documents
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/documents/{document_id}/chunks
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/files/{kb_id}/{parent_id}/files
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/files/folder
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/chunks/{kb_id}/{document_id}/previewchunks
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/chunks/{kb_id}/{document_id}/chunks
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/end_user/mapping
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/end_user/info
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory_config/read_all_config
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory_config/scenes/simple
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory_config/read_config_extracted
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory_config/read_config_forgetting
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory_config/read_config_emotion
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory_config/read_config_reflection
  Request:
        - Changed application/json
          Schema: Backward compatible
- DELETE /v1/memory_config/delete_config
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/analytics/graph_data
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/analytics/community_graph
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/analytics/node_statistics
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/analytics/user_summary
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/analytics/memory_insight
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/analytics/interest_distribution
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/analytics/end_user_info
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/dashboard/end_users
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/ontology/scenes/simple
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/ontology/scenes
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/ontology/classes
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/app/chat
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/app/workflow/interventions/{execution_id}/submit
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/app/files
  Request:
        - Changed multipart/form-data
          Schema: Backward compatible
- POST   /v1/app/messages/{message_id}/feedback
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/knowledges/knowledge
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/knowledges/{knowledge_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- DELETE /v1/knowledges/{knowledge_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/knowledges/{knowledge_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/documents/document
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/documents/{document_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- DELETE /v1/documents/{document_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/documents/{document_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/files/file
  Request:
        - Changed multipart/form-data
          Schema: Backward compatible
- POST   /v1/files/customtext
  Request:
        - Changed application/json
          Schema: Backward compatible
- DELETE /v1/files/{file_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/files/{file_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/chunks/{kb_id}/{document_id}/chunk
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/chunks/{kb_id}/{document_id}/chunk/batch
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/chunks/{kb_id}/{document_id}/{doc_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- DELETE /v1/chunks/{kb_id}/{document_id}/{doc_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/chunks/{kb_id}/{document_id}/{doc_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/chunks/retrieval
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/chunks/{kb_id}/import_qa
  Request:
        - Changed multipart/form-data
          Schema: Backward compatible
- POST   /v1/memory/read/sync
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/memory/read/internal
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/memory/write
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/end_user/create
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/end_user/info/update
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/memory_config/create_config
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/memory_config/update_config
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/memory_config/update_config_extracted
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/memory_config/update_config_forgetting
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/memory_config/update_config_emotion
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/memory_config/update_config_reflection
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/memory/analytics/generate_cache
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/memory/ontology/extract
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/memory/ontology/scene
  Request:
        - Changed application/json
          Schema: Backward compatible
- DELETE /v1/memory/ontology/scene/{scene_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/memory/ontology/scene/{scene_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/memory/ontology/class
  Request:
        - Changed application/json
          Schema: Backward compatible
- GET    /v1/memory/ontology/class/{class_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- DELETE /v1/memory/ontology/class/{class_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- PUT    /v1/memory/ontology/class/{class_id}
  Request:
        - Changed application/json
          Schema: Backward compatible
- POST   /v1/memory/ontology/import
  Request:
        - Changed multipart/form-data
          Schema: Backward compatible
- POST   /v1/memory/ontology/export
  Request:
        - Changed application/json
          Schema: Backward compatible
--------------------------------------------------------------------------
--                                Result                                --
--------------------------------------------------------------------------
                   API changes are backward compatible                    
--------------------------------------------------------------------------

Gate decision

No breaking changes detected. The check passed without approval override.

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - 我在这里给出了一些总体反馈:

  • 现在在创建反射配置时,会忽略 config_data 中存在的任何 reflection_model_id,而是始终从 workspace 的 models 中推导得到;如果这是有意为之,建议从仍然保留该字段的请求/响应负载或代码路径中将其移除,以避免让人误以为用户仍可配置它,从而造成困惑。
  • workspace_service.update_workspace 中,内存配置缓存的失效前缀为 memory_config:{db_workspace.memory_config};如果 memory_config 是 UUID 或其他非字符串类型,显式地转换为 str 可能更加安全,以避免出现不易察觉的 key 格式不一致问题。
给 AI Agents 的提示
请根据这次代码审查中的评论进行修改:

## 整体评论
- 现在在创建反射配置时,会忽略 `config_data` 中存在的任何 `reflection_model_id`,而是始终从 workspace 的 models 中推导得到;如果这是有意为之,建议从仍然保留该字段的请求/响应负载或代码路径中将其移除,以避免让人误以为用户仍可配置它,从而造成困惑。
-`workspace_service.update_workspace` 中,内存配置缓存的失效前缀为 `memory_config:{db_workspace.memory_config}`;如果 `memory_config` 是 UUID 或其他非字符串类型,显式地转换为 `str` 可能更加安全,以避免出现不易察觉的 key 格式不一致问题。

Sourcery 对开源项目是免费的——如果你觉得我们的评审有帮助,欢迎分享 ✨
帮我变得更有用吧!请在每条评论下点 👍 或 👎,我会根据你的反馈改进后续的评审。
Original comment in English

Hey - I've left some high level feedback:

  • Reflection config creation now ignores any reflection_model_id present in config_data and always derives it from workspace models; if this is intentional, consider removing the field from any remaining request/response payloads or code paths that still suggest it can be user-configured to avoid confusion.
  • In workspace_service.update_workspace, the invalidation prefix for memory config cache is memory_config:{db_workspace.memory_config}; if memory_config is a UUID or other non-string type, it may be safer to explicitly cast to str to avoid subtle key format inconsistencies.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Reflection config creation now ignores any `reflection_model_id` present in `config_data` and always derives it from workspace models; if this is intentional, consider removing the field from any remaining request/response payloads or code paths that still suggest it can be user-configured to avoid confusion.
- In `workspace_service.update_workspace`, the invalidation prefix for memory config cache is `memory_config:{db_workspace.memory_config}`; if `memory_config` is a UUID or other non-string type, it may be safer to explicitly cast to `str` to avoid subtle key format inconsistencies.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

@myhMARS

myhMARS commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator Author

remove model config from v1/memory_config/update_config_extracted v1/memory_config/update_config_emotion v1/memory_config/update_config_reflection

@keeees
keeees merged commit b311082 into develop Aug 12, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api-breaking-approved enhancement New feature or request feature New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants