Commit Graph

506 Commits

Author SHA1 Message Date
wizardchen 220404348e feat(frontend): add copy action for model cards in settings
Allow users to duplicate non-builtin models (chat / embedding / rerank /
VLLM / ASR) from the model card dropdown. The copied model inherits all
parameters (base_url, api_key, provider, embedding params, custom
headers, vision flag, etc.) and gets a non-conflicting name with a
localized suffix, so users can quickly fork and tweak an existing
configuration without re-entering every field.

Adds matching i18n entries (copySuffix / toasts.copied /
toasts.copyFailed / toasts.builtinCannotCopy) for zh-CN, en-US, ko-KR
and ru-RU.
2026-04-24 00:17:12 +08:00
wizardchen fd3e2992b1 feat(models): support custom HTTP headers across all remote model calls
Introduce per-model `custom_headers` config (similar to OpenAI Python SDK's
`extra_headers`) so users can inject gateway auth tokens, trace IDs, etc.
into every outbound API request for chat / embedding / rerank / VLLM / ASR
models. Reserved headers like Authorization / Content-Type are always
preserved to avoid breaking auth or signing flows.

Along the way, unify production and "test connection" paths onto a single
`ConfigFromModel(*types.Model, appID, appSecret)` constructor in each
model package. Both `service.modelService.GetXxxModel` and the four
`handler.initialization.Check*Model` / `TestEmbeddingModel` endpoints now
go through the same field mapping, so new parameters only need to be
added in one place.

Backend:
- Add `CustomHeaders map[string]string` to `types.ModelParameters` with
  JSON/YAML `omitempty` tags for forward compatibility.
- New `internal/utils/extraheaders.go` providing `ApplyCustomHeaders`
  (for hand-rolled HTTP paths) and `WrapHTTPClientWithHeaders` /
  `CustomHeadersRoundTripper` (for SDK paths like go-openai). Reserved
  headers (Authorization, api-key, Content-Type, Accept, Host,
  Content-Length, User-Agent) are filtered out.
- Inject headers in every remote model path: chat (SDK + raw HTTP),
  embedding (openai/aliyun/jina/volcengine/nvidia/azure_openai), rerank
  (remote_api/aliyun/jina/nvidia/zhipu — via shared `customHeaderSetter`
  interface), VLM and ASR (via http.Client wrapping).
- Add `ConfigFromModel` to each of chat/embedding/rerank/vlm/asr,
  consolidating field mapping (ExtraConfig, CustomHeaders, InterfaceType
  defaulting, WeKnoraCloud credentials, etc.) and cover it with
  dedicated unit tests per package.
- Refactor `service/model.go`: replace ~100 lines of hand-written Config
  literals with one-line `ConfigFromModel` calls; drop the now-unused
  `stringMapToAnyMap` helper.
- Refactor `handler/initialization.go` test-connection endpoints: merge
  four ad-hoc request structs into one `ModelTestRequest`, extract
  `buildTestModel` and `resolveTenantWeKnoraCloudCreds` helpers, and
  route all four endpoints through `ConfigFromModel` + `NewXxx` so the
  test path is now behaviorally identical to production.

Frontend:
- Add `custom_headers` to the `ModelConfig` API type.
- `ModelEditorDialog.vue`: new Key-Value header editor (add/remove rows),
  auto-converts map <-> array when loading/saving, and passes the
  current header set to the `Test Connection` button so the preview
  reflects exactly what production will send.
- `ModelSettings.vue`: serialize the header array back into a map for
  the backend (drops empty rows).
- i18n: add custom-header labels / descriptions / placeholders to
  zh-CN, en-US, ru-RU, ko-KR.

Tests:
- `internal/utils/extraheaders_test.go` covers reserved-header filtering
  and round-tripper wrapping (including nil-client fallback).
- New `config_from_model_test.go` in chat / embedding / rerank / vlm /
  asr verifies all fields (CustomHeaders, ExtraConfig, InterfaceType
  defaulting, AppID/AppSecret) are propagated end-to-end.
2026-04-23 23:36:40 +08:00
wizardchen 3231ae30a4 fix(frontend): bundle tdesign-icons sprite locally for offline deploys
The <t-icon> component from tdesign-vue-next lazily loads its SVG sprite
from https://tdesign.gtimg.com/icon/<ver>/fonts/index.js at runtime. In
air-gapped or intranet deployments this request fails and the whole UI
loses its icons (agent cards, knowledge-base breadcrumbs/cards, upload
buttons, etc.).

