Commit Graph

683 Commits

Author SHA1 Message Date
draix 5591c84e7f fix: remove limit/offset from required in list_knowledge_chunks JSON Schema
limit and offset are optional parameters with default values (limit=20,
offset=0). Marking them as required in the JSON Schema forces LLM clients
to always supply them, breaking calls that rely on the defaults.

Fixes #1003
2026-04-21 23:27:14 +08:00
moineye 4ca0c7a644 fix: ReadEvent incompatible sse data format 2026-04-20 22:29:38 +08:00
jw_mac 09e1642335 fix(storage): auto-detect content-type to resolve image rendering issues
Fixes #995. Added mime type detection in SaveBytes for MinIO, OSS, S3, and TOS to prevent images from being incorrectly saved as text/csv.
2026-04-20 21:59:54 +08:00
ochan.kwon 127654ee78 feat: add vector_store_id column to knowledge_bases for per-KB vector store binding 2026-04-20 19:53:44 +08:00
Mao Meng e3b493e316 fix: use constant-time comparison for API key validation 2026-04-19 21:41:22 +08:00
ochan.kwon 8fd1d61333 feat: add VectorStore management UI settings page 2026-04-17 21:51:25 +08:00
ochan.kwon 927d3debff feat: pass IndexConfig to repositories with scalability options 2026-04-17 16:52:24 +08:00
hjz 7bd36bf954 feat: search engine adds proxy addresses and adds SSRF verification. 2026-04-17 16:38:02 +08:00
wizardchen 092044b68f refactor(postgres): optimize vector retrieval and HNSW settings
- Adjusted the expanded TopK limit to a maximum of 200 candidates to enhance HNSW efficiency.
- Updated the vector retrieval query to ensure the ORDER BY expression matches the indexed expression, improving index usage.
- Implemented local settings for HNSW's ef_search and iterative_scan within a transaction to optimize candidate retrieval.
- Added fallback logic to handle unsupported GUCs gracefully, ensuring query execution continues even with older pgvector versions.

These changes improve the performance and reliability of vector retrieval in the PostgreSQL implementation.
2026-04-17 12:11:03 +08:00
wizardchen d546406a15 feat(output): enhance output formatting to XML for various tools
- Updated the formatKnowledgeBaseList function to return knowledge base information as XML, improving data structure for integration.
- Modified the formatOutput function in GrepChunksTool to format search results as XML, enhancing readability and consistency.
- Adjusted the formatOutput method in KnowledgeSearchTool to output search results in XML format, providing a structured response.
- Refactored the buildOutput function in ListKnowledgeChunksTool to generate XML output, improving the clarity of chunk information.

These changes standardize output formats across multiple tools, facilitating better data handling and integration.
2026-04-17 12:11:03 +08:00
ochan.kwon c5fc05f3d0 feat: add registry dual-map and engine factory for VectorStore
- Extend RetrieveEngineRegistry with byStoreID map for DB store engines
- Add StoreRegistry interface and EngineFactory function type
- Create engine factory with per-driver SDK client construction
- Load VectorStore records from DB into registry at startup
- Wire Create/Delete to dynamically register/unregister engines
- Add comprehensive unit tests for registry and service
2026-04-17 00:15:37 +08:00
wizardchen 4f55994266 feat(prompt): enhance question rewriting and intent classification in prompt templates
- Updated the prompt template to clarify the task of understanding and rewriting user questions, improving the instructions for coreference resolution and ellipsis completion.
- Renamed sections for better clarity, changing "Rewriting Goals" to "Query Understanding."
- Added critical notes for intent classification regarding image and document attachments, ensuring accurate processing based on the presence of attachments.
- Improved examples to reflect the updated intent classification logic, enhancing the overall user experience in query handling.
2026-04-16 23:15:02 +08:00
wizardchen 53e8e17df4 feat(logger): implement LLM debug logging functionality
- Added a new logger for LLM calls, enabling detailed logging of model interactions, including request and response data.
- Introduced configuration options for enabling and specifying the log directory for LLM debug logs.
- Implemented cleanup for old log files to manage disk space effectively.
- Wrapped existing chat implementations to log calls when debug logging is enabled, enhancing traceability for model interactions.
2026-04-16 23:15:02 +08:00
wizardchen 6235a82183 Fix logger format string errors in system handler 2026-04-16 18:39:30 +08:00
wizardchen dcb7fd05b1 Fix compile error in weaviate repository 2026-04-16 18:37:31 +08:00
wizardchen 92b6b7507d refactor(chunk): improve parent-child chunk relationship handling in SplitTextParentChild
- Updated the SplitTextParentChild function to maintain a newParents slice, ensuring accurate parent indexing when splitting text into child chunks.
- This change enhances the integrity of parent-child relationships by correctly associating child chunks with their respective parents, improving overall chunk processing.
2026-04-16 18:29:33 +08:00
wizardchen 491c324197 feat(system): remove MinIO list buckets API and UI dependencies 2026-04-16 18:13:21 +08:00
wizardchen a560497ee8 feat(tenant): add storage bucket uniqueness validation for tenant creation and updates
- Implemented a new method to validate the uniqueness of storage bucket names across tenants, ensuring no two tenants can use the same bucket name.
- Integrated this validation into the CreateTenant and UpdateTenant methods, enhancing data isolation and preventing potential conflicts.
- Improved error logging for better traceability when validation fails.

