Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -214,9 +214,12 @@ evaluate:
##################################################

# OpenAPI and model generation
.PHONY: merge-openapi generate-models generate-frontend-sdk
.PHONY: openapi-check merge-openapi generate-models generate-frontend-sdk
openapi-check:
@npx --yes @redocly/cli bundle aperag/api/openapi.yaml --output /tmp/openapi-check-bundle.yaml && rm -f /tmp/openapi-check-bundle.yaml

merge-openapi:
@cd aperag && redocly bundle ./api/openapi.yaml > ./api/openapi.merged.yaml
@cd aperag && npx --yes @redocly/cli bundle ./api/openapi.yaml > ./api/openapi.merged.yaml

generate-models: merge-openapi
@datamodel-codegen \
Expand Down
17 changes: 17 additions & 0 deletions PR_DESCRIPTION_1096.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Summary
This PR updates marketplace collection graph pages to use marketplace-safe graph APIs and improves graph page layout behavior on shorter screens.

## What changed
- Render the marketplace collection `/graph` page with the new graph-hybrid view.
- Add read-only marketplace graph endpoints for `embedding-map` and `entity-search` so published marketplace collections do not call workspace-only graph APIs.
- Let `CollectionGraphHybrid` switch between workspace and marketplace data sources.
- Give graph pages a 720px minimum graph area so shorter screens can scroll instead of compressing the canvas.

## Why
Marketplace collection graph pages should not depend on workspace-only APIs. This change introduces marketplace-safe read-only graph endpoints and updates frontend routing/data-source behavior so graph rendering works correctly for published collections while preserving workspace behavior.

## Validation
- `make openapi-check`
- `uv run ruff check aperag/domains/marketplace/api/routes.py`
- `yarn type-check`
- `yarn lint` (passes with pre-existing unrelated warnings)
46 changes: 46 additions & 0 deletions PR_DESCRIPTION_1963.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Summary
This PR addresses issue #1963 where `PUT /api/v2/collections/{id}` returns stable `500 DATABASE_ERROR` when updating an existing collection config in apemind POC (SG) / SG evaluation environments.

## Problem
- Updating an existing `type=document` collection via `PUT /api/v2/collections/{collection_id}` consistently fails with:
- `{"success":false,"error_code":"DATABASE_ERROR","code":1050,"message":"数据库出现错误,请稍后重试。"}`
- Retry does not recover; failure is stable.

## Reproduction
1. Create a `type=document` collection (POST path succeeds).
2. Update config with `PUT /api/v2/collections/{collection_id}`:
- Reproduces when changing only `enable_vector` / `fulltext` / `embedding`.
- Also reproduces when enabling knowledge graph (`enable_knowledge_graph=true`).
3. Observe stable `500 DATABASE_ERROR`.

## Impact
- Existing collections cannot be reconfigured.
- Typical operation "enable knowledge graph after collection creation" is blocked.
- Current workaround is delete + recreate collection, which is high cost and may lose built index state.

## Isolation Findings
- `POST /api/v2/collections` (CREATE): normal.
- `GET` paths: normal.
- Only `PUT` update path is failing.
- Failure is not knowledge-graph specific.

## Scope in this PR
- Triage and root-cause analysis for collection update failure in update path.
- Confirm ownership boundary between KB domain collection update service and DB layer.
- Implement and validate fix for `DATABASE_ERROR` in update flow.

## Validation Plan
- Reproduce on apemind POC (SG) with an existing collection.
- Verify PUT update succeeds for:
- Non-graph config-only changes (`enable_vector` / `fulltext` / `embedding`).
- Graph enablement path (`enable_knowledge_graph=true`).
- Regression check:
- CREATE remains normal.
- GET remains normal.
- No regression in collection update behavior across existing test fixtures.

## Context
- Environment where issue was found: apemind POC (SG).
- Discovery date: 2026-07-01.
- Reporter: @cuiwenbo (崔文博), during `task feat: chat #17`.
- Tracking issue: #1963.
6 changes: 2 additions & 4 deletions README-zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@

ApeRAG 是一个生产级 RAG(检索增强生成)平台,结合了图 RAG、向量搜索、全文搜索和先进的 AI 智能体。构建具有混合检索、多模态文档处理、智能代理和企业级管理功能的复杂 AI 应用程序。