Ship the sprite (tdesign-icons-vue-next@0.4.1) as a static asset under
frontend/public/tdesign-icons/0.4.1/fonts/index.js and preload it from
index.html so every <t-icon name="..."> resolves against local symbols.
An offline guard injects stub <script>/<link> nodes that match tdesign's
dedup selectors, so checkScriptAndLoad / checkLinkAndLoad short-circuit
without ever hitting the CDN (covers both the 0.4.0 and 0.4.1 hardcoded
URLs for forward-compat).

Closes #867
Closes #897
2026-04-23 18:21:49 +08:00
wizardchen 4c906e0431 feat: Enhance agent tool compatibility and knowledge base filtering
- Introduced a unified capability requirements system for agent tools, ensuring consistent filtering of knowledge bases based on their capabilities.
- Implemented derived `kb_filter` logic to streamline compatibility checks between agent tools and knowledge bases, reducing redundancy in configuration.
- Updated frontend components to reflect new filtering logic, including improved handling of empty states and user feedback when no compatible knowledge bases are available.
- Enhanced internationalization support by adding relevant messages for tool compatibility issues across multiple languages.
2026-04-23 17:28:00 +08:00
wizardchen 7dd6ed47c1 feat: Enhance chunking configuration for wiki indexing strategy
- Introduced chunkingDirty state to track manual adjustments to chunking settings, preventing automatic overrides during strategy changes.
- Added WIKI_ONLY_CHUNKING_PRESET for specific configurations when using the wiki-only indexing strategy, ensuring optimal settings in creation mode.
- Implemented logic to apply or revert chunking presets based on the current indexing strategy, maintaining user-defined settings in edit mode.
- Updated resetState function to clear chunkingDirty state upon modal reset.
2026-04-23 11:21:28 +08:00
wizardchen c5494f612b feat: Implement auto-linked content updates in wiki page management
- Introduced UpdateAutoLinkedContent method to persist changes from machine-only link decorators without incrementing the version number, ensuring user-facing revisions remain consistent.
- Updated existing methods to utilize the new auto-linked content update logic, enhancing the handling of cross-link injection and dead-link cleanup.
- Enhanced the KnowledgeBase and WikiBrowser components to improve user experience during wiki operations, including status tracking and indexing indicators.
- Added scheduling for wiki status probes to provide timely feedback on indexing processes after user-triggered actions.
2026-04-23 11:16:47 +08:00
wizardchen d305d5eb7c feat: Implement wiki status tracking and indexing indicators in KnowledgeBase and WikiBrowser components
- Added functionality to track and display the wiki indexing status, including pending tasks and active state.
- Introduced a polling mechanism to update the wiki status at regular intervals, enhancing user awareness of background processes.
- Updated the breadcrumb navigation to show indexing indicators, improving the user interface and experience during wiki operations.
- Enhanced the WikiBrowser component to emit status changes to the parent component for better state management.
2026-04-23 10:53:28 +08:00
wizardchen 0d429613e2 style: Update WikiBrowser component styles for improved layout
- Added line-height to text elements for better readability.
- Enhanced the legend-action-icon class with display properties for improved alignment and consistency in icon presentation.
- Adjusted font sizes and line heights for better visual hierarchy and user experience.
2026-04-23 10:47:43 +08:00
wizardchen 8099f6cc60 chore: Update dependencies in package.json and package-lock.json
- Upgraded the `mermaid` package from version 11.4.1 to 11.14.0 for improved features and bug fixes.
- Changed the resolved URLs for several `@chevrotain` packages to use Tencent's mirror, enhancing download reliability.
- Added the `@upsetjs/venn.js` package version 2.0.0 to the project, expanding visualization capabilities.
- Updated the `acorn` package from version 8.15.0 to 8.16.0 to incorporate the latest improvements.
2026-04-23 10:44:39 +08:00
wizardchen 50c1c70334 feat: Update agent type presets and prompt templates for improved knowledge base handling
- Changed `kb_selection_mode` in agent type presets from "selected" to "all" to allow agents to access all knowledge bases by default.
- Revised prompt templates to clarify the handling of bound knowledge bases, replacing the `{{knowledge_bases}}` placeholder with a reference to the `<bound_knowledge_bases>` block in the user message's `<runtime_context>`.
- Enhanced internal logic to ensure that only searchable knowledge bases are considered during retrieval, improving the efficiency of knowledge searches.
- Added new functions for better formatting and handling of knowledge base metadata in the runtime context.
- Updated documentation and comments for clarity on the changes made to knowledge base interactions.
2026-04-22 21:18:34 +08:00
wizardchen a8a3d9e694 feat: Enhance wiki extraction and configuration options
- Introduced extraction granularity settings in the wiki configuration, allowing users to control the level of detail in entity and concept extraction (focused, standard, exhaustive).
- Updated the UI to reflect these new options, including tooltips for better user guidance.
- Refactored the knowledge base editor to support the new extraction granularity feature, ensuring a seamless user experience.
- Improved the backend logic for wiki ingest tasks to utilize the new granularity settings, enhancing the accuracy of extracted content.
- Added tests to validate the new extraction granularity functionality and ensure robust performance across different configurations.
2026-04-22 21:18:32 +08:00
wizardchen 623add89f1 fix: Improve inline code sanitization in AgentStreamDisplay component
- Enhanced the `sanitizeForDisplay` function to correctly remove empty inline code snippets (`` or ` `) while preserving triple-backtick fenced code blocks.
- This change ensures better rendering of code blocks in the chat interface, improving overall display accuracy.
2026-04-22 21:18:32 +08:00
wizardchen 31b22cf92c feat: Enhance Wails desktop app key handling for page reload
- Introduced a check for Wails desktop environment to conditionally intercept Cmd/Ctrl+R key presses, preventing full page reloads that could lead to a white screen.
- Updated event listener management to ensure key handling is only active in the Wails desktop context, improving user experience by maintaining application state during refresh actions.
- Added comments for clarity on the purpose of these changes and their impact on different deployment environments.
2026-04-22 21:18:31 +08:00
wizardchen c986773643 feat: Adjust table styling in WikiBrowser for improved layout
- Modified the CSS for markdown tables to use `width: fit-content`, allowing tables to shrink to their content while still respecting `max-width: 100%`.
- This change enhances the presentation of tables, ensuring better usability and visual consistency within the WikiBrowser interface.
2026-04-22 21:18:31 +08:00
wizardchen 55ebb89ba5 feat: Add page refresh functionality and enhance table styling in WikiBrowser
- Implemented a new `refreshSelectedPage` function to update the content of the currently selected wiki page without altering navigation history, improving user experience by ensuring up-to-date information is displayed.
- Enhanced the graph view to reload when the user is currently viewing it, ensuring new nodes and edges are visible.
- Added comprehensive CSS styles for markdown tables, improving their presentation and usability within the WikiBrowser interface.