This update strengthens the integrity of tenant storage configurations.
2026-04-16 18:13:20 +08:00
wizardchen af58e9cff4 fix(repository): ensure expandedTopK is at least params.TopK in VectorRetrieve
- Added a check to set expandedTopK to params.TopK if it is lower, ensuring the subquery limit is not less than the final limit.
- Removed unnecessary type casting in the SQL query for embedding distance calculations, simplifying the query structure.

This update improves the accuracy of vector retrieval operations in the PostgreSQL repository.
2026-04-16 18:13:20 +08:00
wizardchen a1a07e6818 Refactor knowledge post-processing into orchestrator task
Introduce KnowledgePostProcess task to decouple image multimodal
processing from downstream operations like summary, question
generation, and knowledge graph extraction.

This allows unifying the processing logic across documents and
images and ensures all text content, including from images,
is properly extracted before post-processing.
2026-04-16 18:13:20 +08:00
wizardchen 7c40fb6ac9 feat: enhance URL validation and timeout handling in knowledge base components
- Added isValidURL function to validate URLs before rendering links in the document content component, preventing invalid links from being clickable.
- Refactored timeout handling in KnowledgeBase.vue to use setTimeout instead of setInterval, improving performance and resource management.
- Ensured that timeouts are cleared appropriately to avoid memory leaks and unnecessary polling.

This update improves the robustness of URL handling and optimizes the component's performance.
2026-04-16 18:13:19 +08:00
wizardchen a78182cfc7 feat(handler): validate bucket name format and improve MinIO error handling
- Added validation for bucket name format to ensure it meets specified criteria, returning an error message for invalid formats.
- Simplified error messages for MinIO client creation and bucket auto-creation failures, enhancing clarity for users.
- Updated success messages to reflect the correct status of bucket creation without public-read policy settings.

This update improves the robustness of the MinIO integration and enhances user feedback during storage checks.
2026-04-16 18:13:19 +08:00
swim2sun d2c6814f22 fix: SQLite/Lite mode compatibility for FAQ import and chunk operations
Multiple fixes for WeKnora Lite mode (SQLite, no Redis):

1. Redis nil pointer panic on FAQ import (knowledge.go)
   - Add in-memory fallback (sync.Map) for FAQ import progress tracking
   - Add nil guards for running task locks and progress queries

2. seq_id not auto-incrementing in SQLite (chunk.go, tag.go)
   - GORM autoIncrement on non-PK columns doesn't work in SQLite
   - Add AssignChunkSeqIDs() to pre-assign seq_ids before batch insert
   - Add BeforeCreate hook for KnowledgeTag
   - Use Unscoped() to include soft-deleted records in MAX(seq_id) query

3. NOW() function not available in SQLite (chunk.go)
   - Replace raw SQL NOW() with time.Now() or datetime('now')
   - Use dialector check for raw SQL that must differ between PG and SQLite

4. FAQ KB should reject file uploads (knowledge.go)
   - Add kb.Type == "faq" check in CreateKnowledgeFromFile

5. Linux/macOS build compatibility (Makefile)
   - Conditionally apply macOS-only linker flag based on uname

6. Add SQLite integration tests (chunk_sqlite_test.go)
   - TestCreateChunks_SQLite_SeqIDAutoAssigned
   - TestCreateChunks_SQLite_SeqIDContinuesFromExisting
   - TestCreateChunks_SQLite_SeqIDUniqueAcrossKBs
   - TestCreateChunks_SQLite_SeqIDAfterSoftDelete
   - TestKnowledgeTag_SQLite_SeqIDAutoAssigned
   - TestUpdateChunk_SQLite_NoNOWError

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-15 20:37:10 +08:00
moineye 5000e6e665 fix: missing deep copy entity 2026-04-15 20:35:48 +08:00
ugurtafrali 38077d6ccd Fix system prompt not being used when flag is false 2026-04-15 20:21:12 +08:00
wizardchen 9bb4a12562 feat(repository): update keyword retrieval logic to use ParadeDB's matching operator
- Modified the SQL clause in the KeywordsRetrieve function to utilize ParadeDB's ||| operator for improved token matching.
- Enhanced the handling of retrieval results in the fuseOrDeduplicate function to maintain original scores for keyword-only results, ensuring better performance in FAQ scenarios.

