Commit Graph

597 Commits

Author SHA1 Message Date
nullkey 4e7922c8a1 feat(im): add QuotedContext to shared types and IM service layer 2026-04-03 11:34:22 +08:00
nullkey 3587ddb1c7 feat(wecom): implement quote extraction and populate in handleCallback 2026-04-03 11:34:22 +08:00
nullkey 9790cb4830 feat(im): add QuotedMessage type and Quote field to IncomingMessage 2026-04-03 11:34:22 +08:00
wizardchen 9bb776a91c feat(chat): refine parent-child chunk replacement logic in merge process
- Enhanced the logic for replacing child content with parent content to only apply to text chunks whose parent is a parent_text chunk.
- Added checks to skip non-text chunks and ensure that only appropriate parent chunks are used for replacement, improving content quality and integrity.
2026-04-02 21:42:47 +08:00
wizardchen 4ea58bc6f3 feat(assets): add ASR test audio file and embed it in the application
- Introduced a new audio file, asr_test.wav, for ASR testing purposes.
- Created embed.go to embed the ASR test audio file as a byte slice.
- Updated initialization.go to utilize the embedded ASR test audio for model transcription checks.
2026-04-02 21:27:27 +08:00
wizardchen c93f4e94ae feat(asr): add ASR model connection check and update related components
- Implemented a new function to check ASR model connectivity via the /v1/audio/transcriptions endpoint.
- Updated ModelEditorDialog.vue to integrate ASR model checks and adjust UI elements accordingly.
- Enhanced localization files to reflect changes in ASR terminology and descriptions.
- Added ASR configuration options to the knowledge base and updated related migration scripts.
- Refactored model handling to support ASR as a distinct model type in the application.
2026-04-02 21:27:27 +08:00
wizardchen 624e24ba49 feat(asr): integrate Automatic Speech Recognition (ASR) support
- Added ASR configuration options to the knowledge base and model settings.
- Implemented ASR model selection and transcription capabilities in the knowledge processing pipeline.
- Enhanced file upload support to include audio formats for ASR processing.
- Updated localization files to include ASR-related labels and descriptions.
- Refactored model handling to accommodate ASR as a new model type.
2026-04-02 21:27:27 +08:00
nullkey d68c94a11a fix(stream): use io.EOF instead of errors.New("EOF") in SSEReader
errors.New("EOF") creates a distinct error instance that doesn't match
io.EOF, causing processRawHTTPStream to silently ignore normal stream
termination without sending a done response.

- SSEReader: return io.EOF instead of errors.New("EOF")
- processRawHTTPStream: handle io.EOF as normal completion, send done
  response with usage/toolCalls (aligned with processStream behavior)

Fixes #860
2026-04-02 18:35:53 +08:00
wizardchen cb36570cde feat(summary): enhance document summarization capabilities and UI
- Added max_input_chars configuration to limit input size for summary generation.
- Updated generate_summary.yaml to clarify summary generation steps and requirements.
- Introduced a new summary section in the document content view to display generated summaries or loading states.
- Refactored doc-content.vue to utilize computed properties for improved performance and readability.
- Enhanced knowledge base hooks to include description and summary status fields for better data handling.
- Updated internationalization files to include new summary-related labels in multiple languages.
2026-04-02 18:34:39 +08:00
wizardchen 9d021a29b7 feat(elasticsearch): enhance ID field handling with dynamic suffix detection
- Added logic to determine whether to append the ".keyword" suffix to ID fields based on index mapping.
- Introduced `detectFieldTypes` method to inspect index mappings and set the `useKeywordSuffix` flag accordingly.
- Updated methods to utilize the new `idField` function for consistent ID field querying across the repository.
- Improved logging for better visibility into mapping detection and suffix usage.
2026-04-02 15:26:34 +08:00
ochan.kwon 33e919cc80 fix(knowledge): delete extracted images from storage when knowledge is removed
Previously, only the original uploaded file was deleted via knowledge.FilePath.
Images extracted by the builtin parser (stored as individual S3/MinIO/local files
via ImageResolver) were never cleaned up, causing orphan files to accumulate.