These changes enhance the interactivity and visual consistency of the WikiBrowser, providing users with a more dynamic and engaging experience.
2026-04-22 21:18:31 +08:00
wizardchen 3b89598c6c feat: Implement debounced hover handling in WikiBrowser for improved node interaction
- Introduced a shared timer for debouncing mouseleave to mouseenter transitions, preventing flickering when quickly moving between adjacent nodes.
- Updated event listeners to clear and set the hover timer, ensuring smoother highlight transitions without abrupt visual changes.
- Enhanced the rendering logic to maintain consistent highlighting behavior based on node selection state.

These changes enhance the user experience by providing a more fluid interaction with the graph nodes in the WikiBrowser.
2026-04-22 21:18:30 +08:00
wizardchen 3c2b29456a feat: Refactor wiki citation handling in chat bubbles for improved consistency
- Simplified the rendering of wiki citations in chat bubbles by removing truncation and inline pill styles, replacing them with a standard link format.
- Updated CSS styles to reflect the new inline link design, featuring a brand-blue dashed underline for better visual integration with surrounding text.
- Enhanced accessibility by maintaining the use of the `data-slug` attribute for interaction handling.

These changes streamline the presentation of wiki citations, improving user experience and visual consistency across the chat interface.
2026-04-22 21:18:30 +08:00
wizardchen b3eab5276c feat: Update agent system prompt and frontend citation handling for wiki sources
- Enhanced the agent system prompt to clarify citation formats for wiki and chunk sources, ensuring accurate inline citations.
- Introduced a new citation format section in the prompt, detailing the required syntax for both wiki pages and knowledge chunks.
- Updated the frontend to visually align wiki citations with knowledge base citations, improving user experience and consistency in citation presentation.
- Implemented truncation for long wiki labels in citations to maintain visual consistency in chat bubbles.