This update optimizes the keyword retrieval process and improves the accuracy of search results.
2026-04-15 20:16:02 +08:00
wizardchen 9ba8582f70 feat(weknoracloud): implement WeKnoraCloud VLM integration
- Added WeKnoraCloudVLM struct to handle interactions with the WeKnoraCloud API, including image and text processing capabilities.
- Enhanced model configuration to include AppID and AppSecret for secure API access.
- Updated modelService to resolve WeKnoraCloud credentials and pass them to the VLM configuration.
- Implemented Predict method for sending requests to the WeKnoraCloud API and processing responses.

This update introduces a new integration with WeKnoraCloud, expanding the application's capabilities in handling multimedia content.
2026-04-15 15:43:08 +08:00
wizardchen 3f8201cd49 refactor(weknoracloud): update credential handling and configuration
- Replaced references to Docreader credentials with WeKnoraCloud credentials across multiple services and handlers.
- Introduced a new CredentialsConfig structure to manage third-party provider credentials, specifically for WeKnoraCloud.
- Updated database schema to include a credentials column for storing WeKnoraCloud AppID and AppSecret.
- Enhanced methods for retrieving and utilizing WeKnoraCloud credentials, ensuring proper encryption and decryption during storage and retrieval.

This update improves the management of WeKnoraCloud credentials, streamlining the integration and enhancing security measures.
2026-04-15 11:37:24 +08:00
wizardchen 3b23dccd5c feat(model_service): enhance WeKnoraCloud credential management
- Added tenantService to modelService for retrieving WeKnoraCloud credentials when not provided in model parameters.
- Implemented resolveWeKnoraCloudCredentials method to automatically fetch AppID and AppSecret from tenant configuration.
- Updated GetEmbeddingModel, GetEmbeddingModelForTenant, GetRerankModel, and GetChatModel methods to utilize the new credential resolution logic.
- Modified ModelParameters to encrypt and decrypt both APIKey and AppSecret for improved security during database operations.

This update streamlines credential management for WeKnoraCloud models, enhancing security and usability.
2026-04-15 11:37:24 +08:00
wizardchen 86d26fa9bf feat(video): remove video upload support and update related terminology
- Removed support for video file uploads across the application, including updates to the knowledge base and document processing services.
- Updated internationalization files to reflect the removal of video-related terminology, changing labels and descriptions to focus solely on audio processing.
- Adjusted file type handling to exclude video formats, ensuring users receive accurate feedback regarding supported file types.
- Enhanced error handling to provide clear messages when users attempt to upload unsupported video files.

This update streamlines the application by focusing on audio processing capabilities and improving user experience through clearer messaging.
2026-04-14 22:59:14 +08:00
wizardchen 0fcab3a413 feat(video): update ASR terminology and file type labels for improved clarity
- Changed 'Audio Processing' to 'Audio & Video' in English, Korean, Russian, and Chinese translations to reflect expanded functionality.
- Updated ASR configuration titles and descriptions to include video processing capabilities, enhancing user understanding of the feature.
- Renamed file type labels from 'Audio Files' to 'Audio & Video' across multiple languages for consistency and clarity.
- Enhanced document upload handling in the KnowledgeBase to filter unsupported file types, providing user feedback for filtered images, videos, and audio files.

This update improves the internationalization of the application and clarifies the capabilities of the ASR feature.
2026-04-14 22:59:14 +08:00
wizardchen cb97489787 feat(attachment_processor): enhance error handling and content formatting for attachments
- Improved error handling in the attachment processing logic by providing detailed XML-like error messages for text, audio, and document processing failures.
- Updated the audio file content format to use XML tags for better structure, replacing the previous placeholder format.

This update enhances the clarity of error reporting and improves the overall structure of attachment content.
2026-04-14 18:21:12 +08:00
wizardchen bf3e913398 feat(chat_pipeline): enhance query handling with image and attachment metadata
- Updated the query content to include metadata for uploaded images and attachments, improving the context provided to the assistant.
- Modified the attachment prompt format to use XML-like tags for better structure and readability, including metadata for file type and size.
- Enhanced error handling for unsupported file content extraction, providing clearer feedback to users.

This update improves the assistant's ability to process and respond to queries involving multimedia content.
2026-04-14 18:21:12 +08:00
wizardchen 5a2f9f6a44 feat(prompt_templates): add document analysis prompt and enhance rewrite template descriptions
- Introduced a new prompt template for document analysis, allowing the assistant to provide detailed responses based on attached documents.
- Updated the rewrite template descriptions to clarify the handling of image and document attachments, ensuring better user understanding of intent classification.
- Added a new intent type for document-only queries to improve response accuracy.

