V20260613_03__add_image_recognition_scene.sql 2.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. -- Admin AI scene: image_recognition
  2. INSERT INTO admin_ai_scene (scene_code, scene_name, scene_type, pipeline_type, quality_threshold, status, create_by, update_by)
  3. SELECT 'image_recognition', '图片识别(多模态)', 'single', NULL, NULL, 1, 'system', 'system'
  4. FROM DUAL
  5. WHERE NOT EXISTS (SELECT 1 FROM admin_ai_scene WHERE scene_code = 'image_recognition');
  6. INSERT INTO admin_ai_scene_model (scene_code, model_id, pipeline_order, role, sort_weight)
  7. SELECT 'image_recognition', m.id,
  8. ROW_NUMBER() OVER (ORDER BY m.sort_order, m.id) - 1,
  9. 'generator', 0
  10. FROM admin_ai_model m
  11. WHERE m.status = 1
  12. AND (
  13. LOWER(m.model_identifier) LIKE '%vision%'
  14. OR LOWER(m.model_identifier) LIKE '%vl%'
  15. OR LOWER(m.model_identifier) LIKE 'qwen-vl%'
  16. OR LOWER(m.model_identifier) LIKE 'hunyuan-vision%'
  17. )
  18. AND NOT EXISTS (
  19. SELECT 1 FROM admin_ai_scene_model sm
  20. WHERE sm.scene_code = 'image_recognition' AND sm.model_id = m.id
  21. );
  22. INSERT INTO admin_ai_model (model_name, provider_code, model_identifier, api_endpoint, api_key, max_tokens, temperature, sort_order, status, create_by, update_by)
  23. SELECT '通义千问VL(Qwen-VL)', 'qwen', 'qwen-vl-plus',
  24. 'https://dashscope.aliyuncs.com/compatible-mode/v1/chat/completions', '',
  25. 4096, 0.7, 20, 0, 'system', 'system'
  26. FROM DUAL
  27. WHERE NOT EXISTS (SELECT 1 FROM admin_ai_model WHERE provider_code = 'qwen' AND model_identifier = 'qwen-vl-plus');
  28. INSERT INTO admin_ai_model (model_name, provider_code, model_identifier, api_endpoint, api_key, max_tokens, temperature, sort_order, status, create_by, update_by)
  29. SELECT '混元视觉(Hunyuan-Vision)', 'yuanbao', 'hunyuan-vision',
  30. 'https://api.hunyuan.cloud.tencent.com/v1/chat/completions', '',
  31. 4096, 0.7, 21, 0, 'system', 'system'
  32. FROM DUAL
  33. WHERE NOT EXISTS (SELECT 1 FROM admin_ai_model WHERE provider_code = 'yuanbao' AND model_identifier = 'hunyuan-vision');
  34. INSERT INTO admin_ai_model (model_name, provider_code, model_identifier, api_endpoint, api_key, max_tokens, temperature, sort_order, status, create_by, update_by)
  35. SELECT '豆包视觉(Doubao-Vision)', 'doubao', 'doubao-1-5-thinking-vision-pro-250428',
  36. 'https://ark.cn-beijing.volces.com/api/v3/chat/completions', '',
  37. 4096, 0.7, 19, 0, 'system', 'system'
  38. FROM DUAL
  39. WHERE NOT EXISTS (SELECT 1 FROM admin_ai_model WHERE model_identifier = 'doubao-1-5-thinking-vision-pro-250428');
  40. UPDATE admin_ai_scene SET scene_name = '图片识别(多模态)' WHERE scene_code = 'image_recognition';
  41. UPDATE admin_ai_model SET model_name = '通义千问VL(Qwen-VL)' WHERE provider_code = 'qwen' AND model_identifier = 'qwen-vl-plus';
  42. UPDATE admin_ai_model SET model_name = '混元视觉(Hunyuan-Vision)' WHERE provider_code = 'yuanbao' AND model_identifier = 'hunyuan-vision';
  43. UPDATE admin_ai_model SET model_name = '豆包视觉(Doubao-Vision)' WHERE model_identifier = 'doubao-1-5-thinking-vision-pro-250428';