mirror of
https://gitee.com/mateos/mateclaw.git
synced 2026-09-13 03:13:41 +08:00
fix(db): make the PostgreSQL-family SQL portable to vanilla PostgreSQL
This commit is contained in:
parent
ed6eac310a
commit
d7418e49df
File diff suppressed because it is too large
Load Diff
@ -449,22 +449,19 @@ VALUES (1000000013, 'searxngBaseUrl', '', 'SearXNG 实例地址(Docker 部署
|
||||
ON CONFLICT (id) DO UPDATE SET setting_key=EXCLUDED.setting_key, setting_value=EXCLUDED.setting_value, description=EXCLUDED.description, update_time=EXCLUDED.update_time;
|
||||
|
||||
-- 语音识别(STT)默认配置 —— 默认启用,用户只需在模型管理中配置 OpenAI / DashScope API Key 即可使用
|
||||
-- 用 setting_key 的 skip-if-exists 写法(FROM DUAL ... WHERE NOT EXISTS),
|
||||
-- 用 setting_key 的 skip-if-exists 写法(SELECT ... WHERE NOT EXISTS),
|
||||
-- 既不强行覆盖用户显式设过的值,也不会撞 setting_key UNIQUE 索引。
|
||||
-- V46 迁移走的是同一套语义。
|
||||
INSERT INTO mate_system_setting (id, setting_key, setting_value, description, create_time, update_time)
|
||||
SELECT 1000000020, 'sttEnabled', 'true', '启用语音识别(TalkMode 麦克风输入)', NOW(), NOW()
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM mate_system_setting WHERE setting_key = 'sttEnabled');
|
||||
|
||||
INSERT INTO mate_system_setting (id, setting_key, setting_value, description, create_time, update_time)
|
||||
SELECT 1000000021, 'sttProvider', 'auto', 'STT 提供商:auto / openai / dashscope', NOW(), NOW()
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM mate_system_setting WHERE setting_key = 'sttProvider');
|
||||
|
||||
INSERT INTO mate_system_setting (id, setting_key, setting_value, description, create_time, update_time)
|
||||
SELECT 1000000022, 'sttFallbackEnabled', 'true', '主 provider 失败时自动尝试备选 provider', NOW(), NOW()
|
||||
FROM DUAL
|
||||
WHERE NOT EXISTS (SELECT 1 FROM mate_system_setting WHERE setting_key = 'sttFallbackEnabled');
|
||||
|
||||
-- 内置工具:日期时间
|
||||
|
||||
@ -2,9 +2,10 @@
|
||||
--
|
||||
-- Step 1 — rename pre-existing duplicates. PostgreSQL uses UPDATE ... FROM
|
||||
-- instead of MySQL's UPDATE ... JOIN syntax, and || instead of CONCAT.
|
||||
-- SYS_GUID() replaces MySQL's UUID() for deterministic collision avoidance.
|
||||
-- md5(random()::text) gives a unique suffix and is portable across both
|
||||
-- PostgreSQL and KingbaseES (avoids the Kingbase-only SYS_GUID()).
|
||||
UPDATE mate_agent t
|
||||
SET name = '__mate_dup_v102__' || t.id || '__' || SYS_GUID()
|
||||
SET name = '__mate_dup_v102__' || t.id || '__' || md5(random()::text)
|
||||
FROM (
|
||||
SELECT workspace_id, name, MIN(id) AS keep_id
|
||||
FROM mate_agent
|
||||
|
||||
@ -10,9 +10,9 @@ CREATE TABLE IF NOT EXISTS mate_acp_endpoint (
|
||||
args_json TEXT,
|
||||
env_json TEXT,
|
||||
tool_parse_mode VARCHAR(32) NOT NULL DEFAULT 'call_title',
|
||||
builtin BOOLEAN NOT NULL DEFAULT 0,
|
||||
trusted BOOLEAN NOT NULL DEFAULT 1,
|
||||
enabled BOOLEAN NOT NULL DEFAULT 0,
|
||||
builtin BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
trusted BOOLEAN NOT NULL DEFAULT TRUE,
|
||||
enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
stdio_buffer_limit_bytes BIGINT NOT NULL DEFAULT 52428800,
|
||||
last_status VARCHAR(32),
|
||||
last_tested_at TIMESTAMP,
|
||||
@ -31,16 +31,16 @@ INSERT INTO mate_acp_endpoint
|
||||
VALUES
|
||||
(9100001, 'codex', 'OpenAI Codex CLI', 'Delegate to the Codex ACP agent via npx',
|
||||
'npx', '["-y","@zed-industries/codex-acp"]', '{}',
|
||||
'call_detail', 1, 1, 0, 52428800, 1, NOW(), NOW(), 0),
|
||||
'call_detail', TRUE, TRUE, FALSE, 52428800, 1, NOW(), NOW(), 0),
|
||||
(9100002, 'claude-code', 'Claude Code', 'Delegate to Anthropic''s Claude Code agent via npx',
|
||||
'npx', '["-y","@zed-industries/claude-agent-acp"]', '{}',
|
||||
'update_detail', 1, 1, 0, 52428800, 1, NOW(), NOW(), 0),
|
||||
'update_detail', TRUE, TRUE, FALSE, 52428800, 1, NOW(), NOW(), 0),
|
||||
(9100003, 'opencode', 'OpenCode', 'Delegate to OpenCode ACP agent (binary on PATH)',
|
||||
'opencode', '["acp"]', '{}',
|
||||
'update_detail', 1, 1, 0, 52428800, 1, NOW(), NOW(), 0),
|
||||
'update_detail', TRUE, TRUE, FALSE, 52428800, 1, NOW(), NOW(), 0),
|
||||
(9100004, 'qwen-code', 'Qwen Code', 'Delegate to Qwen Code ACP agent (binary on PATH)',
|
||||
'qwen', '["--acp"]', '{}',
|
||||
'call_detail', 1, 1, 0, 52428800, 1, NOW(), NOW(), 0)
|
||||
'call_detail', TRUE, TRUE, FALSE, 52428800, 1, NOW(), NOW(), 0)
|
||||
ON CONFLICT (id) DO UPDATE SET display_name = EXCLUDED.display_name,
|
||||
description = EXCLUDED.description,
|
||||
command = EXCLUDED.command,
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
CREATE TABLE IF NOT EXISTS mate_feature_flag (
|
||||
id BIGSERIAL PRIMARY KEY,
|
||||
flag_key VARCHAR(128) NOT NULL,
|
||||
enabled BOOLEAN NOT NULL DEFAULT 0,
|
||||
enabled BOOLEAN NOT NULL DEFAULT FALSE,
|
||||
description VARCHAR(512),
|
||||
whitelist_kb_ids TEXT,
|
||||
whitelist_user_ids TEXT,
|
||||
@ -24,13 +24,13 @@ CREATE INDEX IF NOT EXISTS idx_mff_key_flag ON mate_feature_flag (flag_key, enab
|
||||
-- Seed wiki feature flags with safe defaults. ON DUPLICATE KEY UPDATE
|
||||
-- preserves existing operator overrides on re-run.
|
||||
INSERT INTO mate_feature_flag (flag_key, enabled, description) VALUES
|
||||
('wiki.ocr.enabled', 0, 'Image OCR / vision-in pipeline for wiki uploads'),
|
||||
('wiki.compile.4stage.enabled', 0, 'Four-stage knowledge base compilation pipeline'),
|
||||
('wiki.compile.cache.enabled', 0, 'Prompt cache layer for the wiki compile pipeline'),
|
||||
('wiki.confidence.enabled', 0, 'Confidence taxonomy on wiki relations and pages'),
|
||||
('wiki.hot_cache.enabled', 0, 'KB-level recent-activity snapshot injected into agent system prompt'),
|
||||
('wiki.graph.insights.enabled', 0, 'Wiki graph insights panel (surprising connections, gaps, bridges)'),
|
||||
('wiki.graph.adamic_adar.enabled', 0, 'Adamic-Adar graph signal (additive to existing four signals)'),
|
||||
('wiki.graph.boundary.enabled', 0, 'Boundary score for surfacing dangling pages'),
|
||||
('wiki.relation.cache.enabled', 1, 'Persistent cache for wiki page-to-page relation computation')
|
||||
('wiki.ocr.enabled', FALSE, 'Image OCR / vision-in pipeline for wiki uploads'),
|
||||
('wiki.compile.4stage.enabled', FALSE, 'Four-stage knowledge base compilation pipeline'),
|
||||
('wiki.compile.cache.enabled', FALSE, 'Prompt cache layer for the wiki compile pipeline'),
|
||||
('wiki.confidence.enabled', FALSE, 'Confidence taxonomy on wiki relations and pages'),
|
||||
('wiki.hot_cache.enabled', FALSE, 'KB-level recent-activity snapshot injected into agent system prompt'),
|
||||
('wiki.graph.insights.enabled', FALSE, 'Wiki graph insights panel (surprising connections, gaps, bridges)'),
|
||||
('wiki.graph.adamic_adar.enabled', FALSE, 'Adamic-Adar graph signal (additive to existing four signals)'),
|
||||
('wiki.graph.boundary.enabled', FALSE, 'Boundary score for surfacing dangling pages'),
|
||||
('wiki.relation.cache.enabled', TRUE, 'Persistent cache for wiki page-to-page relation computation')
|
||||
ON CONFLICT (flag_key) DO UPDATE SET description = EXCLUDED.description;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user