These changes improve the clarity and usability of citations in the agent system, enhancing the overall information retrieval process.
2026-04-22 21:18:21 +08:00
wizardchen 4022f134bd feat: Introduce agent type presets for smart-reasoning mode
- Added a new configuration file `agent_type_presets.yaml` to define various agent type presets, including RAG Q&A, Wiki Q&A, Hybrid (Wiki + RAG), and Data Analysis.
- Updated the `builtin_agents.yaml` to associate built-in agents with the new agent type presets, enhancing their configuration options.
- Enhanced the agent system prompt templates to reflect the new agent types and their functionalities.
- Implemented API endpoints to retrieve agent type presets, allowing for dynamic loading in the frontend.
- Updated the frontend to support agent type selection in the agent editor modal, improving user experience by auto-filling relevant configurations based on selected presets.

These changes significantly enhance the flexibility and usability of the agent system, allowing users to easily configure agents based on predefined types.
2026-04-22 21:18:20 +08:00
wizardchen 0531700518 feat: Enhance suggested questions functionality with wiki integration
- Updated the SuggestedQuestion interface to include 'wiki' as a new source type, allowing for more diverse question origins.
- Implemented ListRecentForSuggestions method in the wikiPageRepository to retrieve recent wiki pages for fallback suggestions, improving the agent's ability to generate relevant questions when other sources are unavailable.
- Enhanced the customAgentService to utilize the new wiki page suggestions, ensuring a broader range of questions can be generated from wiki content.

These changes significantly improve the agent's suggestion capabilities by incorporating wiki content, enhancing user interaction and information retrieval.
2026-04-22 21:18:20 +08:00
wizardchen 3f97a7a090 feat: Add locked indexing strategy warning and UI enhancements in KnowledgeBaseEditorModal
- Introduced a new warning message in English and Chinese to inform users that the indexing strategy cannot be changed once the knowledge base contains content.
- Updated the UI to visually indicate when indexing options are locked, preventing user interaction with disabled checkboxes.
- Enhanced the styling of the indexing strategy section to improve user experience and clarity.

These changes ensure users are aware of the restrictions on indexing strategy modifications, enhancing the overall usability of the knowledge base editor.
2026-04-22 21:18:20 +08:00
wizardchen 8461d5ce4d feat: Enhance agent system prompt and localization for wiki tools
- Updated the agent system prompt to include new auxiliary tools and improved synthesis and issue flagging steps, enhancing the clarity of the workflow.
- Revised constraints to emphasize the importance of retrieving information from the wiki first and using skills when applicable.
- Expanded localization files for English, Korean, Russian, and Chinese to include new wiki tool descriptions and statuses, ensuring consistency across languages.
- Improved the agent editor modal to provide a clearer overview of tool statuses and retrieval preferences, enhancing user experience.

These changes significantly improve the functionality and usability of the agent system, particularly in relation to wiki interactions and tool management.
2026-04-22 21:18:19 +08:00
wizardchen 86c227dd02 feat: Revamp indexing strategy UI in KnowledgeBaseEditorModal
- Enhanced the indexing strategy section by adding descriptions and a new layout for better user interaction.
- Introduced toggle functionality for vector indexing and improved the visual presentation of indexing options with new styles and badges.
- Updated the component's CSS to create a more responsive and user-friendly design for indexing check items.

These changes significantly improve the usability and clarity of the indexing strategy settings in the knowledge base editor.
2026-04-22 21:18:12 +08:00
wizardchen 0429776e9f feat: Enhance knowledge base retrieval and runtime context handling
- Improved the `getKbIdForWiki` function to better handle multiple knowledge bases associated with a single slug, ensuring the most recent tool call's mapping is prioritized.
- Updated the `buildRuntimeContextBlock` function to include active knowledge bases and pinned documents, providing a clearer context for multi-turn interactions and preventing prompt injection.
- Added `registerLinkedSlugs` function to track outbound and inbound links for wiki pages, facilitating better resolution of slugs in the frontend without additional requests.

These enhancements significantly improve the accuracy and safety of knowledge base retrieval and context management in the agent system.
2026-04-22 21:18:11 +08:00
wizardchen 1d72a25e25 feat: Enhance chat UI and wiki page retrieval logic
- Updated the chat component to include a new class for handling sidebar collapse, improving layout responsiveness.
- Enhanced the wiki page retrieval logic to support multiple knowledge bases for the same slug, allowing for more comprehensive results.
- Introduced a mechanism to track ambiguous slugs across knowledge bases, improving clarity in search results.

