搜索贴纸接口
目录
简介
搜索贴纸接口:说明该接口在草稿自动化里的用途、依赖模块与常见报错。具体方法、路径、字段和校验请以 OpenAPI 为准。
依赖关系分析
系统采用模块化的依赖设计,各组件之间保持松耦合:
#mermaid-svg-XsvurRhn3lgSMltO{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-XsvurRhn3lgSMltO .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-XsvurRhn3lgSMltO .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-XsvurRhn3lgSMltO .error-icon{fill:#552222;}#mermaid-svg-XsvurRhn3lgSMltO .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-XsvurRhn3lgSMltO .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-XsvurRhn3lgSMltO .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-XsvurRhn3lgSMltO .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-XsvurRhn3lgSMltO .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-XsvurRhn3lgSMltO .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-XsvurRhn3lgSMltO .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-XsvurRhn3lgSMltO .marker{fill:#333333;stroke:#333333;}#mermaid-svg-XsvurRhn3lgSMltO .marker.cross{stroke:#333333;}#mermaid-svg-XsvurRhn3lgSMltO svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-XsvurRhn3lgSMltO p{margin:0;}#mermaid-svg-XsvurRhn3lgSMltO .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-XsvurRhn3lgSMltO .cluster-label text{fill:#333;}#mermaid-svg-XsvurRhn3lgSMltO .cluster-label span{color:#333;}#mermaid-svg-XsvurRhn3lgSMltO .cluster-label span p{background-color:transparent;}#mermaid-svg-XsvurRhn3lgSMltO .label text,#mermaid-svg-XsvurRhn3lgSMltO span{fill:#333;color:#333;}#mermaid-svg-XsvurRhn3lgSMltO .node rect,#mermaid-svg-XsvurRhn3lgSMltO .node circle,#mermaid-svg-XsvurRhn3lgSMltO .node ellipse,#mermaid-svg-XsvurRhn3lgSMltO .node polygon,#mermaid-svg-XsvurRhn3lgSMltO .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-XsvurRhn3lgSMltO .rough-node .label text,#mermaid-svg-XsvurRhn3lgSMltO .node .label text,#mermaid-svg-XsvurRhn3lgSMltO .image-shape .label,#mermaid-svg-XsvurRhn3lgSMltO .icon-shape .label{text-anchor:middle;}#mermaid-svg-XsvurRhn3lgSMltO .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-XsvurRhn3lgSMltO .rough-node .label,#mermaid-svg-XsvurRhn3lgSMltO .node .label,#mermaid-svg-XsvurRhn3lgSMltO .image-shape .label,#mermaid-svg-XsvurRhn3lgSMltO .icon-shape .label{text-align:center;}#mermaid-svg-XsvurRhn3lgSMltO .node.clickable{cursor:pointer;}#mermaid-svg-XsvurRhn3lgSMltO .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-XsvurRhn3lgSMltO .arrowheadPath{fill:#333333;}#mermaid-svg-XsvurRhn3lgSMltO .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-XsvurRhn3lgSMltO .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-XsvurRhn3lgSMltO .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-XsvurRhn3lgSMltO .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-XsvurRhn3lgSMltO .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-XsvurRhn3lgSMltO .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-XsvurRhn3lgSMltO .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-XsvurRhn3lgSMltO .cluster text{fill:#333;}#mermaid-svg-XsvurRhn3lgSMltO .cluster span{color:#333;}#mermaid-svg-XsvurRhn3lgSMltO div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-XsvurRhn3lgSMltO .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-XsvurRhn3lgSMltO rect.text{fill:none;stroke-width:0;}#mermaid-svg-XsvurRhn3lgSMltO .icon-shape,#mermaid-svg-XsvurRhn3lgSMltO .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-XsvurRhn3lgSMltO .icon-shape p,#mermaid-svg-XsvurRhn3lgSMltO .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-XsvurRhn3lgSMltO .icon-shape .label rect,#mermaid-svg-XsvurRhn3lgSMltO .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-XsvurRhn3lgSMltO .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-XsvurRhn3lgSMltO .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-XsvurRhn3lgSMltO :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 配置和数据
内部模块
外部依赖
FastAPI 框架
数据验证
JSON 处理
路由模块
服务模块
数据模型
工具模块
中间件
配置文件
贴纸数据
性能考虑
数据加载优化
系统目前使用本地 JSON 文件存储贴纸数据,对于大规模数据集建议考虑以下优化:
- 索引优化: 为常用搜索字段建立索引
- 缓存策略: 实现内存缓存减少文件读取
- 分页机制: 支持大数据集的分页查询
- 异步处理: 使用异步 I/O 提高并发性能
内存管理
- 当前实现一次性加载整个贴纸数据集到内存
- 对于大型数据集建议实现流式处理
- 考虑使用生成器模式减少内存占用
并发处理
- 当前服务层为同步实现
- 建议引入连接池和异步处理提高并发能力
- 实现请求限流防止系统过载
故障排除指南
常见问题及解决方案
| 问题类型 | 症状描述 | 可能原因 | 解决方案 |
|---|---|---|---|
| 配置文件缺失 | 返回空数组 | sticker.json 文件不存在 | 检查文件路径配置 |
| JSON 解析错误 | 抛出 JSONDecodeError | 配置文件格式错误 | 验证 JSON 格式正确性 |
| 文件读取异常 | 抛出 FileNotFoundError | 权限不足或路径错误 | 检查文件权限和路径 |
| 搜索结果为空 | 返回随机数据 | 关键词匹配不到结果 | 调整关键词或检查数据完整性 |
日志监控
系统提供了完整的日志记录机制:
#mermaid-svg-hRXHt4xq1GozQZJd{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-hRXHt4xq1GozQZJd .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-hRXHt4xq1GozQZJd .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-hRXHt4xq1GozQZJd .error-icon{fill:#552222;}#mermaid-svg-hRXHt4xq1GozQZJd .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-hRXHt4xq1GozQZJd .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-hRXHt4xq1GozQZJd .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-hRXHt4xq1GozQZJd .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-hRXHt4xq1GozQZJd .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-hRXHt4xq1GozQZJd .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-hRXHt4xq1GozQZJd .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-hRXHt4xq1GozQZJd .marker{fill:#333333;stroke:#333333;}#mermaid-svg-hRXHt4xq1GozQZJd .marker.cross{stroke:#333333;}#mermaid-svg-hRXHt4xq1GozQZJd svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-hRXHt4xq1GozQZJd p{margin:0;}#mermaid-svg-hRXHt4xq1GozQZJd .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-hRXHt4xq1GozQZJd .cluster-label text{fill:#333;}#mermaid-svg-hRXHt4xq1GozQZJd .cluster-label span{color:#333;}#mermaid-svg-hRXHt4xq1GozQZJd .cluster-label span p{background-color:transparent;}#mermaid-svg-hRXHt4xq1GozQZJd .label text,#mermaid-svg-hRXHt4xq1GozQZJd span{fill:#333;color:#333;}#mermaid-svg-hRXHt4xq1GozQZJd .node rect,#mermaid-svg-hRXHt4xq1GozQZJd .node circle,#mermaid-svg-hRXHt4xq1GozQZJd .node ellipse,#mermaid-svg-hRXHt4xq1GozQZJd .node polygon,#mermaid-svg-hRXHt4xq1GozQZJd .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-hRXHt4xq1GozQZJd .rough-node .label text,#mermaid-svg-hRXHt4xq1GozQZJd .node .label text,#mermaid-svg-hRXHt4xq1GozQZJd .image-shape .label,#mermaid-svg-hRXHt4xq1GozQZJd .icon-shape .label{text-anchor:middle;}#mermaid-svg-hRXHt4xq1GozQZJd .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-hRXHt4xq1GozQZJd .rough-node .label,#mermaid-svg-hRXHt4xq1GozQZJd .node .label,#mermaid-svg-hRXHt4xq1GozQZJd .image-shape .label,#mermaid-svg-hRXHt4xq1GozQZJd .icon-shape .label{text-align:center;}#mermaid-svg-hRXHt4xq1GozQZJd .node.clickable{cursor:pointer;}#mermaid-svg-hRXHt4xq1GozQZJd .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-hRXHt4xq1GozQZJd .arrowheadPath{fill:#333333;}#mermaid-svg-hRXHt4xq1GozQZJd .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-hRXHt4xq1GozQZJd .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-hRXHt4xq1GozQZJd .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-hRXHt4xq1GozQZJd .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-hRXHt4xq1GozQZJd .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-hRXHt4xq1GozQZJd .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-hRXHt4xq1GozQZJd .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-hRXHt4xq1GozQZJd .cluster text{fill:#333;}#mermaid-svg-hRXHt4xq1GozQZJd .cluster span{color:#333;}#mermaid-svg-hRXHt4xq1GozQZJd div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-hRXHt4xq1GozQZJd .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-hRXHt4xq1GozQZJd rect.text{fill:none;stroke-width:0;}#mermaid-svg-hRXHt4xq1GozQZJd .icon-shape,#mermaid-svg-hRXHt4xq1GozQZJd .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-hRXHt4xq1GozQZJd .icon-shape p,#mermaid-svg-hRXHt4xq1GozQZJd .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-hRXHt4xq1GozQZJd .icon-shape .label rect,#mermaid-svg-hRXHt4xq1GozQZJd .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-hRXHt4xq1GozQZJd .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-hRXHt4xq1GozQZJd .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-hRXHt4xq1GozQZJd :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 日志内容
日志级别
调试日志
信息日志
警告日志
错误日志
搜索关键词记录
文件操作日志
异常处理日志
配置加载日志
测试覆盖
系统提供了完整的测试用例:
#mermaid-svg-LZXv26z8GozhyDc3{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;fill:#333;}@keyframes edge-animation-frame{from{stroke-dashoffset:0;}}@keyframes dash{to{stroke-dashoffset:0;}}#mermaid-svg-LZXv26z8GozhyDc3 .edge-animation-slow{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 50s linear infinite;stroke-linecap:round;}#mermaid-svg-LZXv26z8GozhyDc3 .edge-animation-fast{stroke-dasharray:9,5!important;stroke-dashoffset:900;animation:dash 20s linear infinite;stroke-linecap:round;}#mermaid-svg-LZXv26z8GozhyDc3 .error-icon{fill:#552222;}#mermaid-svg-LZXv26z8GozhyDc3 .error-text{fill:#552222;stroke:#552222;}#mermaid-svg-LZXv26z8GozhyDc3 .edge-thickness-normal{stroke-width:1px;}#mermaid-svg-LZXv26z8GozhyDc3 .edge-thickness-thick{stroke-width:3.5px;}#mermaid-svg-LZXv26z8GozhyDc3 .edge-pattern-solid{stroke-dasharray:0;}#mermaid-svg-LZXv26z8GozhyDc3 .edge-thickness-invisible{stroke-width:0;fill:none;}#mermaid-svg-LZXv26z8GozhyDc3 .edge-pattern-dashed{stroke-dasharray:3;}#mermaid-svg-LZXv26z8GozhyDc3 .edge-pattern-dotted{stroke-dasharray:2;}#mermaid-svg-LZXv26z8GozhyDc3 .marker{fill:#333333;stroke:#333333;}#mermaid-svg-LZXv26z8GozhyDc3 .marker.cross{stroke:#333333;}#mermaid-svg-LZXv26z8GozhyDc3 svg{font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:16px;}#mermaid-svg-LZXv26z8GozhyDc3 p{margin:0;}#mermaid-svg-LZXv26z8GozhyDc3 .label{font-family:"trebuchet ms",verdana,arial,sans-serif;color:#333;}#mermaid-svg-LZXv26z8GozhyDc3 .cluster-label text{fill:#333;}#mermaid-svg-LZXv26z8GozhyDc3 .cluster-label span{color:#333;}#mermaid-svg-LZXv26z8GozhyDc3 .cluster-label span p{background-color:transparent;}#mermaid-svg-LZXv26z8GozhyDc3 .label text,#mermaid-svg-LZXv26z8GozhyDc3 span{fill:#333;color:#333;}#mermaid-svg-LZXv26z8GozhyDc3 .node rect,#mermaid-svg-LZXv26z8GozhyDc3 .node circle,#mermaid-svg-LZXv26z8GozhyDc3 .node ellipse,#mermaid-svg-LZXv26z8GozhyDc3 .node polygon,#mermaid-svg-LZXv26z8GozhyDc3 .node path{fill:#ECECFF;stroke:#9370DB;stroke-width:1px;}#mermaid-svg-LZXv26z8GozhyDc3 .rough-node .label text,#mermaid-svg-LZXv26z8GozhyDc3 .node .label text,#mermaid-svg-LZXv26z8GozhyDc3 .image-shape .label,#mermaid-svg-LZXv26z8GozhyDc3 .icon-shape .label{text-anchor:middle;}#mermaid-svg-LZXv26z8GozhyDc3 .node .katex path{fill:#000;stroke:#000;stroke-width:1px;}#mermaid-svg-LZXv26z8GozhyDc3 .rough-node .label,#mermaid-svg-LZXv26z8GozhyDc3 .node .label,#mermaid-svg-LZXv26z8GozhyDc3 .image-shape .label,#mermaid-svg-LZXv26z8GozhyDc3 .icon-shape .label{text-align:center;}#mermaid-svg-LZXv26z8GozhyDc3 .node.clickable{cursor:pointer;}#mermaid-svg-LZXv26z8GozhyDc3 .root .anchor path{fill:#333333!important;stroke-width:0;stroke:#333333;}#mermaid-svg-LZXv26z8GozhyDc3 .arrowheadPath{fill:#333333;}#mermaid-svg-LZXv26z8GozhyDc3 .edgePath .path{stroke:#333333;stroke-width:2.0px;}#mermaid-svg-LZXv26z8GozhyDc3 .flowchart-link{stroke:#333333;fill:none;}#mermaid-svg-LZXv26z8GozhyDc3 .edgeLabel{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-LZXv26z8GozhyDc3 .edgeLabel p{background-color:rgba(232,232,232, 0.8);}#mermaid-svg-LZXv26z8GozhyDc3 .edgeLabel rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-LZXv26z8GozhyDc3 .labelBkg{background-color:rgba(232, 232, 232, 0.5);}#mermaid-svg-LZXv26z8GozhyDc3 .cluster rect{fill:#ffffde;stroke:#aaaa33;stroke-width:1px;}#mermaid-svg-LZXv26z8GozhyDc3 .cluster text{fill:#333;}#mermaid-svg-LZXv26z8GozhyDc3 .cluster span{color:#333;}#mermaid-svg-LZXv26z8GozhyDc3 div.mermaidTooltip{position:absolute;text-align:center;max-width:200px;padding:2px;font-family:"trebuchet ms",verdana,arial,sans-serif;font-size:12px;background:hsl(80, 100%, 96.2745098039%);border:1px solid #aaaa33;border-radius:2px;pointer-events:none;z-index:100;}#mermaid-svg-LZXv26z8GozhyDc3 .flowchartTitleText{text-anchor:middle;font-size:18px;fill:#333;}#mermaid-svg-LZXv26z8GozhyDc3 rect.text{fill:none;stroke-width:0;}#mermaid-svg-LZXv26z8GozhyDc3 .icon-shape,#mermaid-svg-LZXv26z8GozhyDc3 .image-shape{background-color:rgba(232,232,232, 0.8);text-align:center;}#mermaid-svg-LZXv26z8GozhyDc3 .icon-shape p,#mermaid-svg-LZXv26z8GozhyDc3 .image-shape p{background-color:rgba(232,232,232, 0.8);padding:2px;}#mermaid-svg-LZXv26z8GozhyDc3 .icon-shape .label rect,#mermaid-svg-LZXv26z8GozhyDc3 .image-shape .label rect{opacity:0.5;background-color:rgba(232,232,232, 0.8);fill:rgba(232,232,232, 0.8);}#mermaid-svg-LZXv26z8GozhyDc3 .label-icon{display:inline-block;height:1em;overflow:visible;vertical-align:-0.125em;}#mermaid-svg-LZXv26z8GozhyDc3 .node .label-icon path{fill:currentColor;stroke:revert;stroke-width:revert;}#mermaid-svg-LZXv26z8GozhyDc3 :root{--mermaid-font-family:"trebuchet ms",verdana,arial,sans-serif;} 测试场景
测试类型
单元测试
集成测试
基础测试
简化测试
正常搜索
空关键词
无匹配结果
随机选择
更多信息
字段说明、校验规则与示例以 OpenAPI 为准;需要对照源码时请查看 schemas/、service/ 与路由注册处。
文档信息
- 接口文档: docs.jcaigc.cn
- 效果案例: www.jcaigc.cn/workflow
- 开源仓库: https://gitcode.com/gcw_xwJRBZlx/capcut-mate