Commit Graph

941 Commits

Author SHA1 Message Date
hbh112233abc fd660ca796 fix(embed): 兼容不支持 crypto.randomUUID 的浏览器以及http请求模式 2026-07-21 12:01:47 +08:00
wizardchen 25ef7b6c68 feat(session): gate IM/embed/API channel sessions behind admin
Restrict channel-managed sessions (API keys, IM, embed) to tenant admin
in the Web console for list/read paths, hide channel sidebar buckets from
non-admins, and add CountSessionsBySource for aggregate stats without
exposing session rows to viewers.
2026-07-20 20:31:54 +08:00
wizardchen b1b42abe23 fix(rerank): batch Volcengine rerank requests over API document limit
Split oversized candidate sets into concurrent batches instead of failing when retrieval exceeds the VikingDB rerank per-request cap, and align ko/ru locale hints with zh-CN.
2026-07-20 20:07:21 +08:00
KKtwo 3011f132e9 feat: support Volcengine rerank 2026-07-20 19:58:48 +08:00
jacentsao c387f09add fix(frontend): load complete TDesign styles 2026-07-20 19:52:30 +08:00
wizardchen 76a4ffe525 feat(session): add admin API session bucket and stabilize sidebar filter
Let tenant admins list and open API-key sessions from the Web console while
keeping per-key isolation for everyone else. Pin the session source filter so
it no longer jumps when switching buckets, and resolve session origin on read
so deep links stay in sync with the active folder after refresh.
2026-07-20 19:31:02 +08:00
wizardchen eab91d2f7f feat(web-search): add Zhipu AI web search provider support
Integrate Zhipu's standalone Web Search API with configurable search
engine and content size options, plus settings UI, docs, and tests.
2026-07-20 12:15:35 +08:00
wizardchen 380e371c2e refactor: remove Neo4j-based conversation memory feature
Drop the memory pipeline, API fields, settings UI, and embed toggles so chat no longer depends on Neo4j graph storage for episodic recall.
2026-07-18 23:41:48 +08:00
wizardchen e294dff7f4 feat(chat): enhance ChatHeader with docked state and references panel support
Add a new 'is-docked' class to the ChatHeader component for improved styling when the references panel is visible. Introduce a 'hasReferencesPanel' prop to manage this state, enhancing the layout and responsiveness of the chat header on wider screens.
2026-07-17 17:55:04 +08:00
wizardchen 457285cffe style(chat): widen conversation content area from 800px to 960px
Improve readability on wide screens by expanding the main chat column and aligning related sub-component widths.
2026-07-17 17:55:04 +08:00
wizardchen 1a2021b3f8 feat(chat): add session header actions and Markdown export
Give chat a left-aligned header for rename/pin/copy/clear/delete, share session mutations across sidebar and chat view, and support copying the full conversation as Markdown.
2026-07-17 16:16:35 +08:00
wizardchen df21abe13b fix(parser): remove workspace chat parser policy UI
Chat attachment parser rules belong on agents; drop the duplicate workspace settings section while preserving legacy tenant rules when engine config is updated without that field.
2026-07-17 13:42:02 +08:00
wizardchen bea58bbef7 fix(chat): emit retrieval references when citation output is disabled
Decouple the references SSE event from the per-agent citation output toggle
so the retrieval-results drawer still works, and align follow-up suggestion
card layout with the chat column.
2026-07-17 11:38:35 +08:00
qilifan 9afb8b7b68 feat(im,datasource): support Lark, Feishu's international edition
Lark and Feishu are the same product deployed on two isolated clouds
(open.larksuite.com and open.feishu.cn). WeKnora touches both from two
places — the IM bot and the Wiki data-source connector — and this brings
Lark to parity across both. Neither API surface differs, so rather than
duplicate either implementation, each is parametrized by a Region and
registered twice.

IM (internal/im/feishu):
  Every API call routes through a.api(), which prefixes the region's
  host, and the WebSocket client passes larkws.WithDomain — the SDK
  defaults to open.feishu.cn, so Lark long connections would otherwise
  fail to authenticate.

Data source (internal/datasource/connector/feishu):
  Lark was half-supported: the client honoured a base_url override and a
  LarkBaseURL constant existed, but the connector registered only as
  "feishu" and the UI never exposed base_url, so Lark wikis could not be
  configured at all. Lark is now its own connector type. base_url is kept
  as an explicit override so data sources that pointed a "feishu"
  connector at open.larksuite.com keep working.

Bugs found and fixed along the way:

- Wiki resource links were hardcoded to https://feishu.cn/wiki/{token} in
  four places, so a Lark wiki linked into the wrong cloud entirely.