These changes significantly improve the user experience in the chat interface and enhance the functionality of the wiki page retrieval system.
2026-04-22 21:18:11 +08:00
wizardchen bd5d70b5ae feat: Add wiki drawer functionality and localization support in AgentStreamDisplay
- Introduced a new wiki drawer component in AgentStreamDisplay for enhanced navigation to wiki pages, allowing users to view detailed content and related metadata.
- Implemented localization for the new "View in Graph" feature in both English and Chinese, improving accessibility for diverse user bases.
- Updated the WikiBrowser component to utilize the new drawer for displaying wiki content, streamlining the user experience when interacting with wiki links.

These enhancements significantly improve the usability and functionality of the wiki navigation system, providing users with a more intuitive experience when accessing and citing wiki content.
2026-04-22 21:18:10 +08:00
wizardchen e9ed8d1961 feat: Enhance wiki navigation and citation handling in AgentStreamDisplay and WikiBrowser
- Updated the agent system prompt to require wiki-links in citations, improving user navigation to source pages.
- Implemented logic in AgentStreamDisplay to handle wiki link clicks and keyboard interactions, facilitating seamless navigation to knowledge base wiki pages.
- Enhanced WikiBrowser to auto-select pages based on query parameters, improving user experience when accessing specific wiki content.
- Added localization support for new error messages related to knowledge base identification, ensuring clarity in user interactions.

These changes significantly improve the usability and functionality of the wiki navigation system, providing users with a more intuitive experience when accessing and citing wiki content.
2026-04-22 21:18:10 +08:00
wizardchen 28deb8282f feat: Add comprehensive documentation for WeKnora knowledge base and wiki features
- Introduced multiple new documentation files, including a complete documentation index, quick reference guides, and comprehensive analyses of the knowledge base and wiki settings.
- The new files provide detailed insights into the architecture, data models, API endpoints, and implementation strategies for the knowledge base and wiki functionalities.
- Enhanced navigation and usability for developers and team members by summarizing key components, configurations, and data flows related to the knowledge base system.

These additions significantly improve the clarity and accessibility of documentation, supporting better onboarding and reference for current and future team members.
2026-04-22 21:18:10 +08:00
wizardchen 572c330907 feat: Optimize graph filtering logic in WikiBrowser component
- Introduced a node map for O(1) lookups, improving performance when applying graph filters.
- Updated edge visibility checks to utilize the new node map, enhancing efficiency in rendering.
- Adjusted highlight logic to leverage the node map for better clarity in selected nodes.
- Modified rendering logic to improve animation performance by adjusting threshold values.

These changes enhance the responsiveness and efficiency of the graph rendering in the WikiBrowser, contributing to a smoother user experience.
2026-04-22 21:18:09 +08:00
wizardchen 4b3f41812f feat: Update chat creation UI and enhance knowledge post-processing logic
- Modified the chat creation component to improve layout and responsiveness by adjusting the dialogue answers section.
- Refined the logic in the KnowledgePostProcessService to conditionally spawn wiki ingest tasks based on wiki configuration settings, enhancing task management.
- Added migration scripts for creating and dropping the `wiki_page_issues` table, facilitating better issue tracking within the wiki system.

These changes enhance the user interface for chat creation and improve the backend processing of knowledge base tasks, contributing to a more efficient and user-friendly experience.
2026-04-22 21:18:09 +08:00
wizardchen 99cc721140 feat: Enhance wiki API and repository with slug encoding and improved search functionality
- Introduced `encodeSlugPath` function to safely encode wiki slugs for API requests, preserving hierarchical routing.
- Updated API functions to utilize the new slug encoding for `getWikiPage`, `updateWikiPage`, and `deleteWikiPage`.
- Enhanced `ListBySourceRef` method in the repository to safely handle source knowledge IDs with JSON marshalling, improving query security.
- Added `escapeLikePattern` function to ensure safe concatenation of LIKE patterns in SQL queries, preventing unintended matches.
- Updated `KnowledgePostProcessService` to include Redis client for task management, improving performance in handling wiki ingest tasks.
- Enhanced `WikiLintIssue` structure to include `TargetSlug` for better issue tracking and auto-fixing capabilities.

These changes significantly improve the robustness and security of the wiki management system, enhancing user experience and data integrity.
2026-04-22 21:18:09 +08:00
wizardchen 84edfa5439 feat: Implement wiki editing functionalities and UI components
- Added new tools for wiki page editing, including writing, replacing text, renaming, and deleting pages, with corresponding data structures for each action.
- Enhanced the frontend with a new `WikiEditResult` component to display results of wiki edits, supporting multiple languages for improved accessibility.
- Updated localization files for English and Chinese to include new strings related to wiki actions.
- Modified existing tools to return structured data for wiki actions, improving the clarity and usability of the output messages.