- Add ListImageInfoByKnowledgeIDs repository method (no chunk_type filter)
- Add collectImageURLs utility with URL deduplication and JSON parse logging
- Add deleteExtractedImages helper (standalone, best-effort with error logging)
- Fix DeleteKnowledge: collect image URLs before errgroup, delete in file goroutine
- Fix DeleteKnowledgeList: bulk collect with KB-level fileSvc mapping
- Fix cleanupKnowledgeResources: collect before chunk deletion, delete after
- Fix ProcessKBDelete: collect before chunk deletion for KB-wide cleanup
2026-04-02 12:04:04 +08:00
ochan.kwon 8a375749f1 fix(i18n): use WEKNORA_LANGUAGE env for prompt language fallback instead of hardcoded zh-CN
- Add DefaultLanguage() that reads WEKNORA_LANGUAGE env with zh-CN fallback
- Replace hardcoded zh-CN in LanguageNameFromContext with DefaultLanguage()
- Unify middleware/language.go to use types.DefaultLanguage()
- Add Language field to DocumentProcessPayload (8 enqueue sites + worker restore)
- Add Language field to ImageMultimodalPayload (enqueue + worker restore)
- Propagate language from ImageMultimodalPayload to QuestionGenerationPayload
2026-04-02 12:01:25 +08:00
wizardchen 3756c7c796 feat(session): restrict @mentions to agent's allowed knowledge base scope
- Implemented logic to filter user-provided KB and knowledge IDs based on the shared agent's allowed scope.
- Added a new method, restrictMentionsToAgentScope, to validate and restrict @mentions, preventing unauthorized access to knowledge bases.
- Enhanced logging to provide visibility into blocked mentions and the filtering process.
2026-04-02 10:31:20 +08:00
wizardchen b1fe7abbe1 feat(knowledge): enhance knowledge tag batch update with authorization checks
- Updated UpdateKnowledgeTagBatch method to include an authorizedKBID parameter for restricting updates to specific knowledge items.
- Implemented validation to ensure that all requested knowledge IDs belong to the authorized knowledge base.
- Enhanced GetKnowledgeBatch and UpdateKnowledgeTagBatch methods to incorporate agent-specific knowledge base access restrictions.
- Added utility functions to resolve allowed knowledge base IDs for agents based on their configuration.
2026-04-02 10:31:20 +08:00
wizardchen cb504e35b8 refactor(knowledge): remove unnecessary URL resolution for image paths 2026-04-01 21:59:22 +08:00
wizardchen 8e1cfaccb7 refactor(prompt_templates): improve question generation guidelines and context handling
- Updated the question generation template to clarify the role of surrounding context and main content.
- Enhanced quality rules for generated questions to better align with user search intent.
- Revised output format and added explicit instructions on what not to generate.
- Improved logging and output in the web parser for better visibility of parsed content and metadata.
2026-04-01 21:59:22 +08:00
Windfarer 1b7070c1a2 simplify oidc callback result payload 2026-04-01 20:47:18 +08:00
ochan.kwon 258a786129 Revert "refactor(elasticsearch): remove ".keyword" suffix from ID fields in Elasticsearch queries"
This reverts commit 3daaabfc4a.
2026-04-01 20:41:24 +08:00
wizardchen c4f5db7e88 feat(metadata): enhance document processing to include metadata extraction and handling
- Updated DocReaderServicer to pass metadata in responses.
- Modified PipelineParser to accumulate and merge metadata from all parsers.
- Enhanced StdWebParser to extract and log the title from web page content.
- Implemented logic in knowledge service to update knowledge title based on extracted metadata.
2026-04-01 15:49:47 +08:00
wizardchen ce7df624fb feat(chunker): implement header tracking for Markdown tables during chunking
- Added headerTracker to preserve context of Markdown table headers across split chunks.
- Implemented logic to prepend headers to subsequent chunks after the first.
- Enhanced merging logic to ensure headers are not duplicated in overlapping content.
- Added comprehensive tests for header tracking and chunking behavior with Markdown tables.
2026-04-01 13:38:40 +08:00
nullkey 6eafde98a3 fix(web_fetch): use ValidateURLForSSRF instead of removed IsSSRFSafeURL 2026-03-31 22:26:16 +08:00
nullkey 0b64ef9bd1 fix(security): support IPv6 in SSRF validation via whitelist mechanism
- Keep strict mode blocking all direct IPs (IPv4 and IPv6 uniformly)
- Unify all SSRF call sites to use ValidateURLForSSRF (whitelist-aware)
- Add Teredo (2001:0000::/32) and 6to4 (2002::/16) tunnel detection
- Make redirect handler and DNS pinning respect SSRF_WHITELIST
- Unexport isSSRFSafeURL to prevent future callers bypassing whitelist
- Add scheme validation for whitelisted redirect targets
- Document IPv6 whitelist syntax in .env.example
- Add comprehensive IPv6 test coverage
2026-03-31 20:45:15 +08:00
wizardchen a5ca9a2784 feat(web-search): refactor web search provider
- Updated relevant files to include provider registration, implementation, and metadata.
- Enhanced frontend components to support provider management and configuration.
- Added localization for new provider settings and messages.
- Implemented backend repository methods for CRUD operations on web search providers.
2026-03-31 20:22:34 +08:00
Tavily PR Agent b84ca0b72a feat: add Tavily as web search provider option 2026-03-31 12:24:39 +08:00
wizardchen 4dd481560d refactor(chat): simplify temperature option handling in chat request builders
- Streamlined the handling of the temperature option in both OllamaChat and RemoteAPIChat by removing unnecessary conditional checks.
- Ensured that the temperature value is directly assigned when options are provided, improving code clarity and reducing complexity.
2026-03-31 12:19:22 +08:00
wizardchen aed88d4d9d feat(mcp): implement reconnection logic for MCP tool calls and tool listing
- Added a reconnection retry mechanism for MCP tool calls and tool listing operations to handle stale connections.
- Enhanced error logging to provide clearer feedback during reconnection attempts.
- Updated comments for clarity on the retry behavior and connection management.
2026-03-31 11:57:15 +08:00
wizardchen 1f01183057 feat(database): enhance DatabaseQueryTool with search scope filtering
- Updated DatabaseQueryTool to accept search targets during initialization.
- Implemented search scope filtering in SQL validation to restrict queries to specified knowledge bases and documents.
- Enhanced the SQL validation process to include new filtering options for improved security and query accuracy.
2026-03-31 10:52:01 +08:00
wizardchen eaf17e65f8 docs: remove WeCom document integration from data source import documentation
- Deleted references to WeCom document integration in the data source import module documentation.
- Updated the quick start guide and related sections to reflect the removal of WeCom, enhancing clarity and focus on supported platforms.
2026-03-30 20:46:07 +08:00
wizardchen d2d1d6d59a feat(datasource): enhance DataSourceSettings and DataSourceSyncLogs functionality
- Implemented polling mechanism in DataSourceSettings for real-time updates on data source synchronization status.
- Improved loading state management and user feedback during data source operations.
- Added load more functionality in DataSourceSyncLogs for better log retrieval experience.
- Updated UI elements for consistency, including icon changes and styling adjustments for better visual clarity.
2026-03-30 20:46:07 +08:00
wizardchen 442c340e7f feat(datasource): enforce tenant isolation and knowledge base ownership
- Added checks to ensure that the tenant ID matches between data sources and knowledge bases during creation and updates.
- Implemented ownership verification for data sources and knowledge bases in the DataSourceHandler, enhancing security and access control.
- Refactored data source retrieval methods to centralize ownership validation, improving code maintainability and clarity.
- Updated error handling to provide more informative responses when access is denied or when knowledge bases are not found.
2026-03-30 20:46:07 +08:00
wizardchen 6a5a46cfc3 feat(datasource): add icons and improve data source feedback
- Introduced new icons for Feishu, Notion, and Yuque data sources to enhance visual representation.
- Updated localization files to include success and failure messages for data source creation and synchronization.
- Enhanced DataSourceEditorDialog and DataSourceSettings components with improved user feedback during data source operations.
- Added DataSourceTypeIcon component for consistent icon display across data source settings.
2026-03-30 20:46:07 +08:00
wizardchen 1a340a8374 refactor(datasource): remove WeCom document integration and related components
- Deleted WeCom document connector and callback handling code to streamline the datasource management.
- Removed associated localization entries and UI elements related to WeCom integration.
- Updated data source management logic to eliminate references to WeCom, enhancing maintainability and clarity.
- Adjusted error handling and logging to reflect the removal of WeCom-specific functionality.
2026-03-30 20:46:07 +08:00
wizardchen 53bd412cf6 fix(datasource): enhance error handling in ProcessSync method
- Improved logging for missing data sources, providing clearer warnings when a data source is not found.
- Updated sync log status to 'canceled' when a data source is deleted, ensuring accurate tracking of sync operations.
- Adjusted error handling to prevent unnecessary error returns, enhancing overall process stability.
2026-03-30 20:46:07 +08:00
wizardchen 36dac0120a fix(datasource): improve error handling and user feedback in DataSource components
- Updated error handling in DataSourceSettings and DataSourceEditorDialog to provide more informative messages.
- Enhanced the UI to display error details more clearly, improving user experience during connection tests and resource loading.
- Adjusted HTTP response status checks in request utility for better accuracy in handling success responses.
2026-03-30 20:46:07 +08:00
wizardchen d5ec5dc0ea feat(i18n): update localization files for new UI elements and actions
- Added translations for "Refresh logs" in English, Korean, Russian, and Chinese.
- Enhanced the knowledge base editor modal to include a badge for data source count.
- Improved data source settings UI with a confirmation dialog for deletion and a refresh button in sync logs.
- Updated the data source sync logs component to fetch logs on visibility change and added a refresh option in the header.
2026-03-30 20:46:07 +08:00
wizardchen 11cabd5952 feat(datasource): add WeCom document integration and callback setup
- Implemented WeCom document connector to sync smart documents and WeDrive files into WeKnora.
- Added detailed documentation for WeCom integration, including setup instructions for callback URL and API access.
- Enhanced frontend localization to support WeCom-specific messages and instructions.
- Updated data source management UI to include WeCom configuration options and callback URL handling.
- Improved error handling and validation for WeCom API interactions.
2026-03-30 20:46:07 +08:00
wizardchen adabf8e089 feat(datasource): implement data source management functionality
- Added a new API for managing data sources, including CRUD operations and connection validation.
- Introduced UI components for data source settings, sync logs, and editor dialog, enhancing user experience in managing external data sources.
- Updated localization files to support new data source features in multiple languages.
- Implemented cron expression humanization for better scheduling visibility.
- Enhanced knowledge base editor to include data source management options.
2026-03-30 20:46:07 +08:00
lyingbug ed393c4683 Merge pull request #833 from Windfarer/oidc
feat: Authentication with OIDC
2026-03-30 20:43:56 +08:00
ochan.kwon 5df0ea2de2 feat(knowledge): resolve remote images in file upload path
The file upload pipeline (ProcessDocument) only called ResolveAndStore(),
which handles inline bytes and base64 data URIs but explicitly skips
http/https URLs. This meant markdown files with external image URLs
(e.g. GitHub issue screenshots) were never downloaded, stored, or
processed by VLM multimodal.

