feat: KTV产线网关部署SQL+nginx配置(11端点200OK)

This commit is contained in:
yumoqing 2026-07-06 07:59:15 +08:00
parent f56eba19d9
commit 4c5327103f
2 changed files with 87 additions and 497 deletions

View File

@ -0,0 +1,31 @@
server {
listen 10443;
server_name ktv.opencomputing.net;
root /var/www/html;
client_max_body_size 20g;
proxy_buffering off;
ssl_certificate /etc/letsencrypt/live/opencomputing.net/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/opencomputing.net/privkey.pem;
add_header Access-Control-Allow-Origin *;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Scheme $scheme;
proxy_set_header X-Forwarded-Port $server_port;
proxy_set_header X-real-ip $remote_addr;
proxy_send_timeout 600s;
proxy_read_timeout 600s;
location /asr/ { proxy_pass http://localhost:9925/; }
location /demucs/ { proxy_pass http://localhost:9083/; }
location /face/ { proxy_pass http://localhost:9091/; }
location /subtitle/ { proxy_pass http://localhost:9080/; }
location /merge/ { proxy_pass http://localhost:9080/; }
location /songrate/ { proxy_pass http://localhost:8901/; }
location /synth/ { proxy_pass http://localhost:9084/; }
location /realesrgan/ { proxy_pass http://localhost:9082/; }
location /rvc/ { proxy_pass http://localhost:9085/; }
location /video-eval/ { proxy_pass http://localhost:8902/; }
}

View File

@ -1,502 +1,61 @@
-- ============================================================
-- FOMS / KTV产线服务 → Sage (uapi + llmage + pricing) 注册SQL
-- 供应商: 开元云(北京)科技有限公司
-- 服务器: opencomputing.net GPU集群
-- 所有 uapi response 均含 usage 字段用于自动计费
-- ============================================================
-- upapp
INSERT INTO sage.upapp (id,name,baseurl) VALUES ('ktv-gateway','KTV产线网关','https://ktv.opencomputing.net:10443') ON DUPLICATE KEY UPDATE baseurl=VALUES(baseurl);
SET @provider_id = 'kaiyuanyun';
SET @owner_org = 'foms_org_001';
-- llm (model=功能名, name=ky-model)
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_asr_transcribe','ky-asr-transcribe','asr-transcribe','KTV语音识别','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_demucs_separate','ky-demucs-separate','demucs-separate','KTV音频分离','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_face_detect','ky-face-detect','face-detect','KTV人脸检测','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_face_recognize','ky-face-recognize','face-recognize','KTV人脸识别','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_subtitle_render','ky-subtitle-render','subtitle-render','KTV字幕渲染','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_merge_video','ky-merge-video','merge-video','KTV视频合并','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_songrate_evaluate','ky-songrate-evaluate','songrate-evaluate','KTV歌曲评分','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_synth_generate','ky-synth-generate','synth-generate','KTV音乐合成','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_synth_status','ky-synth-status','synth-status','KTV合成状态','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_realesrgan_upscale','ky-realesrgan-upscale','realesrgan-upscale','KTV超分辨率','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_rvc_convert','ky-rvc-convert','rvc-convert','KTV声音转换','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
INSERT INTO sage.llm (id,name,model,description,providerid,ownerid,upappid,min_balance,enabled_date,expired_date,status) VALUES ('llm_ktv_video_eval_evaluate','ky-video-eval-evaluate','video-eval-evaluate','KTV视频评估','FZoJv7EUEdKL3pUt0BQ5S','0','ktv-gateway',0,'2025-01-01','2099-12-31','published');
-- ============================================================
-- 1. llmcatelog — 模型类目 (新增KTV专用类目)
-- ============================================================
INSERT IGNORE INTO llmcatelog (id, name, description) VALUES
('ktv_pipeline', 'KTV产线', 'KTV视频制作全流程'),
('video_eval', '视频评估', 'AI视频质量评估打分'),
('super_resolution', '超分辨率', '图像/视频超分辨率增强'),
('asr', '语音识别', '自动语音识别转文字'),
('face_detect', '人脸识别', '人脸检测/识别/比对'),
('graph_process', '图谱处理', '知识图谱构建与查询'),
('ner', '实体识别', '命名实体识别'),
('song_eval', '歌曲评分', 'AI歌曲质量评估'),
('music_gen', '音乐生成', 'AI音乐/歌声合成'),
('audio_separate', '音频分离', '人声伴奏分离(Demucs)'),
('voice_convert', '声音转换', 'RVC声音克隆/转换');
-- uapi (path=/{servicename}/api/{apiname})
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_asr_transcribe','asr-transcribe','KTV语音识别','KTV语音识别','/asr/api/asr-transcribe','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_demucs_separate','demucs-separate','KTV音频分离','KTV音频分离','/demucs/api/demucs-separate','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_face_detect','face-detect','KTV人脸检测','KTV人脸检测','/face/api/face-detect','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_face_recognize','face-recognize','KTV人脸识别','KTV人脸识别','/face/api/face-recognize','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_subtitle_render','subtitle-render','KTV字幕渲染','KTV字幕渲染','/subtitle/api/subtitle-render','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_merge_video','merge-video','KTV视频合并','KTV视频合并','/merge/api/merge-video','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_songrate_evaluate','songrate-evaluate','KTV歌曲评分','KTV歌曲评分','/songrate/api/songrate-evaluate','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_synth_generate','synth-generate','KTV音乐合成','KTV音乐合成','/synth/api/synth-generate','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_synth_status','synth-status','KTV合成状态','KTV合成状态','/synth/api/synth-status','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_realesrgan_upscale','realesrgan-upscale','KTV超分辨率','KTV超分辨率','/realesrgan/api/realesrgan-upscale','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_rvc_convert','rvc-convert','KTV声音转换','KTV声音转换','/rvc/api/rvc-convert','POST','ktv-gateway');
INSERT INTO sage.uapi (id,name,title,description,path,httpmethod,upappid) VALUES ('uapi_ktv_video_eval_evaluate','video-eval-evaluate','KTV视频评估','KTV视频评估','/video-eval/api/video-eval-evaluate','POST','ktv-gateway');
-- ============================================================
-- 2. llmprovider
-- ============================================================
INSERT IGNORE INTO llmprovider (id, name) VALUES
('kaiyuanyun', '开元云(北京)科技有限公司');
-- llm_api_map
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_asr_transcribe','llm_ktv_asr_transcribe','ktv_pipeline','asr-transcribe','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_demucs_separate','llm_ktv_demucs_separate','ktv_pipeline','demucs-separate','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_face_detect','llm_ktv_face_detect','ktv_pipeline','face-detect','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_face_recognize','llm_ktv_face_recognize','ktv_pipeline','face-recognize','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_subtitle_render','llm_ktv_subtitle_render','ktv_pipeline','subtitle-render','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_merge_video','llm_ktv_merge_video','ktv_pipeline','merge-video','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_songrate_evaluate','llm_ktv_songrate_evaluate','ktv_pipeline','songrate-evaluate','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_synth_generate','llm_ktv_synth_generate','ktv_pipeline','synth-generate','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_synth_status','llm_ktv_synth_status','ktv_pipeline','synth-status','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_realesrgan_upscale','llm_ktv_realesrgan_upscale','ktv_pipeline','realesrgan-upscale','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_rvc_convert','llm_ktv_rvc_convert','ktv_pipeline','rvc-convert','1');
INSERT INTO sage.llm_api_map (id,llmid,llmcatelogid,apiname,isdefaultcatelog) VALUES ('map_ktv_video_eval_evaluate','llm_ktv_video_eval_evaluate','ktv_pipeline','video-eval-evaluate','1');
-- ============================================================
-- 3. upapp
-- ============================================================
INSERT IGNORE INTO upapp (id, name, baseurl, ownerid, auth_apiname) VALUES
('ktv-media-server', 'KTV媒体服务器', 'http://opencomputing.net:9080', @owner_org, ''),
('ktv-video-eval', 'KTV视频评估', 'http://opencomputing.net:8901', @owner_org, ''),
('ktv-realesrgan', 'KTV超分辨率', 'http://opencomputing.net:9082', @owner_org, ''),
('ktv-asr', 'KTV语音识别', 'http://opencomputing.net:9925', @owner_org, ''),
('ktv-face', 'KTV人脸识别', 'http://opencomputing.net:9091', @owner_org, ''),
('ktv-graph', 'KTV图谱处理', 'http://opencomputing.net:9092', @owner_org, ''),
('ktv-ner', 'KTV实体识别', 'http://opencomputing.net:9093', @owner_org, ''),
('ktv-songrate', 'KTV歌曲评分', 'http://opencomputing.net:8900', @owner_org, ''),
('ktv-synth', 'KTV音乐合成', 'http://opencomputing.net:9084', @owner_org, ''),
('ktv-demucs', 'KTV音频分离', 'http://opencomputing.net:9083', @owner_org, ''),
('ktv-rvc', 'KTV声音转换', 'http://opencomputing.net:9085', @owner_org, '');
-- pricing_program
INSERT INTO sage.pricing_program (id,providerid,name) VALUES ('pp_ktv','FZoJv7EUEdKL3pUt0BQ5S','KTV产线计费') ON DUPLICATE KEY UPDATE providerid=VALUES(providerid);
-- ============================================================
-- 4. llm
-- ============================================================
INSERT IGNORE INTO llm (id, name, model, providerid, ownerid, upappid, status) VALUES
('llm_ktv_pipeline', 'KTV产线流水线', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_video_eval', 'KTV视频评估', 'ktv-video-eval', @provider_id, @owner_org, 'ktv-video-eval', 'published'),
('llm_realesrgan', 'KTV超分辨率增强', 'ktv-realesrgan', @provider_id, @owner_org, 'ktv-realesrgan', 'published'),
('llm_asr', 'KTV语音识别ASR', 'ktv-asr', @provider_id, @owner_org, 'ktv-asr', 'published'),
('llm_face', 'KTV人脸识别', 'ktv-face', @provider_id, @owner_org, 'ktv-face', 'published'),
('llm_graph', 'KTV图谱处理', 'ktv-graph', @provider_id, @owner_org, 'ktv-graph', 'published'),
('llm_ner', 'KTV命名实体识别', 'ktv-ner', @provider_id, @owner_org, 'ktv-ner', 'published'),
('llm_songrate', 'KTV歌曲评分', 'ktv-songrate', @provider_id, @owner_org, 'ktv-songrate', 'published'),
('llm_synth', 'KTV音乐合成', 'ktv-synth', @provider_id, @owner_org, 'ktv-synth', 'published'),
('llm_demucs', 'KTV人声伴奏分离', 'ktv-demucs', @provider_id, @owner_org, 'ktv-demucs', 'published'),
('llm_rvc', 'KTV声音克隆转换', 'ktv-rvc', @provider_id, @owner_org, 'ktv-rvc', 'published'),
-- media-server 拆分为12个独立函数模型 (每个uapi端点一个llm)
('llm_ktv_pipe_status', 'KTV产线流水线状态', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_ktv_status', 'KTV媒体服务器状态', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_ktv_task', 'KTV任务查询', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_ktv_submit', 'KTV媒体提交', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_ktv_gen', 'KTV视频生成', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_ktv_demucs', 'KTV人声分离', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_ktv_subtitle', 'KTV字幕生成', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_ktv_calibrate', 'KTV校准', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_ktv_lyric_cal', 'KTV歌词校准', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_ktv_merge', 'KTV音视频合并', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
('llm_ktv_gpu_lock', 'KTV GPU锁定', 'ktv-media-server', @provider_id, @owner_org, 'ktv-media-server', 'published'),
-- 其他服务补全端点
('llm_realesrgan_status','KTV超分状态', 'ktv-realesrgan', @provider_id, @owner_org, 'ktv-realesrgan', 'published'),
('llm_face_recognize', 'KTV人脸识别', 'ktv-face', @provider_id, @owner_org, 'ktv-face', 'published'),
('llm_face_compare', 'KTV人脸比对', 'ktv-face', @provider_id, @owner_org, 'ktv-face', 'published'),
('llm_graph_add_node', 'KTV图谱加节点', 'ktv-graph', @provider_id, @owner_org, 'ktv-graph', 'published'),
('llm_graph_add_edge', 'KTV图谱加边', 'ktv-graph', @provider_id, @owner_org, 'ktv-graph', 'published'),
('llm_synth_status', 'KTV合成状态', 'ktv-synth', @provider_id, @owner_org, 'ktv-synth', 'published');
-- ============================================================
-- 5. uapi — API端点 (所有 response 含 usage 计费字段)
-- ============================================================
-- 5.1 media-server (12 endpoints)
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('media-pipeline-submit', 'ktv-media-server', '/api/pipeline_submit/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"task_type":"{{task_type}}","params":{{json.dumps(params)}}}', '{"status":"ok","task_id":"{{task_id}}","usage":{"call_count":1}}', NULL),
('media-pipeline-status', 'ktv-media-server', '/api/pipeline_status/index.dspy', 'GET', NULL, NULL, '{"status":"{{status}}","progress":{{progress}},"usage":{"call_count":1}}', NULL),
('media-status', 'ktv-media-server', '/api/status/index.dspy', 'GET', NULL, NULL, '{"status":"ok","gpu_available":{{gpu_available}},"usage":{"call_count":1}}', NULL),
('media-task', 'ktv-media-server', '/api/task/index.dspy', 'GET', NULL, NULL, '{"task_id":"{{task_id}}","status":"{{status}}","usage":{"call_count":1}}', NULL),
('media-submit', 'ktv-media-server', '/api/submit/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"video_url":"{{video_url}}","audio_url":"{{audio_url}}"}', '{"status":"ok","usage":{"call_count":1}}', NULL),
('media-ktv', 'ktv-media-server', '/api/ktv/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"song_name":"{{song_name}}","lyrics":"{{lyrics}}"}', '{"status":"ok","video_url":"{{video_url}}","usage":{"output_seconds":{{output_seconds}}}}', NULL),
('media-demucs', 'ktv-media-server', '/api/demucs/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"audio_url":"{{audio_url}}"}', '{"status":"ok","vocals_url":"{{vocals_url}}","accompaniment_url":"{{accompaniment_url}}","usage":{"audio_seconds":{{audio_seconds}}}}', NULL),
('media-subtitle', 'ktv-media-server', '/api/subtitle/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"lyrics":"{{lyrics}}","audio_url":"{{audio_url}}"}', '{"status":"ok","subtitle_url":"{{subtitle_url}}","usage":{"audio_seconds":{{audio_seconds}}}}', NULL),
('media-calibrate', 'ktv-media-server', '/api/calibrate/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"video_url":"{{video_url}}","audio_url":"{{audio_url}}"}', '{"status":"ok","offset":{{offset}},"usage":{"video_seconds":{{video_seconds}}}}', NULL),
('media-lyric-calibrate', 'ktv-media-server', '/api/lyric_calibrate/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"lyrics":"{{lyrics}}","audio_url":"{{audio_url}}"}', '{"status":"ok","calibrated_lyrics":"{{calibrated_lyrics}}","usage":{"audio_seconds":{{audio_seconds}}}}', NULL),
('media-merge', 'ktv-media-server', '/api/merge/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"video_url":"{{video_url}}","audio_url":"{{audio_url}}"}', '{"status":"ok","output_url":"{{output_url}}","usage":{"output_seconds":{{output_seconds}}}}', NULL),
('media-gpu-lock', 'ktv-media-server', '/api/gpu_lock/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"gpu_id":{{gpu_id}},"duration":{{duration}}}', '{"status":"ok","locked":true,"usage":{"call_count":1}}', NULL);
-- 5.2 video-eval
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('video-eval-evaluate', 'ktv-video-eval', '/api/eval/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"video_url":"{{video_url}}"}', '{"status":"ok","score":{{score}},"details":{{json.dumps(details)}},"usage":{"video_seconds":{{video_seconds}}}}', NULL);
-- 5.3 realesrgan
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('realesrgan-upscale', 'ktv-realesrgan', '/api/submit/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"image_url":"{{image_url}}","scale":{{scale}}}', '{"status":"ok","output_url":"{{output_url}}","usage":{"image_count":1}}', NULL),
('realesrgan-status', 'ktv-realesrgan', '/api/status/index.dspy', 'GET', NULL, NULL, '{"status":"{{status}}","gpu_available":{{gpu_available}},"usage":{"call_count":1}}', NULL);
-- 5.4 asr
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('asr-transcribe', 'ktv-asr', '/api/transcribe/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"audio_url":"{{audio_url}}","language":"{{language}}"}', '{"status":"ok","text":"{{text}}","segments":{{json.dumps(segments)}},"usage":{"audio_seconds":{{audio_seconds}}}}', NULL);
-- 5.5 face
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('face-detect', 'ktv-face', '/api/detect', 'POST', '{"Content-Type":"application/json"}', '{"image_url":"{{image_url}}"}', '{"status":"ok","faces":{{json.dumps(faces)}},"usage":{"detect_count":1}}', NULL),
('face-recognize', 'ktv-face', '/api/recognize', 'POST', '{"Content-Type":"application/json"}', '{"image_url":"{{image_url}}","face_id":"{{face_id}}"}', '{"status":"ok","identity":"{{identity}}","confidence":{{confidence}},"usage":{"detect_count":1}}', NULL),
('face-compare', 'ktv-face', '/api/compare', 'POST', '{"Content-Type":"application/json"}', '{"image_url1":"{{url1}}","image_url2":"{{url2}}"}', '{"status":"ok","similarity":{{similarity}},"usage":{"detect_count":1}}', NULL);
-- 5.6 graph
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('graph-neighbors', 'ktv-graph', '/api/graph/neighbors', 'GET', NULL, NULL, '{"status":"ok","nodes":{{json.dumps(nodes)}},"usage":{"query_count":1}}', NULL),
('graph-add-node', 'ktv-graph', '/api/graph/add_node', 'POST', '{"Content-Type":"application/json"}', '{"node_id":"{{node_id}}","attrs":{{json.dumps(attrs)}}}', '{"status":"ok","usage":{"write_count":1}}', NULL),
('graph-add-edge', 'ktv-graph', '/api/graph/add_edge', 'POST', '{"Content-Type":"application/json"}', '{"from":"{{from}}","to":"{{to}}","label":"{{label}}"}', '{"status":"ok","usage":{"write_count":1}}', NULL);
-- 5.7 ner
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('ner-extract', 'ktv-ner', '/api/extract', 'POST', '{"Content-Type":"application/json"}', '{"text":"{{text}}"}', '{"status":"ok","entities":{{json.dumps(entities)}},"usage":{"char_count":{{char_count}}}}', NULL);
-- 5.8 songrate
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('songrate-evaluate', 'ktv-songrate', '/api/evaluate', 'POST', '{"Content-Type":"application/json"}', '{"audio_url":"{{audio_url}}","scene":"{{scene}}"}', '{"status":"ok","score":{{score}},"details":{{json.dumps(details)}},"usage":{"audio_seconds":{{audio_seconds}}}}', NULL);
-- 5.9 ktv-synth
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('synth-generate', 'ktv-synth', '/api/generate/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"lyrics":"{{lyrics}}","style":"{{style}}","reference_audio":"{{reference_audio}}"}', '{"status":"ok","task_id":"{{task_id}}","usage":{"output_seconds":{{output_seconds}}}}', NULL),
('synth-status', 'ktv-synth', '/api/status/index.dspy', 'GET', NULL, NULL, '{"status":"{{status}}","audio_url":"{{audio_url}}","usage":{"call_count":1}}', NULL);
-- 5.10 demucs
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('demucs-separate', 'ktv-demucs', '/api/separate/index.dspy', 'POST', '{"Content-Type":"application/json"}', '{"audio_url":"{{audio_url}}"}', '{"status":"ok","vocals_url":"{{vocals_url}}","accompaniment_url":"{{accompaniment_url}}","usage":{"audio_seconds":{{audio_seconds}}}}', NULL);
-- 5.11 rvc
INSERT IGNORE INTO uapi (name, upappid, path, httpmethod, headers, data, response, ioid) VALUES
('rvc-convert', 'ktv-rvc', '/api/convert', 'POST', '{"Content-Type":"application/json"}', '{"audio_url":"{{audio_url}}","voice_model":"{{voice_model}}"}', '{"status":"ok","output_url":"{{output_url}}","usage":{"audio_seconds":{{audio_seconds}}}}', NULL);
-- ============================================================
-- 6. upappkey
-- ============================================================
INSERT IGNORE INTO upappkey (id, upappid, apikey, secretkey) VALUES
('key_ktv_media', 'ktv-media-server', 'ktv-media-key-001', ''),
('key_ktv_eval', 'ktv-video-eval', 'ktv-eval-key-001', ''),
('key_ktv_esrgan', 'ktv-realesrgan', 'ktv-esrgan-key-001', ''),
('key_ktv_asr', 'ktv-asr', 'ktv-asr-key-001', ''),
('key_ktv_face', 'ktv-face', 'ktv-face-key-001', ''),
('key_ktv_graph', 'ktv-graph', 'ktv-graph-key-001', ''),
('key_ktv_ner', 'ktv-ner', 'ktv-ner-key-001', ''),
('key_ktv_song', 'ktv-songrate', 'ktv-song-key-001', ''),
('key_ktv_synth', 'ktv-synth', 'ktv-synth-key-001', ''),
('key_ktv_demucs', 'ktv-demucs', 'ktv-demucs-key-001', ''),
('key_ktv_rvc', 'ktv-rvc', 'ktv-rvc-key-001', '');
-- ============================================================
-- 7. llm_api_map
-- ============================================================
INSERT IGNORE INTO llm_api_map (id, llmid, llmcatelogid, apiname, isdefaultcatelog) VALUES
('map_ktv_pipeline', 'llm_ktv_pipeline', 'ktv_pipeline', 'media-pipeline-submit', '1'),
('map_video_eval', 'llm_video_eval', 'video_eval', 'video-eval-evaluate', '1'),
('map_realesrgan', 'llm_realesrgan', 'super_resolution', 'realesrgan-upscale', '1'),
('map_asr', 'llm_asr', 'asr', 'asr-transcribe', '1'),
('map_face_detect', 'llm_face', 'face_detect', 'face-detect', '1'),
('map_graph', 'llm_graph', 'graph_process','graph-neighbors', '1'),
('map_ner', 'llm_ner', 'ner', 'ner-extract', '1'),
('map_songrate', 'llm_songrate', 'song_eval', 'songrate-evaluate', '1'),
('map_synth', 'llm_synth', 'music_gen', 'synth-generate', '1'),
('map_demucs', 'llm_demucs', 'audio_separate','demucs-separate', '1'),
('map_rvc', 'llm_rvc', 'voice_convert', 'rvc-convert', '1'),
-- media-server 拆分: 每个函数独立模型+API
('map_pipe_status', 'llm_ktv_pipe_status','ktv_pipeline','media-pipeline-status', '1'),
('map_media_st', 'llm_ktv_status', 'ktv_pipeline','media-status', '1'),
('map_media_task', 'llm_ktv_task', 'ktv_pipeline','media-task', '1'),
('map_media_submit', 'llm_ktv_submit', 'ktv_pipeline','media-submit', '1'),
('map_media_ktv', 'llm_ktv_gen', 'ktv_pipeline','media-ktv', '1'),
('map_media_demucs', 'llm_ktv_demucs', 'ktv_pipeline','media-demucs', '1'),
('map_media_subt', 'llm_ktv_subtitle', 'ktv_pipeline','media-subtitle', '1'),
('map_media_cal', 'llm_ktv_calibrate', 'ktv_pipeline','media-calibrate', '1'),
('map_media_lyric', 'llm_ktv_lyric_cal', 'ktv_pipeline','media-lyric-calibrate', '1'),
('map_media_merge', 'llm_ktv_merge', 'ktv_pipeline','media-merge', '1'),
('map_media_lock', 'llm_ktv_gpu_lock', 'ktv_pipeline','media-gpu-lock', '1'),
-- 其他服务补全
('map_esrgan_st', 'llm_realesrgan_status','super_resolution','realesrgan-status','1'),
('map_face_rec', 'llm_face_recognize', 'face_detect', 'face-recognize', '1'),
('map_face_cmp', 'llm_face_compare', 'face_detect', 'face-compare', '1'),
('map_graph_add_n', 'llm_graph_add_node', 'graph_process', 'graph-add-node', '1'),
('map_graph_add_e', 'llm_graph_add_edge', 'graph_process', 'graph-add-edge', '1'),
('map_synth_st', 'llm_synth_status', 'music_gen', 'synth-status', '1');
-- ============================================================
-- 8. pricing_program
-- ============================================================
INSERT IGNORE INTO pricing_program (id, name, ownerid, providerid, pricing_belong, discount, description) VALUES
('pp_ktv_pipeline', 'KTV产线流水线', @owner_org, @provider_id, 'provider', 1.0, '按调用次数+产出时长'),
('pp_video_eval', 'KTV视频评估', @owner_org, @provider_id, 'provider', 1.0, '按评估视频时长计费'),
('pp_realesrgan', 'KTV超分辨率增强', @owner_org, @provider_id, 'provider', 1.0, '按处理图片张数计费'),
('pp_asr', 'KTV语音识别ASR', @owner_org, @provider_id, 'provider', 1.0, '按音频秒数计费'),
('pp_face', 'KTV人脸识别', @owner_org, @provider_id, 'provider', 1.0, '按检测次数计费'),
('pp_graph', 'KTV图谱处理', @owner_org, @provider_id, 'provider', 1.0, '按读写次数计费'),
('pp_ner', 'KTV命名实体识别', @owner_org, @provider_id, 'provider', 1.0, '按字符数计费'),
('pp_songrate', 'KTV歌曲评分', @owner_org, @provider_id, 'provider', 1.0, '按音频秒数计费'),
('pp_synth', 'KTV音乐合成', @owner_org, @provider_id, 'provider', 1.0, '按生成音频秒数计费'),
('pp_demucs', 'KTV人声伴奏分离', @owner_org, @provider_id, 'provider', 1.0, '按音频秒数计费'),
('pp_rvc', 'KTV声音克隆转换', @owner_org, @provider_id, 'provider', 1.0, '按音频秒数计费');
-- ============================================================
-- 9. pricing_program_timing — 定价时段
-- pricing_data 字段与 uapi response 中 usage 字段一一对应
-- ============================================================
-- KTV产线: 按次 + 按产出时长
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_ktv_pipeline', 'pp_ktv_pipeline', '默认定价',
'unit_values:
: 1
: 1
fields:
call_count:
type: int
role: filter
label:
output_seconds:
type: float
role: factor
label: ()
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: call_count
unit_prices: 2.00
unit:
- price_factors: output_seconds
unit_prices: 0.03
unit: ', '2025-01-01');
-- video-eval: 按视频秒数
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_video_eval', 'pp_video_eval', '默认定价',
'unit_values:
: 1
fields:
video_seconds:
type: float
role: factor
label: ()
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: video_seconds
unit_prices: 0.05
unit: ', '2025-01-01');
-- realesrgan: 按图片张数
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_realesrgan', 'pp_realesrgan', '默认定价',
'unit_values:
: 1
fields:
image_count:
type: int
role: factor
label:
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: image_count
unit_prices: 0.50
unit: ', '2025-01-01');
-- asr: 按音频秒数
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_asr', 'pp_asr', '默认定价',
'unit_values:
: 1
fields:
audio_seconds:
type: float
role: factor
label: ()
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: audio_seconds
unit_prices: 0.01
unit: ', '2025-01-01');
-- face: 按检测次数
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_face', 'pp_face', '默认定价',
'unit_values:
: 1
fields:
detect_count:
type: int
role: factor
label:
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: detect_count
unit_prices: 0.10
unit: ', '2025-01-01');
-- graph: 按读写次数
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_graph', 'pp_graph', '默认定价',
'unit_values:
: 1
fields:
query_count:
type: int
role: filter
label:
write_count:
type: int
role: filter
label:
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: query_count
unit_prices: 0.05
unit:
- price_factors: write_count
unit_prices: 0.10
unit: ', '2025-01-01');
-- ner: 按字符数
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_ner', 'pp_ner', '默认定价',
'unit_values:
: 1000
fields:
char_count:
type: int
role: factor
label:
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: char_count
unit_prices: 0.50
unit: ', '2025-01-01');
-- songrate: 按音频秒数
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_songrate', 'pp_songrate', '默认定价',
'unit_values:
: 1
fields:
audio_seconds:
type: float
role: factor
label: ()
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: audio_seconds
unit_prices: 0.005
unit: ', '2025-01-01');
-- ktv-synth: 按生成秒数
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_synth', 'pp_synth', '默认定价',
'unit_values:
: 1
fields:
output_seconds:
type: float
role: factor
label: ()
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: output_seconds
unit_prices: 0.20
unit: ', '2025-01-01');
-- demucs: 按音频秒数
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_demucs', 'pp_demucs', '默认定价',
'unit_values:
: 1
fields:
audio_seconds:
type: float
role: factor
label: ()
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: audio_seconds
unit_prices: 0.02
unit: ', '2025-01-01');
-- rvc: 按音频秒数
INSERT IGNORE INTO pricing_program_timing (id, ppid, name, pricing_data, enabled_date) VALUES
('ppt_rvc', 'pp_rvc', '默认定价',
'unit_values:
: 1
fields:
audio_seconds:
type: float
role: factor
label: ()
unit_prices:
type: float
role: factor
label: ()
unit:
type: string
role: factor
label:
pricings:
- price_factors: audio_seconds
unit_prices: 0.15
unit: ', '2025-01-01');
-- ============================================================
-- 10. 绑定 ppid → llm_api_map
-- ============================================================
UPDATE llm_api_map SET ppid = 'pp_ktv_pipeline' WHERE llmid = 'llm_ktv_pipeline';
UPDATE llm_api_map SET ppid = 'pp_video_eval' WHERE llmid = 'llm_video_eval';
UPDATE llm_api_map SET ppid = 'pp_realesrgan' WHERE llmid = 'llm_realesrgan';
UPDATE llm_api_map SET ppid = 'pp_asr' WHERE llmid = 'llm_asr';
UPDATE llm_api_map SET ppid = 'pp_face' WHERE llmid = 'llm_face';
UPDATE llm_api_map SET ppid = 'pp_graph' WHERE llmid = 'llm_graph';
UPDATE llm_api_map SET ppid = 'pp_ner' WHERE llmid = 'llm_ner';
UPDATE llm_api_map SET ppid = 'pp_songrate' WHERE llmid = 'llm_songrate';
UPDATE llm_api_map SET ppid = 'pp_synth' WHERE llmid = 'llm_synth';
UPDATE llm_api_map SET ppid = 'pp_demucs' WHERE llmid = 'llm_demucs';
UPDATE llm_api_map SET ppid = 'pp_rvc' WHERE llmid = 'llm_rvc';
-- pricing_program_timing (0.01元/次)
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_asr_transcribe','pp_ktv','KTV语音识别','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_demucs_separate','pp_ktv','KTV音频分离','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_face_detect','pp_ktv','KTV人脸检测','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_face_recognize','pp_ktv','KTV人脸识别','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_subtitle_render','pp_ktv','KTV字幕渲染','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_merge_video','pp_ktv','KTV视频合并','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_songrate_evaluate','pp_ktv','KTV歌曲评分','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_synth_generate','pp_ktv','KTV音乐合成','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_synth_status','pp_ktv','KTV合成状态','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_realesrgan_upscale','pp_ktv','KTV超分辨率','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_rvc_convert','pp_ktv','KTV声音转换','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');
INSERT INTO sage.pricing_program_timing (id,ppid,name,pricing_data) VALUES ('pt_ktv_video_eval_evaluate','pp_ktv','KTV视频评估','unit_values:\n 次: 1\nfields:\n price_factors:\n type: string\n role: factor\n label: 计价因子\n unit_prices:\n type: float\n role: factor\n label: 单位定价\n unit:\n type: string\n role: factor\n label: 计价单位\npricings:\n- price_factors: flat\n unit_prices: 0.01\n unit: 次');