These changes significantly enhance the wiki editing capabilities, providing users with a more robust and user-friendly experience when managing wiki content.
2026-04-22 21:18:08 +08:00
wizardchen 995e2157cd feat: Enhance Wiki Fixer agent with improved issue handling and UI updates
- Updated the agent system prompt to refine the workflow for fixing issues, emphasizing the need to verify if issues still exist before making edits.
- Introduced a new `embeddedMode` prop in the frontend components to manage UI behavior based on the context of use.
- Simplified issue fix prompts in multiple languages for clarity, ensuring users receive concise instructions for resolving issues.
- Enhanced the WikiBrowser component to improve the display of issues and actions, including updated icons and streamlined interaction elements.

These changes significantly improve the user experience and functionality of the Wiki Fixer agent, fostering more efficient issue resolution and content management.
2026-04-22 21:18:08 +08:00
wizardchen bd096454e1 feat: Introduce Wiki Fixer agent and related functionalities
- Added a new built-in agent, "Wiki Fixer," designed to repair and optimize Wiki pages based on linter issues, with multilingual support for enhanced accessibility.
- Implemented a corresponding system prompt detailing the agent's role, mission, and workflow for effective issue resolution.
- Introduced new API functions for listing and updating wiki issues, allowing for better management of content conflicts and errors.
- Enhanced the frontend with new UI elements to display pending issues and facilitate auto-fixing, improving user interaction with the Wiki content.

These changes significantly enhance the agent's capabilities for maintaining the accuracy and quality of Wiki pages, fostering a more reliable knowledge base.
2026-04-22 21:18:08 +08:00
wizardchen 8dd50de8d4 feat: Add "Fit to View" functionality and enhance graph filtering in WikiBrowser
- Introduced a new "Fit to View" action in the WikiBrowser component, allowing users to automatically adjust the graph display to fit the visible area.
- Implemented graph filtering capabilities, enabling users to toggle the visibility of different node types, improving the overall interactivity and usability of the graph interface.
- Updated localization files for English, Korean, Russian, and Chinese to include the new "Fit to View" message, ensuring consistent user experience across languages.

These enhancements significantly improve the user experience by providing better control over graph visualization and interaction.
2026-04-22 21:17:33 +08:00
wizardchen ae25c97807 fix: Improve graph rendering dynamics in WikiBrowser component
- Adjusted repulsion force calculation to prevent extreme values when nodes are close together, enhancing stability during graph rendering.
- Increased gravity strength based on the number of nodes to prevent excessive expansion of the graph.
- Implemented a velocity cap to limit node movement during initial layout, ensuring nodes remain within the visible area.

These changes enhance the performance and visual stability of the graph in the WikiBrowser component.
2026-04-22 21:17:32 +08:00
wizardchen 8daf6b368c feat: Add pending tasks and active status to WikiStats
- Introduced `pending_tasks` and `is_active` fields in the `WikiStats` interface to track the number of tasks waiting for processing and the current activity status of the wiki ingestion.
- Updated localization files for English, Korean, Russian, and Chinese to include a new message for displaying the number of pending tasks in the wiki queue.
- Enhanced the `WikiBrowser` component to display the queue status, improving user awareness of ongoing tasks.
- Implemented polling logic to refresh wiki stats periodically when there are pending tasks or active ingestion, ensuring up-to-date information is presented.

These changes enhance the functionality and user experience of the wiki management system by providing real-time insights into task status.
2026-04-22 21:17:31 +08:00
wizardchen d9cf4b7aa9 feat: implement metadata-based alias management for wiki pages
Made-with: Cursor
2026-04-22 21:17:29 +08:00
wizardchen 233c398d7a feat: Enhance image preview functionality in WikiBrowser component
- Updated the `picture-preview.vue` component to conditionally render images based on the `reviewUrl` prop, improving performance and usability.
- Integrated image preview functionality into the `WikiBrowser` component, allowing users to view images in a modal when clicked.
- Added references for `drawerBodyRef` and `readerBodyRef` to facilitate image loading and hydration, ensuring images are displayed correctly.
- Enhanced the `prompts_wiki.go` file to include new image handling rules for summaries, ensuring images are contextually relevant in generated content.

