48 lines
1.9 KiB
Python
48 lines
1.9 KiB
Python
|
|
import pymysql
|
||
|
|
|
||
|
|
conn = pymysql.connect(
|
||
|
|
host='gz-cynosdbmysql-grp-d26pzce5.sql.tencentcdb.com',
|
||
|
|
port=24936,
|
||
|
|
user='root',
|
||
|
|
password='!Rjb12191',
|
||
|
|
database='agent_db',
|
||
|
|
charset='utf8mb4'
|
||
|
|
)
|
||
|
|
|
||
|
|
# Agent names and their market settings
|
||
|
|
agents = [
|
||
|
|
("智能客服助手", "chat_assistant", "客服,对话,多轮", 1, 1),
|
||
|
|
("数据分析师", "data_processing", "数据,分析,可视化", 1, 1),
|
||
|
|
("自动化运维专家", "automation", "运维,监控,自动化", 1, 0),
|
||
|
|
("代码审查助手", "llm", "代码,审查,质量", 1, 1),
|
||
|
|
("文档生成器", "llm", "文档,生成,自动化", 1, 0),
|
||
|
|
("翻译与本地化专家", "llm", "翻译,本地化,多语言", 1, 0),
|
||
|
|
("SQL优化顾问", "data_processing", "SQL,优化,数据库", 1, 0),
|
||
|
|
("测试用例生成器", "automation", "测试,自动化,质量", 1, 0),
|
||
|
|
("知识库问答Agent", "chat_assistant", "RAG,问答,知识库", 1, 1),
|
||
|
|
("工作流编排助手", "integration", "工作流,编排,优化", 1, 0),
|
||
|
|
("图片理解助手", "chat_assistant", "多模态,OCR,视觉", 1, 1),
|
||
|
|
("语音交互助手", "chat_assistant", "语音,TTS,ASR", 1, 0),
|
||
|
|
]
|
||
|
|
|
||
|
|
import json
|
||
|
|
with conn.cursor() as cur:
|
||
|
|
for name, cat, tags_str, pub, feat in agents:
|
||
|
|
tags = json.dumps([t.strip() for t in tags_str.split(',')], ensure_ascii=False) if tags_str else '[]'
|
||
|
|
cur.execute("""
|
||
|
|
UPDATE agents SET category=%s, tags=%s, is_public=%s, is_featured=%s
|
||
|
|
WHERE name=%s
|
||
|
|
""", (cat, tags, pub, feat, name))
|
||
|
|
print(f'Updated: {name} rows={cur.rowcount}')
|
||
|
|
conn.commit()
|
||
|
|
|
||
|
|
# Verify
|
||
|
|
with conn.cursor() as cur:
|
||
|
|
cur.execute("SELECT name, category, is_public, is_featured FROM agents WHERE is_public=1")
|
||
|
|
rows = cur.fetchall()
|
||
|
|
print(f'\n公开Agent数: {len(rows)}')
|
||
|
|
for r in rows:
|
||
|
|
print(f' {r[0]:20s} cat={r[1]:15s} featured={r[3]}')
|
||
|
|
|
||
|
|
conn.close()
|