Add ResolveRemoteImages() call after ResolveAndStore() in the file
upload path, matching the existing manual processing path behavior.
2026-03-30 20:30:43 +08:00
ochan.kwon 5c0cda3630 fix(storage): add S3 provider scheme support to frontend and backend allowlists
The S3 storage adapter (s3.go) was added in e309e0b but the provider
scheme integration was incomplete — ParseProviderScheme() and frontend
security.ts were not updated, causing s3:// URLs to fail in the /files
proxy, VLM image processing, and frontend rendering.

Additionally, S3-compatible services (MinIO, Ceph, etc.) require
path-style addressing (endpoint/bucket/key) but the SDK client only
used virtual-hosted style. The deprecated WithEndpointResolver API
is replaced with BaseEndpoint, and path-style is auto-enabled for
non-AWS endpoints (detected by amazonaws.com in the URL).

Changes:
- types/knowledgebase.go: add "s3" to ParseProviderScheme()
- file/s3.go: auto path-style for S3-compatible endpoints + replace
  deprecated WithEndpointResolver with BaseEndpoint
- frontend/security.ts: add s3 to 5 provider scheme allowlists
- knowledgebase_test.go: add ParseProviderScheme + InferStorage tests
- s3_test.go: add path-style detection + parseS3FilePath tests
2026-03-30 16:57:27 +08:00
Windfarer 848bbde25d Merge branch 'main' into oidc 2026-03-30 11:31:28 +08:00
Windfarer c1816fe6d6 add oidc 2026-03-30 11:13:44 +08:00
Manx98 1baabb6c05 feat: support system proxy for remote API 2026-03-30 10:46:19 +08:00
ochan.kwon 2d5782992e [NELO-1102] feat(im): add thread-based session mode for IM channels
Add session_mode ("user" | "thread") to IM channel config. In thread
mode, each message thread gets its own session, enabling multi-user
collaboration within the same thread context.