These changes improve the user experience by providing a seamless image viewing option within the WikiBrowser interface.
2026-04-22 21:17:28 +08:00
wizardchen f1c9876461 feat: Enhance graph interaction and visualization in WikiBrowser component
- Added a search overlay for graph nodes, allowing users to filter and select nodes more efficiently.
- Introduced a legend overlay to clarify node types and provide toggle functionality for arrow visibility on graph edges.
- Improved SVG rendering for graph elements, including enhanced arrow designs and added drop shadow effects for better visual distinction.
- Updated state management to support new graph interaction features, enhancing user experience and interactivity.

These changes collectively improve the usability and visual appeal of the graph interface in the WikiBrowser component.
2026-04-22 21:17:27 +08:00
wizardchen 3e651cfa61 refactor: Update localization files and enhance WikiBrowser component
- Removed duplicate entries for "Wiki" in English, Korean, Russian, and Chinese localization files.
- Added "Index" title to localization files for English, Korean, Russian, and Chinese.
- Refactored the WikiBrowser component to improve class names and structure for better readability and maintainability.

These changes enhance the localization consistency and improve the overall structure of the WikiBrowser component.
2026-04-22 21:17:26 +08:00
wizardchen 5d5073c96b refactor: Update wiki link syntax and rendering in WikiBrowser component
- Enhanced the `renderMarkdown` function to support the new `[[slug|display name]]` format for wiki links, improving link clarity and usability.
- Adjusted CSS styles for wiki links to provide a more intuitive hover effect and visual distinction.
- Updated prompts in the `prompts_wiki.go` file to reflect the new wiki link syntax, ensuring consistency across the application.

These changes improve the overall user experience by making wiki links more informative and visually appealing.
2026-04-22 21:17:26 +08:00
wizardchen 9be4152449 feat: Enhance search functionality in WikiPage repository and WikiBrowser component
- Updated the search logic in the WikiPage repository to use ILIKE for case-insensitive matching on title, content, summary, and slug fields, improving search accuracy.
- Added a watcher in the WikiBrowser component to reload all pages when the search query is cleared, enhancing user experience by ensuring relevant content is displayed immediately.

These changes collectively improve the search capabilities and responsiveness of the wiki interface.
2026-04-22 21:17:22 +08:00
wizardchen 0e28b2448c feat: Add arrow toggle functionality in WikiBrowser component
Implemented new features in the WikiBrowser component to allow users to toggle the visibility of arrows on graph edges. This includes:

1. **Localization Updates**: Added translations for "Show arrows" and "Hide arrows" in English, Korean, Russian, and Chinese.
2. **Graph Rendering Enhancements**: Introduced logic to dynamically update SVG line attributes based on the toggle state, improving visual clarity in graph representations.
3. **State Management**: Added reactive state management for arrow visibility, ensuring seamless user interaction.

These changes enhance the user experience by providing more control over graph visualizations.
2026-04-22 21:17:22 +08:00
wizardchen d4d005422d feat: Implement wiki_config updates in knowledge base management
Added functionality to enable updates for the `wiki_config` field in the `KnowledgeBaseConfig` struct. This includes:

1. **Type Definition Update**: Added `WikiConfig` field to `KnowledgeBaseConfig` to allow JSON unmarshaling during update requests.
2. **Service Layer Enhancement**: Updated the `UpdateKnowledgeBase` method to persist changes to `wiki_config` when provided in the request.
3. **Frontend TypeScript Adjustments**: Enhanced type definitions in the frontend to support `wiki_config`, improving IDE autocomplete and type checking.

This fix addresses the critical issue where `wiki_config` was not being updated due to its absence in the `KnowledgeBaseConfig` struct, ensuring proper handling of wiki configurations during knowledge base updates.
2026-04-22 21:17:21 +08:00
wizardchen e15adca0a6 fix: Enable wiki_config updates in knowledge base configuration
Implemented three critical fixes to enable wiki_config persistence during
KB creation and updates:

1. Add WikiConfig field to KnowledgeBaseConfig struct
   - File: internal/types/knowledgebase.go
   - Enables JSON unmarshaling of wiki_config from update requests
   - Previously the field was silently dropped during deserialization

2. Update UpdateKnowledgeBase service to persist wiki_config
   - File: internal/application/service/knowledgebase.go
   - Added logic to apply wiki_config changes when config parameter is provided
   - Mirrors existing logic for FAQConfig persistence