- Bot identity is now platform-prefixed (feishu:cli_x vs lark:cli_x).
  BotIdentity carries a unique index, so without this a Lark channel
  would be rejected as a duplicate of an unrelated Feishu bot sharing an
  app_id.
- The card image cache is now keyed by app_id. image_keys are issued per
  app on one cloud; a Feishu key handed to a Lark app fails the card
  update with code=200570.
- The datasource doc claimed Lark "adapts automatically" — it could not,
  since the UI had no way to reach base_url.

Permissions are where the clouds genuinely diverge. Identical APIs do not
mean identical permission catalogues: aily:file:read, aily:file:write and
corehr:file:download exist on Feishu but not on Lark, so pasting Feishu's
scope JSON into Lark fails to import. That JSON is also over-broad (it
covers products WeKnora never calls) and simultaneously incomplete (it
omits the drive:*/docx:* scopes the connector needs). Lark therefore gets
its own list, derived from the 17 endpoints the code actually calls and
checked identifier-by-identifier against Lark's own API reference, plus a
full Feishu→Lark mapping table marking each scope verified, unverified,
or absent. Both features use tenant_access_token only — no user_access_
token exists anywhere in the repo — so the user dimension stays empty.

Known limitation: Region.ThinkingText makes Lark's initial card
placeholder English, but once streaming starts the think-block headers
come from the shared MarkdownThinkStyle and are Chinese on every platform
(Lark, Slack, Telegram, Mattermost alike). Fixing that means threading a
locale through FormatIMDisplayContent, which has no platform context — a
cross-platform change, not a Lark one. Documented as such.

The channel-creation 400 message is now derived from validIMPlatforms so
the list cannot drift as platforms are added.

