debug: check_uapi.dspy to inspect data/response field format

This commit is contained in:
yumoqing 2026-08-06 18:23:15 +08:00
parent bf2bf48e3e
commit f3725ba95e

View File

@ -0,0 +1,29 @@
"""
Check uapi table data format
"""
import json
async def main():
dbname = env.get_module_dbname('uapi')
db = DBPools()
async with db.sqlorContext(dbname) as sor:
recs = await sor.sqlExe("""
SELECT id, name, stream, path, httpmethod, chunk_match,
headers, data, response
FROM uapi
WHERE data IS NOT NULL AND data != ''
OR response IS NOT NULL AND response != ''
LIMIT 8
""", {})
results = []
for r in recs:
results.append({
'id': r.get('id',''),
'name': r.get('name',''),
'stream': r.get('stream',''),
'httpmethod': r.get('httpmethod',''),
'chunk_match': str(r.get('chunk_match',''))[:30],
'data': str(r.get('data',''))[:300],
'response': str(r.get('response',''))[:300],
})
return {'count': len(results), 'samples': results}