3. Update frontend TypeScript types for IDE completion
   - File: frontend/src/api/knowledge-base/index.ts
   - Added WikiConfig type to createKnowledgeBase function signature
   - Added structured WikiConfig type to updateKnowledgeBase config parameter
   - Enables TypeScript IDE autocomplete and type checking

Flow:
- Frontend: updateKnowledgeBase({name, description, config: {wiki_config}})
- Handler: Parses into UpdateKnowledgeBaseRequest via KnowledgeBaseConfig
- Service: Applies wiki_config to KB entity via UpdateKnowledgeBase
- Database: Persists wiki_config JSONB field to postgres

Root cause analysis:
Previously, the KnowledgeBaseConfig struct was missing the WikiConfig field,
causing JSON unmarshaling to silently drop any wiki_config data sent in
PUT requests. KB creation worked because it used the full KnowledgeBase struct.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-22 21:17:20 +08:00
wizardchen 16a0bff7bd feat: Enhance wiki functionality with recent activity log
This commit introduces a new "Recent Activity" section in the WikiBrowser component, allowing users to view the latest changes made to the wiki. The implementation includes:

- Addition of a toggleable recent activity log displaying the last five entries.
- Backend support for fetching the activity log from the knowledge base.
- Updates to the wiki ingest process to ensure draft pages are published post-ingest.
- Improvements to the deduplication process for entities and concepts during wiki page creation.

These enhancements aim to improve user engagement and provide better insights into wiki updates.
2026-04-22 21:17:19 +08:00
wizardchen e147209e77 feat: Implement comprehensive wiki feature for knowledge bases
This commit introduces the complete wiki feature for WeKnora, enabling AI-powered wiki page generation and management. The implementation includes:

**Backend Changes:**
- Wiki data model: WikiPage type with support for multiple page types (Summary, Entity, Concept, Index, Log)
- Database schema: wiki_pages table with full migration support
- WikiPageService: CRUD operations and page management
- WikiPageRepository: GORM-based persistence layer
- Wiki ingest pipeline: Automated generation of wiki pages from knowledge documents
  * Summary page generation using LLM
  * Entity and concept extraction in a single LLM call
  * Synthesis opportunity detection
  * Index page rebuilding
  * Log page maintenance
- Wiki boost feature: Enhance chat retrieval with wiki context
- Wiki linting: Maintenance and validation utilities
- Agent wiki tools: Enable agents to query and interact with wiki pages
- Wiki prompts: Comprehensive LLM prompt templates for all wiki generation tasks
- Language support: Reuse existing middleware language infrastructure for LLM prompts

**Frontend Changes:**
- Wiki browser UI: View all wiki pages with filtering and search
- Wiki API client: Knowledge base wiki management endpoints
- Knowledge base editor: Configure wiki settings (language, auto-ingest, synthesis model)
- i18n updates: Support for English, Korean, Russian, and Chinese interfaces

**Configuration:**
- Container DI: Wire up all wiki services
- Router: Register wiki API endpoints
- Task handling: Support async wiki ingest tasks

**Testing:**
- Unit tests for wiki page types
- Service layer tests
- Endpoint tests for wiki operations
- Integration tests with LLM mocking

**Documentation:**
- Language refactoring analysis and guides
- Implementation completion reports
- Quick reference guides for developers

**Key Features:**
✅ LLM-powered wiki page generation from documents
✅ Multi-language support (9+ languages)
✅ Automatic extraction of entities and concepts
✅ Synthesis opportunity detection
✅ Index and log page maintenance
✅ Progressive wiki building across multiple documents
✅ Agent-based wiki interaction
✅ Chat retrieval enhancement with wiki context
✅ Full frontend UI for wiki browsing

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-22 21:17:18 +08:00
nullkey 16792713c5 feat(frontend): enable Yuque datasource option with optional base_url
Flip the Yuque tile to available, add a base_url field (optional) for users
on private Yuque deployments, and populate the permission doc/page links.
Introduces an optional flag on ConnectorDef.fields so the Test Connection
validator skips empty optional fields; required fields get a visible * mark.

Also adds an optional hintKey on ConnectorDef.fields for per-field guidance
text, a Yuque-specific prereq guide, and a base_url hint explaining when to
leave it empty vs fill it for Yuque Enterprise / self-hosted deployments.
2026-04-22 16:39:55 +08:00
jw_mac a121a5d636 fix(frontend): 修复公式输出展示问题并引入 KaTeX 支持 (#912) 2026-04-22 16:38:24 +08:00