Tests: region invariants and per-region URL construction on both sides,
the Feishu/Lark bot-identity split, platform-to-channel mapping, base_url
override precedence, an end-to-end SendReply against a fake Open Platform
(token fetch, reply, thread-unsupported fallback, hard-error surfacing),
and a ListResources drive asserting wiki links never leak the other
cloud's host.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-07-17 11:05:54 +08:00
wizardchen 3edd9c2c84 fix(chat): polish references drawer layout and web reference titles
Improve reference list readability by resolving URL-like titles to domains,
stripping markdown noise from snippets, and aligning suggestion chip hover
styles across chat and embed surfaces.
2026-07-17 11:04:16 +08:00
wizardchen eedd7d4641 feat(agent): enhance suggested questions API with tag scopes
Update the SuggestedQuestionsRequest to include TagScopes for better filtering of knowledge items based on their parent knowledge bases. Modify related API documentation and frontend interfaces to accommodate the new structure. Ensure backend services handle the new tag scope logic correctly, including tests for the updated functionality.
2026-07-17 10:19:43 +08:00
wizardchen c21c34b3c0 feat(agent): implement agent selection behavior for web search
Add a test to verify that selecting an agent defaults web search to off until the user enables it. Update the agent selection logic to ensure that the web search capability is controlled by user action rather than agent configuration. Modify comments in the Input-field component to reflect this change in behavior.
2026-07-17 10:19:43 +08:00
wizardchen 53a66a6456 feat(chat): enhance references drawer behavior and citation handling
Implement improvements to the chat references drawer, including a new event for handling panel entry to ensure smooth scrolling to highlighted citations. Update the logic for retrieving references from agent events, allowing for better integration of citation data. Additionally, enhance tests to cover new functionality and ensure correct behavior of the references drawer during interactions.
2026-07-17 10:19:43 +08:00
wizardchen e938a76be4 feat(chat): enhance follow-up suggestions rendering logic
Implement a mechanism to ensure follow-up suggestions are only displayed after the answer is fully rendered. Introduce an event for rendering completion and update related components to handle this new logic. Update tests to verify the correct behavior of follow-up suggestions based on rendering state.
2026-07-17 10:19:43 +08:00
wizardchen b862c2e45d feat(agent): add per-agent citation output toggle
Move citation protocol injection to the system layer so custom prompts no
longer own citation syntax. Agents can disable inline citations while source
aliases still encode and decode tool arguments correctly.
2026-07-17 10:19:43 +08:00
wizardchen 79e8f3d894 fix(agent): use attach icon for attachment upload nav item
Align the capability extension sidebar icon with chat attachment upload
after the section was renamed from image-only to attachment upload.
2026-07-16 19:26:08 +08:00
wizardchen 48969b49f7 fix(agent): show disabled and unavailable MCP services in editor selector
Preserve selected MCP IDs in the agent editor when services are disabled or
missing, display them as disabled options with clear labels, and tighten
setting-row layout so long multi-select tags do not overflow.
2026-07-16 19:26:08 +08:00
wizardchen 88a0201afe style(chat): simplify suggestion copy and align hover with chat UI
Shorten follow-up and refresh labels across locales, and replace flashy
suggestion card hovers with the same border, neutral background, and
shadow treatment used elsewhere in the chat page.
2026-07-16 19:15:18 +08:00
wizardchen a1d8f55cbd fix(chat): improve streaming wait indicators across chat and embed
Keep the agent timeline placeholder visible between tool rounds when
nothing is pending, remove redundant thinking dot loaders, and replace
embed bouncing dots with a lightweight native spinner.
2026-07-16 19:15:18 +08:00
wizardchen a270d40cd5 fix(chat): replace detached typing dots with native loading placeholders
Remove redundant bounce-dot indicators from agent/RAG timelines and non-agent
answers; use existing pending step cards before activity and a compact spinner
for global wait states so streaming feedback stays aligned with the timeline.
2026-07-16 19:15:18 +08:00
wizardchen 7ddac0385f feat(attachments): enforce combined limit for images and attachments
Implement a maximum limit of 5 for the total number of images and attachments that can be uploaded in a chat session. Introduce a warning message for users when the limit is exceeded. Additionally, add functionality to clear pending uploads when switching sessions to prevent errors related to stale document IDs. Update localization files to include new warning messages in English, Korean, Russian, and Chinese.
2026-07-16 17:41:27 +08:00
wizardchen ceb4d1a310 feat(chat): add session-scoped temporary attachments with async parsing
Let users upload documents in chat without ingesting them into a knowledge base: files are parsed in the background, referenced by ID on send, and expire after a configurable TTL.
2026-07-16 17:41:27 +08:00
wizardchen 7b2c9e73bf fix(agent): ground follow-up suggestions and preserve KB scope on click
Tighten model prompt so retrieval questions stay topic-bound and self-contained,
reserve knowledge slots in hybrid mode, and carry suggestion KB IDs into the next send.
2026-07-15 19:16:53 +08:00
wizardchen fbc9db85d1 fix(chat): enforce retrieved image output in answers
When retrieved context or tool results contain Markdown images, dynamically
append output requirements to system prompts and final-answer instructions.
Also normalize fullwidth image parentheses in the frontend renderer so
localized model output still renders correctly.
2026-07-15 18:10:31 +08:00
wizardchen 951f95903b fix(chat): use Markdown for LLM image context and normalize legacy XML
Chat and agent tool context now emits answer-ready Markdown images instead
of internal <image> XML so copied content renders safely. The frontend also
normalizes legacy XML blocks in persisted conversations during streaming.
2026-07-15 18:10:31 +08:00
wizardchen a729bc1271 feat(agent): enrich follow-up suggestion generation context
Improve follow-up question quality by feeding the model structured context
(evidence, capabilities, complete turns) instead of raw RAG content, and
rank knowledge candidates by current-topic relevance.
2026-07-15 17:05:24 +08:00
wizardchen 6d14cc3536 feat(resource): add stable resource registry with LLM-context alias compaction
Introduce resource://<handle> as the stable application identity for stored
objects, decoupling API responses, persisted rich text, and LLM prompts from
physical storage paths. Adds a resource catalog service (register/resolve/bind,
revocable expiring access grants), a request-local alias registry that compacts
resource references while in the LLM context and restores them (including across
streaming chunks), plus router, IM, chat-pipeline, and multimodal integration.