Backend:
- Add SessionMode type constants and validation
- Add ThreadID field to IncomingMessage and ChannelSession
- Split resolveSession into resolveUserSession/resolveThreadSession
- Update makeUserKey to include threadID only in thread mode
- Extract ThreadID in Slack, Mattermost, Feishu, Telegram adapters
- Add message_thread_id to Telegram SendReply/StartStream for Forums
- DB migration 000028: session_mode column + thread_id column + index

Frontend:
- Add session_mode radio group to IMChannelPanel dialog
- Auto-reset session_mode when switching to non-thread platform
- Show thread badge on channel card for thread-mode channels
- Add i18n keys for en-US, ko-KR, zh-CN, ru-RU
2026-03-30 10:43:14 +08:00
AndyYang 930a953f41 feat: fix enable_thinking for Aliyun Qwen models in streaming mode 2026-03-30 10:42:31 +08:00
Rene Zander 309fc7b42b feat: support parallel tool calling
When ParallelToolCalls is enabled in AgentConfig and the LLM returns
2+ tool calls, execute them concurrently via errgroup. Results are
collected in original order for deterministic observe-phase behavior.

Sequential execution remains the default. Parallel mode is opt-in
per agent configuration to avoid side effects with stateful tools.

Refactors executeToolCalls into composable helpers (runToolCall,
executeSingleToolCall, executeToolCallsParallel) for testability.

