27 lines
1.3 KiB
PL/PgSQL
27 lines
1.3 KiB
PL/PgSQL
-- Migration to unify LLM config into a single dict entry 'llm_model'
|
|
-- Using dict_type='system_config' and dict_code='llm_model'
|
|
|
|
BEGIN;
|
|
|
|
-- Insert default LLM configuration
|
|
INSERT INTO `dict_data` (
|
|
`dict_type`, `dict_code`, `parent_code`, `label_cn`, `label_en`,
|
|
`sort_order`, `extension_attr`, `is_default`, `status`
|
|
) VALUES (
|
|
'system_config', 'llm_model', 'ROOT', '大模型配置', 'LLM Model Config',
|
|
0, '{"model_name": "qwen-plus", "timeout": 120, "temperature": 0.7, "top_p": 0.9}', 0, 1
|
|
)
|
|
ON DUPLICATE KEY UPDATE
|
|
`label_cn` = VALUES(`label_cn`);
|
|
-- Note: We avoid overwriting extension_attr on duplicate key to preserve existing settings if any,
|
|
-- UNLESS we want to force reset. The user said "refer to...", implying structure exists or should be this.
|
|
-- If I want to ensure the structure exists with keys, I might need to merge.
|
|
-- For simplicity, if it exists, I assume it's correct or managed by admin UI.
|
|
-- But since this is a new "unification", likely it doesn't exist or we want to establish defaults.
|
|
-- Let's update extension_attr if it's NULL, or just leave it.
|
|
-- Actually, if I am changing the SCHEMA of config (from individual to unified),
|
|
-- I should probably populate it.
|
|
-- Since I cannot easily read old values here, I will just ensure the entry exists.
|
|
|
|
COMMIT;
|