**🚀 [在线体验 ApeRAG](https://rag.apecloud.com/)** - 通过我们的托管演示体验完整的平台功能

ApeRAG 是你构建自己的知识图谱、进行上下文工程以及部署能够自主搜索和推理知识库的智能 AI 代理的最佳选择。

[Read English Documentation](README.md)
Expand Down Expand Up @@ -51,7 +49,7 @@ ApeRAG 支持 [MCP(模型上下文协议)](https://modelcontextprotocol.io/)
{
"mcpServers": {
"aperag-mcp": {
"url": "https://rag.apecloud.com/mcp/",
"url": "http://localhost:8000/mcp/",
"headers": {
"Authorization": "Bearer your-api-key-here"
}
Expand All @@ -64,7 +62,7 @@ ApeRAG 支持 [MCP(模型上下文协议)](https://modelcontextprotocol.io/)
1. **HTTP Authorization 头**(推荐):`Authorization: Bearer your-api-key`
2. **环境变量**(备用):`APERAG_API_KEY=your-api-key`

**重要提示**:`https://rag.apecloud.com` 替换为您实际的 ApeRAG API 地址,将 `your-api-key-here` 替换为 ApeRAG 设置中的有效 API 密钥。
**重要提示**:若为非本机部署,请将示例 URL 换成实际 API 源地址对应的 MCP 路径(如 `https://<你的域名>/mcp/`)。将 `your-api-key-here` 替换为 ApeRAG 设置中的有效 API 密钥。

MCP 服务器提供:
- **集合浏览**:列出和探索您的知识集合
Expand Down
7 changes: 2 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
# ApeRAG
[![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/apecloud/ApeRAG)](https://archestra.ai/mcp-catalog/apecloud__aperag)

**🚀 [Try ApeRAG Live Demo](https://rag.apecloud.com/)** - Experience the full platform capabilities with our hosted demo


![HarryPotterKG2.png](docs%2Fen-US%2Fimages%2FHarryPotterKG2.png)

![chat2.png](docs%2Fen-US%2Fimages%2Fchat2.png)
Expand Down Expand Up @@ -52,7 +49,7 @@ ApeRAG supports [MCP (Model Context Protocol)](https://modelcontextprotocol.io/)
{
"mcpServers": {
"aperag-mcp": {
"url": "https://rag.apecloud.com/mcp/",
"url": "http://localhost:8000/mcp/",
"headers": {
"Authorization": "Bearer your-api-key-here"
}
Expand All @@ -65,7 +62,7 @@ ApeRAG supports [MCP (Model Context Protocol)](https://modelcontextprotocol.io/)
1. **HTTP Authorization Header** (Recommended): `Authorization: Bearer your-api-key`
2. **Environment Variable** (Fallback): `APERAG_API_KEY=your-api-key`

**Important**: Replace `https://rag.apecloud.com` with your actual ApeRAG API URL and `your-api-key-here` with a valid API key from your ApeRAG settings.
**Important**: Use your deployed API origin if not local (e.g. `https://your-host/mcp/`). Replace `your-api-key-here` with a valid API key from your ApeRAG settings.

The MCP server provides:
- **Collection browsing**: List and explore your knowledge collections
Expand Down
86 changes: 86 additions & 0 deletions aperag/api/components/schemas/document.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -251,3 +251,89 @@ confirmDocumentsResponse:
required:
- confirmed_count
- failed_count

fetchUrlRequest:
type: object
properties:
urls:
type: array
items:
type: string
format: uri
minItems: 1
maxItems: 10
description: List of URLs to fetch and import (max 10)
example:
- "https://example.com/article1"
- "https://example.com/article2"
required:
- urls

fetchUrlResultItem:
type: object
properties:
url:
type: string
description: The source URL
fetch_status:
type: string
enum:
- success
- error
description: Whether the URL was fetched successfully
document_id:
type: string
description: ID of the created document (only present on success)
filename:
type: string
description: Filename of the created document (only present on success)
size:
type: integer
description: Size of the created document in bytes (only present on success)
status:
type: string
description: Document status (only present on success)
error:
type: string
description: Error message (only present on failure)
required:
- url
- fetch_status

fetchUrlResponse:
type: object
properties:
results:
type: array
items:
$ref: '#/fetchUrlResultItem'
description: Results for each URL
total:
type: integer
description: Total number of URLs processed
succeeded:
type: integer
description: Number of URLs successfully fetched
failed:
type: integer
description: Number of URLs that failed
required:
- results
- total
- succeeded
- failed

stagedDocumentsResponse:
type: object
properties:
documents:
type: array
items:
$ref: '#/uploadDocumentResponse'
description: List of staged (UPLOADED) documents awaiting confirmation
total:
type: integer
description: Total number of staged documents
required:
- documents
- total
12 changes: 12 additions & 0 deletions aperag/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ paths:
$ref: './paths/collections.yaml#/upload_document'
/collections/{collection_id}/documents/confirm:
$ref: './paths/collections.yaml#/confirm_documents'
/collections/{collection_id}/documents/fetch-url:
$ref: './paths/collections.yaml#/fetch_url_document'
/collections/{collection_id}/documents/staged:
$ref: './paths/collections.yaml#/list_staged_documents'
/collections/{collection_id}/searches:
$ref: './paths/collections.yaml#/searches'
/collections/{collection_id}/searches/{search_id}:
Expand Down Expand Up @@ -111,6 +115,10 @@ paths:
$ref: './paths/collections.yaml#/graph_suggestion_action'
/collections/{collection_id}/graphs/export/kg-eval:
$ref: './paths/collections.yaml#/graph_export_kg_eval'
/collections/{collection_id}/graphs/embedding-map:
$ref: './paths/collections.yaml#/graph_embedding_map'
/collections/{collection_id}/graphs/entity-search:
$ref: './paths/collections.yaml#/graph_entity_search'
/collections/{collection_id}/sharing:
$ref: './paths/collections.yaml#/sharing'

Expand All @@ -131,6 +139,10 @@ paths:
$ref: './paths/marketplace.yaml#/marketplaceCollectionDocumentObject'
/marketplace/collections/{collection_id}/graph:
$ref: './paths/marketplace.yaml#/marketplaceCollectionGraph'
/marketplace/collections/{collection_id}/graph/embedding-map:
$ref: './paths/marketplace.yaml#/marketplaceCollectionGraphEmbeddingMap'
/marketplace/collections/{collection_id}/graph/entity-search:
$ref: './paths/marketplace.yaml#/marketplaceCollectionGraphEntitySearch'

# apikeys
/apikeys:
Expand Down
Loading
Loading