Includes schema migrations (resources, resource_bindings, resource_access_grants)
for sqlite, and hardens URL/output security handling.
2026-07-15 17:02:43 +08:00
wizardchen 9733bd28bf feat(storage): add storage backend management API and UI enhancements
Implement a comprehensive API for managing storage backends, including endpoints for listing, creating, updating, and deleting storage instances. Enhance the UI to support multi-instance configurations, allowing users to manage multiple storage types effectively. Update localization files for new storage backend features and improve error handling for connectivity tests. This update also includes detailed documentation for the storage backend API.
2026-07-15 14:54:39 +08:00
wizardchen a8dea5f9a3 feat(storage): improve storage connectivity error handling and multi-instance support
Enhance error messaging for storage connectivity issues by sanitizing raw errors to prevent leaking sensitive information. Introduce a new utility function for consistent error handling across storage backend operations. Additionally, implement logic to support multi-instance storage backends, allowing for more flexible workspace configurations and improved reporting of active storage providers.
2026-07-15 14:54:39 +08:00
wizardchen 6349fff002 feat(security): enhance image source protection for storage backends
Update the image source protection logic to include support for storage backend images. Introduce new regex patterns for identifying storage URLs and refactor the image tag building process to ensure proper handling of both provider and storage backend images. Add corresponding tests to validate the new functionality.
2026-07-15 14:54:39 +08:00
wizardchen f8b3e5f148 feat(storage): add multi-instance storage backends per workspace
Introduce tenant-scoped storage backend registry so workspaces can register
multiple storage instances and bind each knowledge base to a specific backend,
with migration from legacy tenant-level storage config and new settings UI.
2026-07-15 14:54:39 +08:00
wizardchen 139ec1e6b8 fix(storage): align default provider fallback with STORAGE_ALLOW_LIST
Extract storage allowlist into internal/storageallowlist so KB creation
uses FirstAllowed when tenant default_provider is empty or disallowed.
Share pickUsableStorageProvider via editorResources for consistent UI
selection, and add regression tests for OBS status and allow-list defaults.
2026-07-15 11:05:00 +08:00
ShadowSmallBaby b3bb60f03c fix: 修复/api/v1/tenants/kv/storage-engine-config接口不返回华为云obs配置导致创建知识库弹窗存储引擎华为云OBS未正确显示不可用标识
fix: 修复租户default_provider为空时降级至local,而local未被允许时导致创建知识库报错: Storage provider is not allowed by STORAGE_ALLOW_LIST
2026-07-15 10:54:14 +08:00
wizardchen e3b7ad98c2 feat(api-keys): let manage_kbs cover full KB lifecycle routes
Align create/copy/duplicate with update/delete under manage_kbs or
full-access, and update capability docs and UI hints accordingly.
2026-07-15 10:41:19 +08:00
Binks Riverton be88a56245 fix(knowledge): reload doc list after tag rename in manage drawer 2026-07-15 10:12:31 +08:00
wizardchen bdd459b071 fix(frontend): open chat reference links in new tabs
Prevent in-chat navigation from replacing the active conversation by
opening knowledge-base and citation links in a new tab with
noopener/noreferrer, and apply the same policy to sanitized markdown links.
2026-07-14 18:13:53 +08:00
wizardchen ace84bc757 fix(knowledge): recover tasks safely after server restart
Stop failing distributed-mode knowledge rows on startup; let housekeeping
decide using span activity and Asynq queue state. In Lite mode, resume
wiki work from durable task_pending_ops and surface SERVER_RESTART errors
in the processing timeline with i18n support.
2026-07-14 17:55:26 +08:00
wizardchen 28ebcf2525 feat(chat): polish follow-up suggestion loading and answer toolbar timing
Move follow-up loading into the answer toolbar so the card only appears when suggestions are ready, and delay toolbar actions until the typewriter finishes revealing the answer.
2026-07-14 17:49:03 +08:00
wizardchen 01f1011511 feat(system): add cursor pagination for runtime queue tasks
Replace offset-based page numbers with opaque Redis-backed cursors so
scheduled/retry tasks sort by next run time and live lists stay stable
when queue state changes between requests.
2026-07-14 16:53:07 +08:00
wizardchen f583d77fa0 feat(knowledge): enhance error handling in knowledge spans
Refactor the error handling logic in the GetKnowledgeSpans function to utilize a new helper function, knowledgeSpansLastError, which consolidates the logic for determining the last error from span failures and knowledge row failures. This improves clarity and maintainability of the code. Additionally, update test cases to cover new scenarios for last error handling.
2026-07-14 16:49:56 +08:00
wizardchen fc03e4862d fix(knowledge): align processing timeline status with knowledge row
Latest attempt tabs and header now trust parse_status over a closed root span, surface recovery failures via last_error, and keep attempt hover styles from washing out the active tab.
2026-07-14 16:49:56 +08:00
wizardchen 41975abcc5 refactor(terminology): rename user-facing tenant labels to workspace
Align product copy, API docs, Swagger descriptions, and i18n strings
with workspace terminology while keeping internal tenant identifiers
and headers unchanged for API compatibility.
2026-07-14 16:14:43 +08:00
wizardchen e1572b71b9 feat(models): let system admins edit builtin model config
Allow platform system administrators to update builtin model parameters
and credentials from the management UI while keeping secrets masked in API
responses. UI edits clear YAML ownership so startup reconciliation no
longer overwrites runtime overrides.
2026-07-14 15:56:02 +08:00
wizardchen 4ae48d6acf feat(system): expand runtime queue task inspection and safe actions
Replace failed-only task views with state-aware runtime task listing,
operator-safe cancel/run-now/delete actions, orphan detection, and
multimodal queue cleanup for deleted knowledge rows.
2026-07-14 15:38:06 +08:00
wizardchen 1eae475a1f feat(i18n): enhance localization for task management and queue descriptions
Added new translations and improved existing ones for English, Korean, Russian, and Chinese. Introduced short weight labels, refined failed task notices, and updated queue names and descriptions for better clarity and consistency across languages.
2026-07-14 13:11:06 +08:00