WeKnora/internal/types
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
..
interfaces refactor(weknoracloud): update credential handling and configuration 2026-04-15 11:37:24 +08:00
agent.go feat(web-search): refactor web search provider 2026-03-31 20:22:34 +08:00
agent_test.go Fix system prompt not being used when flag is false 2026-04-15 20:21:12 +08:00
builtin_agent_config.go feat: enhance localization and configuration support 2026-03-17 22:23:24 +08:00
chat.go add oidc 2026-03-30 11:13:44 +08:00
chat_history_config.go feat: implement chat history and retrieval settings 2026-03-09 11:46:56 +08:00
chat_manage.go fix: missing deep copy entity 2026-04-15 20:35:48 +08:00
chunk.go fix: SQLite/Lite mode compatibility for FAQ import and chunk operations 2026-04-15 20:37:10 +08:00
cleanup.go init commit 2025-08-05 15:08:07 +08:00
const.go feat: enhance localization and configuration support 2026-03-17 22:23:24 +08:00
context_helpers.go fix(i18n): use WEKNORA_LANGUAGE env for prompt language fallback instead of hardcoded zh-CN 2026-04-02 12:01:25 +08:00
custom_agent.go feat: attachment_support 2026-04-10 12:49:20 +08:00
dataset.go init commit 2025-08-05 15:08:07 +08:00
datasource.go feat(notion): add Notion API client and type definitions 2026-04-08 16:31:25 +08:00
docparser.go feat(video): remove video upload support and update related terminology 2026-04-14 22:59:14 +08:00
embedding.go perf: 优化FAQ索引更新和删除性能 2026-01-14 17:30:04 +08:00
errors.go init commit 2025-08-05 15:08:07 +08:00
evaluation.go refactor: Update tenant ID handling across the application 2025-11-25 16:30:54 +08:00
event_bus.go refactor: Implement event-driven streaming and enhance session management 2025-11-07 22:41:41 +08:00
extract_graph.go feat(video): remove video upload support and update related terminology 2026-04-14 22:59:14 +08:00
faq.go feat(types): enhance FAQ metadata normalization and sanitization 2026-03-19 18:20:09 +08:00
faq_test.go feat(chunk): implement batch deletion for chunks to avoid MySQL placeholder limit 2026-03-19 18:20:09 +08:00
graph.go feat: implement preview of user level memory graph 2026-02-25 14:29:54 +08:00
json.go fix: update environment configuration for debugging and logging, enhance SQLite FTS5 table management, and improve API base URL handling 2026-04-11 18:51:16 +08:00
knowledge.go feat(notion): add Notion API client and type definitions 2026-04-08 16:31:25 +08:00
knowledgebase.go feat(oss): add OSSEngineConfig type and register oss provider scheme 2026-04-13 15:34:37 +08:00
knowledgebase_test.go fix(storage): add S3 provider scheme support to frontend and backend allowlists 2026-03-30 16:57:27 +08:00
mcp.go fix: use service name for MCP tool naming with collision protection (#715) 2026-03-21 10:22:05 +08:00
memory.go feat: implement preview of user level memory graph 2026-02-25 14:29:54 +08:00
message.go feat(chat_pipeline): enhance query handling with image and attachment metadata 2026-04-14 18:21:12 +08:00
model.go feat(model_service): enhance WeKnoraCloud credential management 2026-04-15 11:37:24 +08:00
organization.go feat(api): integrate per-organization resource counts into organization listing 2026-02-09 11:40:25 +08:00
placeholder.go feat: enhance localization and configuration support 2026-03-17 22:23:24 +08:00
qa_request.go feat: attachment_support 2026-04-10 12:49:20 +08:00
retrieval_config.go feat(prompt): enhance context and intent classification in templates 2026-03-26 18:57:12 +08:00
retriever.go feat: support weaviate vectordb for knowledge retrieve 2026-03-09 10:36:16 +08:00
search.go feat(prompt): enhance context and intent classification in templates 2026-03-26 18:57:12 +08:00
session.go feat: 添加思考模式配置支持 2025-12-31 15:36:20 +08:00
tag.go fix: SQLite/Lite mode compatibility for FAQ import and chunk operations 2026-04-15 20:37:10 +08:00
tenant.go refactor(weknoracloud): update credential handling and configuration 2026-04-15 11:37:24 +08:00
user.go add oidc 2026-03-30 11:13:44 +08:00
vectorstore.go feat: add VectorStore service layer with types and connection testing 2026-04-13 22:57:17 +08:00
vectorstore_test.go feat: add VectorStore service layer with types and connection testing 2026-04-13 22:57:17 +08:00
web_search.go feat(web-search): refactor web search provider 2026-03-31 20:22:34 +08:00
web_search_provider.go feat(web-search): add baidu web search provider support #907 2026-04-12 20:13:05 +08:00
weknoracloud.go refactor(weknoracloud): update credential handling and configuration 2026-04-15 11:37:24 +08:00