INSERT INTO `la_ai_config` (`name`, `value`, `remark`, `create_time`, `update_time`)
SELECT 'embedding_api_key', '', '知识库 Embedding API Key', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (SELECT 1 FROM `la_ai_config` WHERE `name` = 'embedding_api_key');

INSERT INTO `la_ai_config` (`name`, `value`, `remark`, `create_time`, `update_time`)
SELECT 'embedding_base_url', '', '知识库 Embedding API Base URL', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (SELECT 1 FROM `la_ai_config` WHERE `name` = 'embedding_base_url');

INSERT INTO `la_ai_config` (`name`, `value`, `remark`, `create_time`, `update_time`)
SELECT 'embedding_model', '', '知识库 Embedding 模型名', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (SELECT 1 FROM `la_ai_config` WHERE `name` = 'embedding_model');

INSERT INTO `la_ai_config` (`name`, `value`, `remark`, `create_time`, `update_time`)
SELECT 'embedding_dim', '1024', '知识库 Embedding 维度', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (SELECT 1 FROM `la_ai_config` WHERE `name` = 'embedding_dim');

INSERT INTO `la_ai_config` (`name`, `value`, `remark`, `create_time`, `update_time`)
SELECT 'kb_chunk_size', '600', '知识库切片长度', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (SELECT 1 FROM `la_ai_config` WHERE `name` = 'kb_chunk_size');

INSERT INTO `la_ai_config` (`name`, `value`, `remark`, `create_time`, `update_time`)
SELECT 'kb_chunk_overlap', '80', '知识库切片重叠长度', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (SELECT 1 FROM `la_ai_config` WHERE `name` = 'kb_chunk_overlap');

INSERT INTO `la_ai_config` (`name`, `value`, `remark`, `create_time`, `update_time`)
SELECT 'kb_fulltext_topn', '200', '知识库全文候选数量', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (SELECT 1 FROM `la_ai_config` WHERE `name` = 'kb_fulltext_topn');

INSERT INTO `la_ai_config` (`name`, `value`, `remark`, `create_time`, `update_time`)
SELECT 'kb_vector_topn', '30', '知识库向量重排数量', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (SELECT 1 FROM `la_ai_config` WHERE `name` = 'kb_vector_topn');

INSERT INTO `la_ai_config` (`name`, `value`, `remark`, `create_time`, `update_time`)
SELECT 'kb_final_topk', '8', '知识库最终召回数量', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (SELECT 1 FROM `la_ai_config` WHERE `name` = 'kb_final_topk');

INSERT INTO `la_ai_config` (`name`, `value`, `remark`, `create_time`, `update_time`)
SELECT 'post_analysis_prompt', '', '帖子知识库分析提示词', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()
WHERE NOT EXISTS (SELECT 1 FROM `la_ai_config` WHERE `name` = 'post_analysis_prompt');
