Repository navigation
feat: 数据库层方言可插拔(SQLite → 高斯/MySQL/达梦易扩展) #39
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tianling536
wants to merge
357
commits into
OpenBMB:main
Choose a base branch
from
tianling536:feat/multi-db-clean
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+6,077
−431
Open
Changes from all commits
Commits
Show all changes
357 commits
Select commit
Hold shift + click to select a range
962827d
feat(llm): add Anthropic and Gemini protocol support
fadeoreo 6e3cd73
Merge branch 'OpenBMB:main' into main
xhd0728 17df88d
docs: add license
xhd0728 0342c68
fix(tools): support per-tool execution timeouts
fadeoreo faafffe
fix(agent): enforce required knowledge query steps
fadeoreo a7f0e34
docs: add license (#27)
hm1229 328778f
fix(dev): remove hardcoded internal IPs from dev config (#23)
mteguhfh eb4be56
fix(agent): stabilize SOP confirmation state transitions
fadeoreo 89b97f2
fix(llm): retry with doubled max_tokens when reasoning models hit len…
Ruijie-Ysp 61d3a40
feat: 多渠道接入(微信/企业微信)与智能分发 (#20)
tianling536 71befdb
chore(deps): bump the frontend-minor-and-patch group across 1 directo…
dependabot[bot] 9856dec
feat(channels): add durable Feishu and WeCom ingress
fadeoreo 967a5e6
fix(channels): atomically claim outbound deliveries
fadeoreo dafca46
feat(channels): expose Feishu setup and delivery audit
fadeoreo 466afb2
test(channels): cover lifecycle and routing isolation
fadeoreo fba016a
docs(channels): document the Feishu integration design
fadeoreo feca293
fix(packaging): prevent Intel macOS OpenSSL startup failure
fadeoreo 64e0d97
feat(knowledge): preserve document structure during parsing
fadeoreo 10259e4
feat(knowledge): compact related evidence as bounded context
fadeoreo 33b6f7a
feat(search): honor knowledge query scope and intent
fadeoreo 201c212
feat(search): improve knowledge retrieval relevance and continuity
fadeoreo 4052fb2
fix(search): prevent related context and coverage drift
fadeoreo 5e4d0dd
feat(chat): improve new conversation flow
fadeoreo 4322b1b
fix(knowledge): preserve atomic references in retrieved answers
fadeoreo 7e8754f
fix(models): switch default models without transient conflicts
fadeoreo d34a46e
fix(sop): isolate new SOP workspaces
fadeoreo 87b81e3
chore(deps): bump the frontend-minor-and-patch group (#40)
dependabot[bot] f4d3e50
chore(deps): bump vite from 6.4.2 to 8.1.5 in /frontend-enterprise (#42)
dependabot[bot] 562cdf2
chore(deps): update anthropic requirement in /backend (#43)
dependabot[bot] d7d9725
ci(deps): bump actions/setup-python from 6 to 7 (#45)
dependabot[bot] 473d84d
feat: 渠道可靠性与工程强化(遗留项 P0-P3) (#33)
tianling536 bcc4fbd
Remove unused max_output_tokens assignment
hm1229 c2495e0
test(agent): establish refactor contract baseline
fadeoreo 150b7a1
test(agent): characterize feedback and terminal visibility
fadeoreo d369b00
test(agent): characterize graph branch and merge
fadeoreo dea1de1
refactor(agent): extract legacy graph rules
fadeoreo 6f44aad
refactor(agent): extract legacy loop policies
fadeoreo 9d79ee7
refactor(agent): extract legacy knowledge and tool actions
fadeoreo 43b8547
refactor(agent): extract legacy general skill action
fadeoreo 79bff75
refactor(agent): extract legacy reflection coordinator
fadeoreo d0198dd
feat(capabilities): add typed provider contracts and snapshots
fadeoreo 3fd37b7
docs(capabilities): publish provider contract guide
fadeoreo 931d2d7
feat(capabilities): add local knowledge runtime adapter
fadeoreo 284c76d
feat(capabilities): add durable provider binding rehydration
fadeoreo 4cf6bd0
feat(capabilities): define stable provider errors
fadeoreo 29f4723
fix(capabilities): enforce local knowledge scope and citation boundaries
fadeoreo 9c7b3b1
test(capabilities): add shared provider contract test kit
fadeoreo 5f2afe6
feat(capabilities): publish knowledge contract schemas
fadeoreo 1305819
test(capabilities): tighten provider conformance rules
fadeoreo 03d5f18
fix(capabilities): align wire schema and conformance rules
fadeoreo 56d3af8
refactor(agent): extract legacy turn finalizer
fadeoreo 275654f
feat(capabilities): add pinned local knowledge registry
fadeoreo 5bf0400
fix(capabilities): pin local registry operation revisions
fadeoreo 90cd320
fix(capabilities): align provider contract types
fadeoreo 20ab523
fix(capabilities): simplify provider call context
fadeoreo fb29fb4
fix(capabilities): keep run identity distinct from turn
fadeoreo d623196
fix(capabilities): enforce stable provider context boundaries
fadeoreo 3242781
fix(capabilities): keep general skill execution local
fadeoreo 114b9ea
fix(channels): render labels from active channel
fadeoreo ac48cfe
fix(channels): use active channel in identity replies
fadeoreo 7f05c3a
feat(capabilities): load general skills through provider snapshots
fadeoreo ca1c908
fix(build): align test tooling with upstream dependencies
fadeoreo 2259d5e
feat: 页面头部账户下拉展示当前用户信息
tianling536 a4d422f
feat: 用户头像上传与展示(并入用户信息卡 PR)
tianling536 31787c1
fix: 头像选择器重复选择同一文件不触发 onChange
tianling536 e56296c
fix: 头像上传改为独立弹窗,修复 macOS 原生文件对话框焦点问题
tianling536 f356d19
fix: 头像 URL 渲染增加协议白名单(CodeQL 安全告警)
tianling536 c720e6c
fix: 用 URL 解析做头像地址协议校验(CodeQL 告警)
tianling536 2eaeca4
feat: 头像选图即传,免预览保存两步操作
tianling536 7a8f236
fix: 复核修复——头像预览 blob URL 释放与上传大小预检
tianling536 da43b71
fix(capabilities): preserve existing scene skill graph shape
fadeoreo 8647d1e
fix(capabilities): validate provider package pin
fadeoreo 7d1aa82
fix(channels): make bind code copy reliable
fadeoreo f9bc0f6
feat(channels): show binding creator in channel list
fadeoreo 1b729f2
feat(tools): allow removing an mcp toolset from an employee
fadeoreo c7ac3e1
Refine Feishu channel setup UI
fadeoreo b446679
fix: 复核修复——头像不再内联进 login/me 与会话存储,删用户级联删头像
tianling536 8306ad1
feat: 页面头部账户下拉展示当前用户信息 (#36)
hm1229 36de418
feat(channels): generalize reaction feedback lifecycle
fadeoreo c327417
feat(channels): add durable DingTalk Stream integration
fadeoreo a2d4ec3
feat(channels): add DingTalk setup UI
fadeoreo 61af86b
feat(chat): allow cancelling queued messages
fadeoreo de5a22a
feat(general-skills): add read-only operation
fadeoreo fefd0a3
feat(agent-loop): integrate independent skill selection
fadeoreo 2db0d8d
test(general-skills): cover read-only routing
fadeoreo d2e91b3
feat(chat): make bare response links clickable
fadeoreo 4a7803e
fix(chat): preserve context in formatting follow-ups
fadeoreo 1f90d3f
feat(general-skills): collapse run results by default
fadeoreo f375424
feat(general-skills): add markdown render toggle
fadeoreo 0f85979
fix(models): verify before activating saved configs
fadeoreo 5619c52
feat(skills): publish employee skills to the marketplace
fadeoreo a1d2042
fix(skills): prevent public editor scope race
fadeoreo b0dc8bc
feat: add isolated taskframe harness v2
hm1229 2cf3d4a
feat: make Harness v2 the unified runtime
hm1229 b0d3dc9
fix: select harness capabilities during task execution
hm1229 e87db79
fix: let harness inspect skills before execution
hm1229 8e53dbe
feat: add progressive harness capability discovery
hm1229 1da3489
fix: support Ubuntu bubblewrap runtime
hm1229 25a04ce
fix: unify knowledge citation sources
hm1229 828af5a
feat: enrich enterprise conversation logs
hm1229 748cdfc
fix: hide empty conversation filters
hm1229 76db88e
fix: align model stats and style account roles
hm1229 5017b2f
Codex/harness v2 (#66)
hm1229 ea28f5c
fix: clear harness state when resetting sessions
fadeoreo 4bb4fc4
fix: enforce harness artifact integrity and quota accounting
fadeoreo 91d44f9
fix(scripts): stop native stderr from aborting dev.ps1 on Windows (#57)
lixiaob8349 e7ebffb
Make public setup infer a default URL
fadeoreo a311ef8
Clarify Linux setup and deployment overrides
fadeoreo 6e9ef99
fix(llm): support flexible Anthropic endpoint URLs
fadeoreo 239800c
add employee-scoped public API and key management
hm1229 f60fe89
fix API key copy on HTTP deployments
hm1229 5273b4f
move full-access API keys to accounts
hm1229 843092a
move account API keys to global user menu
hm1229 827cb4d
feat(macos): support Intel builds with native embedded UI (#68)
xfei6868 b626f2d
fix false-success API key copying
hm1229 0814c39
Update ui_config.py
hm1229 d0a063b
fix(windows): harden MCP stdio subprocess handling
fadeoreo 36fc090
feat(app): restore release update reminders
fadeoreo f6714e1
fix(models): bound capability probe output
fadeoreo 74c642e
fix(tools): preserve MCP argument boundaries
fadeoreo ac689f7
feat(harness): enforce fail-closed sandbox execution
fadeoreo 7ad9108
feat(agent): sandbox generated skill execution
fadeoreo 8280670
feat(admin): add tenant runtime sandbox settings
fadeoreo e59edca
test(tools): isolate probe settings
fadeoreo e171ccb
build(packaging): bundle pinned SRT and Node runtimes
fadeoreo eed371f
feat: complete public API and SOP workspace
hm1229 53c6878
chore: merge main into public API branch
hm1229 01d9d71
Merge pull request #70 from OpenBMB/codex/public-api-agent-keys
hm1229 5b83897
fix(windows): make bundled SRT initialization and execution reliable
fadeoreo 15299d1
refactor(harness): remove legacy agent loop runtime
hm1229 4cfe0cc
fix(models): make verified saves atomic
hm1229 2c0299b
fix(agents): preserve custom avatars across restart
fadeoreo 96cec51
fix(packaging): verify bundled lark channel sdk
fadeoreo b4f15cf
feat(logs): add JSON batch export
hm1229 526cb62
Codex/public api agent keys (#71)
hm1229 68f2f88
fix(tools): support basic auth json credentials
fadeoreo 3367ffd
fix(sop): expose expandable learning errors
hm1229 94aa63a
Merge pull request #76 from OpenBMB/codex/public-api-agent-keys
hm1229 0ca93e7
fix(windows): hide unsupported bash capability
fadeoreo 53f6ce0
fix(windows): support PowerShell fallback and signed SRT packaging
fadeoreo c01e420
fix(windows): allow unsigned packaging with degraded runtime warning
fadeoreo 49f94ce
fix(packaging): retry Python runtime asset downloads
fadeoreo a052455
fix(windows): expose bundled Python to shell commands
fadeoreo fd73330
feat(harness): add sandbox artifacts and runtime controls
hm1229 8ec96a8
Merge origin/main into codex/public-api-agent-keys
hm1229 cb91ee5
feat(harness): add sandbox artifacts and runtime controls (#81)
hm1229 9e85d37
feat(harness): 通用技能产物未声明时自动补登为下载 artifact
tianling536 1ead5e1
fix(agent): 补回 _fallback_session_title_from_message 的 @staticmethod
tianling536 025b208
feat(agents): restore default model binding UI
fadeoreo d898cab
feat(knowledge): add interactive knowledge graph visualization
Winsaney dd9ddf4
feat(knowledge): add interactive knowledge graph visualization (#85)
hm1229 39c170d
fix: improve model diagnostics and capability removal
hm1229 16a1dc5
Merge remote-tracking branch 'origin/main' into codex/public-api-agen…
hm1229 096992f
fix(harness): persist large JSON tool results
hm1229 f2d8716
Merge pull request #91 from OpenBMB/codex/public-api-agent-keys
hm1229 7026344
fix(frontend): refresh dependencies after updates
hm1229 c6f7a4f
Merge remote-tracking branch 'origin/main' into codex/public-api-agen…
hm1229 a270e81
fix(frontend): refresh dependencies after updates (#93)
hm1229 19f2ba9
feat(channels): add inbound attachment support for feishu and dingtal…
skywclouds eaff9bf
feat(mcp): add MCP Apps support
hm1229 43c2042
fix(mcp): expose Apps toggle and raise resource limit
hm1229 b6eed9a
feat: publish integrated runtime updates
hm1229 e2b291c
Merge remote-tracking branch 'origin/main' into codex/public-api-agen…
hm1229 16bb6cd
test(mcp): align stdio metadata expectations
hm1229 edbfd69
Codex/public api agent keys (#100)
hm1229 fe43510
feat(teams): add multi-agent team backend and channel binding
moyunqinghe 2172de4
feat(teams): add team management and chat UI
moyunqinghe a904884
docs: add multi-agent team design decisions
moyunqinghe 3fd435e
fix(tools): forward custom auth headers
fadeoreo b902c68
fix(tools): keep probe auth settings aligned
fadeoreo f2a8e4d
fix(teams): restrict team session writes and scope TL threads by team
moyunqinghe 30b6989
fix(macos): restore native edit shortcuts
fadeoreo 76ff22f
fix(knowledge): 图谱可视化回调参数补类型,修复 TS7006 构建失败
tianling536 0080010
feat: add SOP evolution and knowledge editing
hm1229 9b611cf
Merge remote-tracking branch 'origin/main' into codex/public-api-agen…
hm1229 83a2f39
fix(harness): 产物兜底扫描防劫持与噪音过滤
tianling536 838af40
fix(teams): separate management and chat entry points
hm1229 9dab158
fix(teams): keep injected context out of chat history
hm1229 049bb35
fix(teams): keep group chat in team workspace
hm1229 f05f2b8
fix(teams): show team groups in chat workspace
hm1229 04e02c7
fix(teams): identify group message senders
hm1229 18b7c4d
fix(teams): keep member actions on one line
hm1229 596482c
feat(teams): surface member collaboration in group chat
hm1229 2e2347a
fix(teams): render collaboration inside group chat
hm1229 e4ecb60
fix(chat): prevent narrow message bubble collapse
hm1229 e3fa152
fix(teams): interleave collaboration in chat timeline
hm1229 f30640b
fix(sop): keep edit actions visible while scrolling
hm1229 5a93e01
fix(knowledge): 图谱可视化回调参数补类型,修复 TS7006 构建失败 (#102)
hm1229 4326f61
Merge pull request #96 from momobiubiu/feat/multi-agent-teams
hm1229 32d38fc
Merge remote-tracking branch 'origin/main' into codex/public-api-agen…
hm1229 c93db19
fix(teams): resume member tasks from group chat
hm1229 a289b82
feat(teams): stream member replies in group chat
hm1229 86deacf
Merge pull request #104 from OpenBMB/codex/team-chat-live-collaboration
hm1229 b4685bc
fix(harness): run skills through native tools
hm1229 8264a32
merge: sync main and preserve evolution features
hm1229 5d6a5c3
fix(chat): validate external markdown links
hm1229 e2cbfb7
fix(skills): align repair artifact directory prompt
hm1229 9f5a73e
feat(chat): 数字员工产出文件可下载(捕获/存储/消息卡片/下载端点) (#55)
hm1229 dfdf603
merge: resolve PR 103 conflicts
hm1229 21c679f
Codex/public api agent keys (#103)
hm1229 1193480
fix(runtime): make async turns durable and retryable
hm1229 3fc1554
feat(channels): rich-text markdown rendering for feishu and dingtalk …
skywclouds 145c1c0
Merge pull request #117 from OpenBMB/codex/public-api-agent-keys
hm1229 b72df2a
feat(channels): support WeChat and WeCom image and file attachments (…
orhuoxu 43d2d48
Update README.md
hm1229 6c9a898
Change business contact email in README.zh.md
hm1229 359319a
Merge pull request #135 from OpenBMB/hm1229-patch-2
hm1229 1eb869a
Update README.md (#134)
hm1229 fd9b4b3
fix(skills): run tests through harness v2
hm1229 0a82736
feat: complete team and capability workflows
hm1229 0cd22f3
Merge pull request #185 from OpenBMB/codex/public-api-agent-keys
hm1229 38af6a6
fix: resolve general skill code quality findings
hm1229 91e7135
fix: resolve general skill code quality findings (#188)
hm1229 9a76299
fix(runtime): align scheduled SOP and skill tests with harness v2
hm1229 e01a4af
Merge pull request #189 from OpenBMB/codex/fix-issues-119-183
hm1229 3fc6386
fix(harness): normalize document attachment paths
hm1229 322e90e
feat(scheduled-tasks): add SOP version policy
hm1229 d7e9386
Merge pull request #190 from OpenBMB/codex/fix-issues-119-183
hm1229 9c0e416
fix(harness): accept structured skill results
hm1229 02e07f2
feat(channels): 飞书人工介入转接与 /回复反馈 指令 (#187)
skywclouds f76daf9
fix(auth): support unique display name login
coder-zkl1988 a3ace94
feat(desktop): redesign login and window chrome
coder-zkl1988 c291e3b
feat(employees): add five preset roles
coder-zkl1988 1f2a181
fix(db): preserve legacy knowledge version references
coder-zkl1988 3bc4258
feat(harness): allow host commands and file paths
hm1229 0b9a39a
revert(login): restore previous landing page
hm1229 cdee7bb
feat(desktop): improve macOS chrome and expand preset employees (#192)
hm1229 b2cd978
feat(channels): 飞书渠道协作者管理与启停 (#193)
skywclouds 16c237d
fix(channels): make bound Feishu assignees selectable
fadeoreo bd4af26
feat(harness): complete A2A and workflow updates
hm1229 61e2176
merge: resolve PR 195 conflicts
hm1229 ba7c298
fix(handoff): match Feishu topic replies to root notice
fadeoreo 38b41d6
Codex/fix issues 119 183 (#195)
hm1229 6cc1fb5
feat: 数据库层方言可插拔(P1)
tianling536 1e282a2
feat: 渠道连接器方言化(P2)
tianling536 0d0c088
ci: openGauss 方言冒烟工作流(真实 openGauss 容器验证)
tianling536 73172d2
test: 适配索引入 models 后的默认模型切换测试
tianling536 4fb363e
ci: openGauss 冒烟密码改为运行时生成(消除 secret 硬编码)
tianling536 830126b
fix: 企微断开告警清理改 ORM 读-改-写(收编 main 新增 json_remove 裸 SQL)
tianling536 16ee908
fix: 复核修复——锁语义/索引退化/丢写窗口/工作流/依赖与文档
tianling536 a0db9d8
fix: 复核修复——advisory lock 专属连接化、MySQL 长文本、PortableJSON、PG 池加固
tianling536 181d94c
fix: 对齐 main 合并的头像功能——user_avatars.data_url 改 HugeText(MEDIUMTEXT)
tianling536 a836756
fix: 收编上游新表的 JSON 列与长文本列
tianling536 0b341c2
fix: rebase 收尾——feishu_runtime 恢复 logging 导入,schema 清理未用 Any
tianling536 69195ef
chore: rebase 收尾——清理 rebase 引入的未用 text 导入与丢失的 json 导入
tianling536 bc48562
fix: 收编上游新表(evolution/team 系列)的 JSON 列与长文本列
tianling536 aa3cf63
fix: 收编上游 a2a 任务表的 JSON 列(最新 main 又新增 6 处)
tianling536 9ac58f6
Merge origin/main into feat/multi-db-clean
tianling536 ab00767
feat(db): add MySQL/openGauss adapters and Alembic migrations
tianling536 e943a9d
ci(gaussdb-smoke): add least-privilege workflow permissions
tianling536 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| name: openGauss dialect smoke | ||
|
|
||
| # 手动触发:在真实 openGauss 容器上验证数据库方言层 | ||
| # (create_all + 方言 DDL 索引 + Alembic 基线 + JSONB 路径回退 + advisory lock + 渠道锁)。 | ||
| # 说明:本工作流只验证数据库层,不启动完整应用(应用启动还依赖 Harness v3 运行时构建产物)。 | ||
| on: | ||
| workflow_dispatch: | ||
|
|
||
| # CodeQL(actions/missing-workflow-permissions):最小权限运行,仅需读取代码 | ||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| smoke: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 40 | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Start openGauss | ||
| run: | | ||
| set -euo pipefail | ||
| GAUSS_PASSWORD="Gs$(openssl rand -hex 9)_aB1" | ||
| echo "GAUSS_PASSWORD=$GAUSS_PASSWORD" >> "$GITHUB_ENV" | ||
| docker run -d --name opengauss --privileged=true \ | ||
| -e GS_PASSWORD="$GAUSS_PASSWORD" \ | ||
| -p 5432:5432 \ | ||
| opengauss/opengauss:5.0.0 | ||
| for i in $(seq 1 180); do | ||
| if docker exec -u opengauss opengauss sh -c \ | ||
| 'export GAUSSHOME=/usr/local/opengauss; export LD_LIBRARY_PATH=$GAUSSHOME/lib; $GAUSSHOME/bin/gsql -d postgres -c "select 1"' >/dev/null 2>&1; then | ||
| echo "openGauss ready after ${i}s" | ||
| break | ||
| fi | ||
| sleep 1 | ||
| if [ "$i" -eq 180 ]; then | ||
| echo "openGauss failed to become ready" | ||
| docker logs opengauss | ||
| exit 1 | ||
| fi | ||
| done | ||
| # openGauss 默认 0.0.0.0/0 使用 sha256 认证,psycopg3 不支持该 SASL 机制; | ||
| # CI 冒烟改为 trust(仅容器内网测试用),真实部署请配置 md5/证书等。 | ||
| docker exec -u root opengauss sh -c \ | ||
| "sed -i 's|host all all 0.0.0.0/0 sha256|host all all 0.0.0.0/0 trust|' /var/lib/opengauss/data/pg_hba.conf" | ||
| docker exec -u opengauss opengauss sh -c \ | ||
| 'export GAUSSHOME=/usr/local/opengauss; export LD_LIBRARY_PATH=$GAUSSHOME/lib; $GAUSSHOME/bin/gsql -d postgres -c "select pg_reload_conf()"' >/dev/null | ||
| docker exec -u opengauss opengauss sh -c \ | ||
| 'export GAUSSHOME=/usr/local/opengauss; export LD_LIBRARY_PATH=$GAUSSHOME/lib; $GAUSSHOME/bin/gsql -d postgres -c "select version()"' | head -3 | ||
|
|
||
| - name: Setup Python | ||
| uses: actions/setup-python@v5 | ||
| with: | ||
| python-version: "3.12" | ||
|
|
||
| - name: Install backend deps | ||
| run: | | ||
| set -euo pipefail | ||
| python -m venv .venv | ||
| .venv/bin/pip install -q -e "backend[dev,postgres]" | ||
|
|
||
| - name: Dialect smoke on openGauss | ||
| env: | ||
| DATABASE_URL: opengauss+psycopg://gaussdb:unused@127.0.0.1:5432/postgres | ||
| APP_SECRET: openGauss-smoke | ||
| STAFFDECK_ROLE: all | ||
| working-directory: backend | ||
| run: | | ||
| set -euo pipefail | ||
| ../.venv/bin/python - <<'PY' | ||
| from sqlalchemy import func, inspect | ||
| from sqlmodel import Session, select | ||
|
|
||
| from app.db.database import engine, init_db | ||
| from app.db.dialect import get_dialect | ||
|
|
||
| assert engine.url.get_backend_name() == "opengauss" | ||
| init_db() # 全新空库:create_all + Alembic 基线 stamp | ||
| insp = inspect(engine) | ||
| tables = insp.get_table_names() | ||
| assert "alembic_version" in tables, "missing alembic_version" | ||
| assert len(tables) >= 76, f"unexpected table count: {len(tables)}" | ||
| index_names = { | ||
| index["name"] | ||
| for table in ("sessions", "model_configs") | ||
| for index in insp.get_indexes(table) | ||
| } | ||
| assert "uq_sessions_agent_channel_extconv" in index_names, "missing sessions index" | ||
| assert "uq_model_configs_tenant_default" in index_names, "missing default-model partial index" | ||
| print("create_all + dialect DDL indexes on openGauss: OK") | ||
|
|
||
| init_db() # 已有 alembic_version:upgrade head 幂等 | ||
| print("second init_db (alembic upgrade path): OK") | ||
|
|
||
| from app.api.knowledge import _safe_document_bucket_rows | ||
| from app.channels.config_store import patch_binding_config | ||
| from app.channels.delivery_days import delivery_day_bucket | ||
| from app.db.models import ( | ||
| AgentProfile, | ||
| ChannelBinding, | ||
| ChannelDelivery, | ||
| ChatSession, | ||
| KnowledgeBucket, | ||
| KnowledgeChunk, | ||
| Tenant, | ||
| User, | ||
| utc_now, | ||
| ) | ||
|
|
||
| dialect = get_dialect(engine.url.get_backend_name()) | ||
| assert dialect.supports_partial_index is True | ||
|
|
||
| with Session(engine) as db: | ||
| db.add(Tenant(id="tenant_smoke", name="Smoke", created_at=utc_now(), updated_at=utc_now())) | ||
| db.add(User(id="user_smoke", tenant_id="tenant_smoke", username="smoke", | ||
| password_hash="x", role="admin")) | ||
| db.add(AgentProfile(id="agent_smoke", tenant_id="tenant_smoke", name="Smoke Agent")) | ||
| db.add(ChatSession(id="sess_smoke", tenant_id="tenant_smoke", | ||
| user_id="user_smoke", agent_id="agent_smoke")) | ||
| db.add(ChannelBinding(id="bind_smoke", tenant_id="tenant_smoke", agent_id="agent_smoke", | ||
| channel="wecom", status="active", | ||
| created_at=utc_now(), updated_at=utc_now())) | ||
| db.commit() | ||
|
|
||
| # openGauss 的 jsonb_set 与上游 PG 参数语义不同 -> 走通用 ORM 回退 | ||
| assert patch_binding_config(db, "bind_smoke", tenant_id="tenant_smoke", | ||
| set_values={"auto_route": False, "n": 1}) | ||
| db.commit() | ||
| db.refresh(db.get(ChannelBinding, "bind_smoke")) | ||
| assert db.get(ChannelBinding, "bind_smoke").config_json["n"] == 1 | ||
| assert patch_binding_config(db, "bind_smoke", remove_keys=("auto_route",), | ||
| require_active=True) | ||
| db.commit() | ||
| print("config patch (generic ORM fallback): OK") | ||
|
|
||
| db.add(ChannelDelivery(id="del_smoke", tenant_id="tenant_smoke", | ||
| binding_id="bind_smoke", session_id="sess_smoke", | ||
| kind="reply", status="sent", idempotency_key="idem_smoke", | ||
| created_at=utc_now(), updated_at=utc_now())) | ||
| db.add(KnowledgeBucket(id="bucket_smoke", tenant_id="tenant_smoke", | ||
| knowledge_base_id="kb_smoke", document_id="doc_smoke", | ||
| bucket_key="b", title="中文标题", summary="S", | ||
| token_estimate=1, metadata_json={"a": 1}, | ||
| created_at=utc_now(), updated_at=utc_now())) | ||
| db.add(KnowledgeChunk(id="chunk_smoke", tenant_id="tenant_smoke", | ||
| knowledge_base_id="kb_smoke", document_id="doc_smoke", | ||
| bucket_id="bucket_smoke", chunk_index=0, | ||
| content="hello 世界", metadata_json={"x": [1, 2]}, | ||
| created_at=utc_now(), updated_at=utc_now())) | ||
| db.commit() | ||
| day_expr = delivery_day_bucket(db) | ||
| row = db.exec(select(day_expr, func.count()).group_by(day_expr)).first() | ||
| assert row is not None | ||
| buckets = _safe_document_bucket_rows(db, "tenant_smoke", "doc_smoke") | ||
| assert buckets and buckets[0]["title"] == "中文标题" | ||
| print("delivery_day_bucket + knowledge ORM (UTF-8): OK") | ||
|
|
||
| with Session(engine) as lock_session: | ||
| assert dialect.acquire_advisory_lock(lock_session, "smoke-connector") | ||
| assert dialect.check_advisory_lock(lock_session, "smoke-connector") | ||
| dialect.release_advisory_lock(lock_session, "smoke-connector") | ||
| assert not dialect.check_advisory_lock(lock_session, "smoke-connector") | ||
| print("advisory lock acquire/check/release: OK") | ||
|
|
||
| from app.channels import ( | ||
| _acquire_connector_process_lock, | ||
| _connector_lock_healthy, | ||
| _release_connector_process_lock, | ||
| ) | ||
|
|
||
| assert _acquire_connector_process_lock() is True | ||
| assert _connector_lock_healthy() is True | ||
| _release_connector_process_lock() | ||
| print("channel connector single-instance lock: OK") | ||
| print("OPENGAUSS DIALECT SMOKE ALL OK") | ||
| PY | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,15 @@ | ||
| # Alembic 迁移配置。 | ||
| # | ||
| # - script_location 用 %(here)s 展开为 backend/app/db/migrations 的绝对路径,不依赖 | ||
| # 执行时的 CWD;迁移目录放在 app 包内,便于 wheel/PyInstaller 一并分发; | ||
| # - sqlalchemy.url 留空:alembic/env.py 会回退到应用配置 | ||
| # (app.config.get_settings().database_url);程序化调用(init_db)通过 | ||
| # Config.set_main_option("sqlalchemy.url", ...) 显式传入运行时 URL。 | ||
| # - 本地验证示例: | ||
| # cd backend && DATABASE_URL=sqlite:////tmp/staffdeck-alembic.db \ | ||
| # .venv/bin/python -m alembic upgrade head | ||
| [alembic] | ||
| script_location = %(here)s/app/db/migrations | ||
| prepend_sys_path = . | ||
| path_separator = os | ||
| sqlalchemy.url = |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.