This update enhances the assistant's capabilities in processing and analyzing documents while refining the user experience in intent classification.
2026-04-14 18:21:12 +08:00
wizardchen 0eff63b308 feat(weknoracloud): implement credential management and status checks
- Introduced a new WeKnoraCloudSettings component for managing APPID and APPSECRET.
- Added functionality to save WeKnoraCloud credentials without automatically creating models.
- Implemented credential status checks across various components to provide user feedback on configuration status.
- Updated API endpoints to handle credential saving and status retrieval.
- Enhanced UI elements to guide users in configuring WeKnoraCloud settings.

This update improves the integration of WeKnoraCloud by allowing users to manage their credentials more effectively and receive real-time feedback on their configuration status.
2026-04-14 17:36:01 +08:00
lyingbug 0ce9dc056a Merge pull request #935 from MaoMengww/feat/attachment_support
feat: attachment_support
2026-04-14 17:35:31 +08:00
ochan.kwon 82b46b4b38 feat: add VectorStore CRUD API endpoints and documentation
Wire VectorStoreService to HTTP with 8 endpoints: types metadata, CRUD
(create/list/get/update/delete), and connection testing (raw + by ID).
Register routes, DI container bindings, and add API documentation.
2026-04-14 17:34:57 +08:00
bingxiang.cheng a2900d5540 chore(deps): 更新并新增go.mod依赖项
- 新增aliyun alibabacloud-oss-go-sdk-v2依赖
- 删除部分冗余依赖,调整依赖列表结构
- 添加jackc/pgx/v5作为直接依赖
- 统一和规范间接依赖声明顺序
- 移除go.opentelemetry.io/contrib的版本替换声明
2026-04-14 17:33:12 +08:00
begoniezhao 5082460cc0 fix(embedding): remove hardcoded TruncatePromptTokens in BatchEmbed
Remove the hardcoded TruncatePromptTokens: 512 limit from WeKnoraCloud
BatchEmbed to allow the API to use its default truncation behavior,
avoiding unexpected truncation of longer input texts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 16:29:49 +08:00
Mao Meng 78e36d4ade Merge upstream main and resolve conflicts 2026-04-14 14:13:00 +08:00
bingxiang.cheng 4054715d54 fix: add missing closing brace in checkOSS function 2026-04-14 10:03:45 +08:00
peterchan2020 8b9094f87c Merge branch 'main' into feat_oss 2026-04-14 00:41:29 +08:00
ochan.kwon 9edf0839ed feat: add VectorStore service layer with types and connection testing
Add VectorStoreService with CRUD validation, duplicate checking (DB + env
stores), and engine-specific health checks for 6 vector database types.
Include VectorStoreResponse DTO, env store builder, engine type metadata,
and comprehensive unit tests.
2026-04-13 22:57:17 +08:00
nullkey 30f349d06a feat(im): support custom endpoints for private WeCom deployments
Allow configuring custom WebSocket and API base URLs for WeCom
via optional credentials fields (ws_endpoint, api_base_url), enabling
integration with privately deployed WeCom instances.

Changes:
- LongConnClient and WebhookAdapter accept custom endpoint URLs
- Endpoint URLs validated at construction (scheme + SSRF check)
- Private deployment hostnames added to file download SSRF allowlist
- Frontend forms added for both WebSocket and Webhook modes
- i18n support for zh-CN, en-US, ru-RU, ko-KR

Uses default public cloud endpoints when not specified.
2026-04-13 22:54:42 +08:00
begoniezhao d4edd374df refactor: replace CryptoService with utils AES helpers and simplify encryption
- Remove infrastructure/crypto package (CryptoService, config, PBKDF2-based encryption)
- Replace with lightweight utils.GetAESKey/EncryptAESGCM/DecryptAESGCM helpers
- Remove cryptoSvc dependency from modelService, tenantService, weKnoraCloudService
- Remove crypto state persistence logic from container initialization
- Add TruncatePromptTokens field to WeKnoraCloud embed request
- Update frontend hint text for WeKnoraCloud credential errors

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-13 20:55:39 +08:00
begoniezhao 2c0c1b8bab feat: integrate ChatBot provider and docreader 2026-04-13 17:47:24 +08:00
peterchan2020 00ce568d02 Merge branch 'Tencent:main' into feat_oss 2026-04-13 15:58:46 +08:00
bingxiang.cheng c21d1edd80 fix(oss): 更新OSS S3兼容模式的注释,修复路径样式描述并禁用自动校验和计算 2026-04-13 15:37:33 +08:00
bingxiang.cheng 12001f23bf fix(oss): 禁用OSS S3兼容API的自动校验和计算,修复签名不匹配问题并调整路径样式设置 2026-04-13 15:37:33 +08:00
bingxiang.cheng 00a09d6c56 fix(oss): 禁用OSS S3兼容API的自动校验和计算,以防止签名不匹配 2026-04-13 15:37:33 +08:00