Fixes #707
2026-03-30 10:41:08 +08:00
Manx98 2a3cc92b99 refactor: use unified NVIDIA API for both chat and VLM 2026-03-30 10:38:50 +08:00
wizardchen 1a954099f0 feat(knowledge): add SQL LIKE keyword escaping and metadata search functionality
- Introduced `escapeLikeKeyword` function to escape SQL LIKE wildcards in search queries, ensuring accurate keyword matching.
- Updated search queries to utilize the new escaping function for filtering by file name and title.
- Added `FindByMetadataKey` method to retrieve knowledge items based on key-value pairs in the metadata JSON column, enhancing search capabilities.
2026-03-27 16:30:07 +08:00
ochan.kwon 380f5d9405 fix(agent): prevent empty response when no Knowledge Base is configured
- guard against empty content completion in analyzeResponse/executeLoop
  with retry (max 2), nudge message, and fallback response
- propagate actual finish_reason through streaming pipeline instead of
  hardcoding "stop" in streamThinkingToEventBus
- add FinishReason field to StreamResponse and streamLLMResult
- add finish marker chunk in processStreamDelta for empty content scenarios
- propagate lastFinishReason through EOF handler in processStream
- strengthen PureAgent system prompt with MCP tool guidelines and
  graceful fallback instructions for unanswerable questions
- add unit tests for empty response bug and finish_reason propagation
2026-03-27 14:56:12 +08:00
Austin Xia 463f40fadc Add im channel Mattermost 2026-03-27 14:32:07 +08:00