import type { LlmBenchmarkSampleCase } from '../framework/index';

/**
 * 上下文场景:上下文理解与延续能力。
 */
export const contextualLlmBenchmarkSampleCases: LlmBenchmarkSampleCase[] = [
  {
    id: 'context-login-form',
    messages: [
      {
        'role': 'user',
        'content': '生成一个登录表单',
      },
      {
        'role': 'assistant',
        'content':
          '```schemaJson\n{\n  "componentName": "Page",\n  "state": {\n    "loginForm": {\n      "username": "",\n      "password": "",\n      "rememberMe": false\n    }\n  },\n  "methods": {\n    "handleLogin": {\n      "type": "JSFunction",\n      "value": "function() { if (!this.state.loginForm.username || !this.state.loginForm.password) { this.callAction(\'continueChat\', { message: \'请输入用户名和密码\' }); return; } this.callAction(\'continueChat\', { message: \'正在登录...\' }); }"\n    }\n  },\n  "children": [\n    {\n      "componentName": "TinyCard",\n      "props": {\n        "title": "用户登录",\n        "autoWidth": true\n      },\n      "children": [\n        {\n          "componentName": "TinyForm",\n          "props": {\n            "model": {\n              "type": "JSExpression",\n              "value": "this.state.loginForm"\n            },\n            "labelPosition": "top",\n            "labelWidth": "80px"\n          },\n          "children": [\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": "用户名",\n                "prop": "username",\n                "required": true\n              },\n              "children": [\n                {\n                  "componentName": "TinyInput",\n                  "props": {\n                    "placeholder": "请输入用户名",\n                    "modelValue": {\n                      "type": "JSExpression",\n                      "model": true,\n                      "value": "this.state.loginForm.username"\n                    }\n                  }\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": "密码",\n                "prop": "password",\n                "required": true\n              },\n              "children": [\n                {\n                  "componentName": "TinyInput",\n                  "props": {\n                    "type": "password",\n                    "placeholder": "请输入密码",\n                    "modelValue": {\n                      "type": "JSExpression",\n                      "model": true,\n                      "value": "this.state.loginForm.password"\n                    }\n                  }\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": ""\n              },\n              "children": [\n                {\n                  "componentName": "TinyCheckbox",\n                  "props": {\n                    "modelValue": {\n                      "type": "JSExpression",\n                      "model": true,\n                      "value": "this.state.loginForm.rememberMe"\n                    },\n                    "text": "记住我"\n                  }\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": ""\n              },\n              "children": [\n                {\n                  "componentName": "TinyButton",\n                  "props": {\n                    "text": "登录",\n                    "type": "primary",\n                    "onClick": {\n                      "type": "JSExpression",\n                      "value": "this.handleLogin"\n                    },\n                    "style": "margin-right: 10px;"\n                  }\n                },\n                {\n                  "componentName": "TinyButton",\n                  "props": {\n                    "text": "注册",\n                    "onClick": {\n                      "type": "JSFunction",\n                      "value": "function() { this.callAction(\'continueChat\', { message: \'跳转到注册页面\' }); }"\n                    }\n                  }\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}\n```',
        'messages': [
          {
            'type': 'schema-card',
            'content':
              '\n{\n  "componentName": "Page",\n  "state": {\n    "loginForm": {\n      "username": "",\n      "password": "",\n      "rememberMe": false\n    }\n  },\n  "methods": {\n    "handleLogin": {\n      "type": "JSFunction",\n      "value": "function() { if (!this.state.loginForm.username || !this.state.loginForm.password) { this.callAction(\'continueChat\', { message: \'请输入用户名和密码\' }); return; } this.callAction(\'continueChat\', { message: \'正在登录...\' }); }"\n    }\n  },\n  "children": [\n    {\n      "componentName": "TinyCard",\n      "props": {\n        "title": "用户登录",\n        "autoWidth": true\n      },\n      "children": [\n        {\n          "componentName": "TinyForm",\n          "props": {\n            "model": {\n              "type": "JSExpression",\n              "value": "this.state.loginForm"\n            },\n            "labelPosition": "top",\n            "labelWidth": "80px"\n          },\n          "children": [\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": "用户名",\n                "prop": "username",\n                "required": true\n              },\n              "children": [\n                {\n                  "componentName": "TinyInput",\n                  "props": {\n                    "placeholder": "请输入用户名",\n                    "modelValue": {\n                      "type": "JSExpression",\n                      "model": true,\n                      "value": "this.state.loginForm.username"\n                    }\n                  }\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": "密码",\n                "prop": "password",\n                "required": true\n              },\n              "children": [\n                {\n                  "componentName": "TinyInput",\n                  "props": {\n                    "type": "password",\n                    "placeholder": "请输入密码",\n                    "modelValue": {\n                      "type": "JSExpression",\n                      "model": true,\n                      "value": "this.state.loginForm.password"\n                    }\n                  }\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": ""\n              },\n              "children": [\n                {\n                  "componentName": "TinyCheckbox",\n                  "props": {\n                    "modelValue": {\n                      "type": "JSExpression",\n                      "model": true,\n                      "value": "this.state.loginForm.rememberMe"\n                    },\n                    "text": "记住我"\n                  }\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": ""\n              },\n              "children": [\n                {\n                  "componentName": "TinyButton",\n                  "props": {\n                    "text": "登录",\n                    "type": "primary",\n                    "onClick": {\n                      "type": "JSExpression",\n                      "value": "this.handleLogin"\n                    },\n                    "style": "margin-right: 10px;"\n                  }\n                },\n                {\n                  "componentName": "TinyButton",\n                  "props": {\n                    "text": "注册",\n                    "onClick": {\n                      "type": "JSFunction",\n                      "value": "function() { this.callAction(\'continueChat\', { message: \'跳转到注册页面\' }); }"\n                    }\n                  }\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}',
            'id': 'f812c14d-a10c-4309-9053-3609723b5126',
          },
        ],
        'finishInfo': {
          'object': 'chat.completion.chunk',
          'model': 'deepseek-v3.2',
          'created': 1775650242579,
          'choices': [
            {
              'index': 0,
              'delta': {},
              'finish_reason': 'stop',
            },
          ],
          'usage': {
            'prompt_tokens': 27667,
            'completion_tokens': 762,
            'total_tokens': 28429,
          },
        },
      },
      {
        'role': 'user',
        'content': '增加忘记密码',
      },
      {
        'role': 'assistant',
        'content':
          '```schemaJson\n{\n  "componentName": "Page",\n  "state": {\n    "loginForm": {\n      "username": "",\n      "password": "",\n      "rememberMe": false\n    }\n  },\n  "methods": {\n    "handleLogin": {\n      "type": "JSFunction",\n      "value": "function() { if (!this.state.loginForm.username || !this.state.loginForm.password) { this.callAction(\'continueChat\', { message: \'请输入用户名和密码\' }); return; } this.callAction(\'continueChat\', { message: \'正在登录...\' }); }"\n    },\n    "handleForgotPassword": {\n      "type": "JSFunction",\n      "value": "function() { this.callAction(\'continueChat\', { message: \'跳转到忘记密码页面\' }); }"\n    }\n  },\n  "children": [\n    {\n      "componentName": "TinyCard",\n      "props": {\n        "title": "用户登录",\n        "autoWidth": true\n      },\n      "children": [\n        {\n          "componentName": "TinyForm",\n          "props": {\n            "model": {\n              "type": "JSExpression",\n              "value": "this.state.loginForm"\n            },\n            "labelPosition": "top",\n            "labelWidth": "80px"\n          },\n          "children": [\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": "用户名",\n                "prop": "username",\n                "required": true\n              },\n              "children": [\n                {\n                  "componentName": "TinyInput",\n                  "props": {\n                    "placeholder": "请输入用户名",\n                    "modelValue": {\n                      "type": "JSExpression",\n                      "model": true,\n                      "value": "this.state.loginForm.username"\n                    }\n                  }\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": "密码",\n                "prop": "password",\n                "required": true\n              },\n              "children": [\n                {\n                  "componentName": "TinyInput",\n                  "props": {\n                    "type": "password",\n                    "placeholder": "请输入密码",\n                    "modelValue": {\n                      "type": "JSExpression",\n                      "model": true,\n                      "value": "this.state.loginForm.password"\n                    }\n                  }\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": ""\n              },\n              "children": [\n                {\n                  "componentName": "div",\n                  "props": {\n                    "style": "display: flex; justify-content: space-between; align-items: center; width: 100%;"\n                  },\n                  "children": [\n                    {\n                      "componentName": "TinyCheckbox",\n                      "props": {\n                        "modelValue": {\n                          "type": "JSExpression",\n                          "model": true,\n                          "value": "this.state.loginForm.rememberMe"\n                        },\n                        "text": "记住我"\n                      }\n                    },\n                    {\n                      "componentName": "a",\n                      "props": {\n                        "href": "#",\n                        "onClick": {\n                          "type": "JSExpression",\n                          "value": "this.handleForgotPassword"\n                        },\n                        "style": "font-size: 14px; color: #1890ff; text-decoration: none;"\n                      },\n                      "children": "忘记密码?"\n                    }\n                  ]\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": ""\n              },\n              "children": [\n                {\n                  "componentName": "div",\n                  "props": {\n                    "style": "display: flex; gap: 10px;"\n                  },\n                  "children": [\n                    {\n                      "componentName": "TinyButton",\n                      "props": {\n                        "text": "登录",\n                        "type": "primary",\n                        "onClick": {\n                          "type": "JSExpression",\n                          "value": "this.handleLogin"\n                        }\n                      }\n                    },\n                    {\n                      "componentName": "TinyButton",\n                      "props": {\n                        "text": "注册",\n                        "onClick": {\n                          "type": "JSFunction",\n                          "value": "function() { this.callAction(\'continueChat\', { message: \'跳转到注册页面\' }); }"\n                        }\n                      }\n                    }\n                  ]\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}\n```',
        'messages': [
          {
            'type': 'schema-card',
            'content':
              '\n{\n  "componentName": "Page",\n  "state": {\n    "loginForm": {\n      "username": "",\n      "password": "",\n      "rememberMe": false\n    }\n  },\n  "methods": {\n    "handleLogin": {\n      "type": "JSFunction",\n      "value": "function() { if (!this.state.loginForm.username || !this.state.loginForm.password) { this.callAction(\'continueChat\', { message: \'请输入用户名和密码\' }); return; } this.callAction(\'continueChat\', { message: \'正在登录...\' }); }"\n    },\n    "handleForgotPassword": {\n      "type": "JSFunction",\n      "value": "function() { this.callAction(\'continueChat\', { message: \'跳转到忘记密码页面\' }); }"\n    }\n  },\n  "children": [\n    {\n      "componentName": "TinyCard",\n      "props": {\n        "title": "用户登录",\n        "autoWidth": true\n      },\n      "children": [\n        {\n          "componentName": "TinyForm",\n          "props": {\n            "model": {\n              "type": "JSExpression",\n              "value": "this.state.loginForm"\n            },\n            "labelPosition": "top",\n            "labelWidth": "80px"\n          },\n          "children": [\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": "用户名",\n                "prop": "username",\n                "required": true\n              },\n              "children": [\n                {\n                  "componentName": "TinyInput",\n                  "props": {\n                    "placeholder": "请输入用户名",\n                    "modelValue": {\n                      "type": "JSExpression",\n                      "model": true,\n                      "value": "this.state.loginForm.username"\n                    }\n                  }\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": "密码",\n                "prop": "password",\n                "required": true\n              },\n              "children": [\n                {\n                  "componentName": "TinyInput",\n                  "props": {\n                    "type": "password",\n                    "placeholder": "请输入密码",\n                    "modelValue": {\n                      "type": "JSExpression",\n                      "model": true,\n                      "value": "this.state.loginForm.password"\n                    }\n                  }\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": ""\n              },\n              "children": [\n                {\n                  "componentName": "div",\n                  "props": {\n                    "style": "display: flex; justify-content: space-between; align-items: center; width: 100%;"\n                  },\n                  "children": [\n                    {\n                      "componentName": "TinyCheckbox",\n                      "props": {\n                        "modelValue": {\n                          "type": "JSExpression",\n                          "model": true,\n                          "value": "this.state.loginForm.rememberMe"\n                        },\n                        "text": "记住我"\n                      }\n                    },\n                    {\n                      "componentName": "a",\n                      "props": {\n                        "href": "#",\n                        "onClick": {\n                          "type": "JSExpression",\n                          "value": "this.handleForgotPassword"\n                        },\n                        "style": "font-size: 14px; color: #1890ff; text-decoration: none;"\n                      },\n                      "children": "忘记密码?"\n                    }\n                  ]\n                }\n              ]\n            },\n            {\n              "componentName": "TinyFormItem",\n              "props": {\n                "label": ""\n              },\n              "children": [\n                {\n                  "componentName": "div",\n                  "props": {\n                    "style": "display: flex; gap: 10px;"\n                  },\n                  "children": [\n                    {\n                      "componentName": "TinyButton",\n                      "props": {\n                        "text": "登录",\n                        "type": "primary",\n                        "onClick": {\n                          "type": "JSExpression",\n                          "value": "this.handleLogin"\n                        }\n                      }\n                    },\n                    {\n                      "componentName": "TinyButton",\n                      "props": {\n                        "text": "注册",\n                        "onClick": {\n                          "type": "JSFunction",\n                          "value": "function() { this.callAction(\'continueChat\', { message: \'跳转到注册页面\' }); }"\n                        }\n                      }\n                    }\n                  ]\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}',
            'id': '4732ef33-0633-4202-b0e9-d26b13126870',
          },
        ],
        'finishInfo': {
          'object': 'chat.completion.chunk',
          'model': 'deepseek-v3.2',
          'created': 1775702964270,
          'choices': [
            {
              'index': 0,
              'delta': {},
              'finish_reason': 'stop',
            },
          ],
          'usage': {
            'prompt_tokens': 28398,
            'completion_tokens': 976,
            'total_tokens': 29374,
          },
        },
      },
      {
        'role': 'user',
        'content': '删除注册按钮,增加去注册',
      },
    ],
  },
  {
    id: 'context-user-table',
    messages: [
      {
        'role': 'user',
        'content': '生成一个支持行内编辑的用户列表,支持编辑、保存、取消,并展示操作结果提示。',
      },
      {
        'role': 'assistant',
        'content':
          '\n{\n  "componentName": "Page",\n  "state": {\n    "activeTab": "首页",\n    "productList": [\n      {\n        "id": "1",\n        "name": "商品1",\n        "price": "¥99.00",\n        "image": "https://res.hc-cdn.com/tiny-vue-web-doc/3.26.1/static/images/dsj.png"\n      },\n      {\n        "id": "2",\n        "name": "商品2",\n        "price": "¥199.00",\n        "image": "https://res.hc-cdn.com/tiny-vue-web-doc/3.26.1/static/images/dsj.png"\n      },\n      {\n        "id": "3",\n        "name": "商品3",\n        "price": "¥299.00",\n        "image": "https://res.hc-cdn.com/tiny-vue-web-doc/3.26.1/static/images/dsj.png"\n      }\n    ]\n  },\n  "methods": {},\n  "children": [\n    {\n      "componentName": "TinyCard",\n      "children": [\n        {\n          "componentName": "TinyTabs",\n          "props": {\n            "modelValue": {\n              "type": "JSExpression",\n              "value": "this.state.activeTab"\n            }\n          },\n          "children": [\n            {\n              "componentName": "TinyTabItem",\n              "props": {\n                "title": "首页",\n                "name": "首页"\n              },\n              "children": [\n                {\n                  "componentName": "div",\n                  "children": [\n                    {\n                      "componentName": "TinyCarousel",\n                      "props": {\n                        "height": "180px"\n                      },\n                      "children": [\n                        {\n                          "componentName": "TinyCarouselItem",\n                          "props": {\n                            "title": "carousel-item-a"\n                          },\n                          "children": [\n                            {\n                              "componentName": "Img",\n                              "props": {\n                                "src": "https://res.hc-cdn.com/tiny-vue-web-doc/3.26.1/static/images/dsj.png"\n                              }\n                            }\n                          ]\n                        },\n                        {\n                          "componentName": "TinyCarouselItem",\n                          "props": {\n                            "title": "carousel-item-b"\n                          },\n                          "children": [\n                            {\n                              "componentName": "Img",\n                              "props": {\n                                "src": "https://res.hc-cdn.com/tiny-vue-web-doc/3.26.1/static/images/dsj.png"\n                              }\n                            }\n                          ]\n                        }\n                      ]\n                    },\n                    {\n                      "componentName": "TinyGrid",\n                      "props": {\n                        "data": {\n                          "type": "JSExpression",\n                          "value": "this.state.productList"\n                        },\n                        "columns": [\n                          {\n                            "field": "image",\n                            "title": "图片",\n                            "slots": {\n                              "default": {\n                                "type": "JSSlot",\n                                "value": [\n                                  {\n                                    "componentName": "Img",\n                                    "props": {\n                                      "src": {\n                                        "type": "JSExpression",\n                                        "value": "row.image"\n                                      },\n                                      "style": "width: 100px; height: 100px;"\n                                    }\n                                  }\n                                ],\n                                "params": ["row"]\n                              }\n                            }\n                          },\n                          {\n                            "field": "name",\n                            "title": "商品名称"\n                          },\n                          {\n                            "field": "price",\n                            "title": "价格"\n                          }\n                        ]\n                      }\n                    }\n                  ]\n                }\n              ]\n            },\n            {\n              "componentName": "TinyTabItem",\n              "props": {\n                "title": "分类",\n                "name": "分类"\n              },\n              "children": [\n                {\n                  "componentName": "div",\n                  "children": "分类页面内容"\n                }\n              ]\n            },\n            {\n              "componentName": "TinyTabItem",\n              "props": {\n                "title": "购物车",\n                "name": "购物车"\n              },\n              "children": [\n                {\n                  "componentName": "div",\n                  "children": "购物车页面内容"\n                }\n              ]\n            },\n            {\n              "componentName": "TinyTabItem",\n              "props": {\n                "title": "我的",\n                "name": "我的"\n              },\n              "children": [\n                {\n                  "componentName": "div",\n                  "children": "个人中心页面内容"\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}',
        'messages': [
          {
            'type': 'markdown',
            'content':
              '我将为您生成一个支持行内编辑的用户列表卡片。这个卡片将包含用户数据表格,支持行内编辑、保存、取消功能,并展示操作结果提示。\n\n首先,让我获取当前日期,以便在表格中使用。',
          },
          {
            'type': 'tool',
            'name': 'get-current-date',
            'formatPretty': true,
            'status': 'success',
            'content':
              '{\n  "arguments": {},\n  "result": [\n    {\n      "type": "text",\n      "text": "2026-03-30"\n    }\n  ]\n}',
            'id': 'call_00_AEwObKBNaD9P1bPClWnkbwOA',
          },
          {
            'type': 'markdown',
            'content':
              '现在我将生成一个支持行内编辑的用户列表卡片。这个卡片将包含以下功能:\n1. 用户数据表格,支持行内编辑\n2. 编辑、保存、取消操作按钮\n3. 操作结果提示显示\n\n',
          },
          {
            'type': 'schema-card',
            content:
              '\n{\n  "componentName": "Page",\n  "state": {\n    "searchKeyword": "",\n    "selectedCategory": "all",\n    "cartItems": [],\n    "products": [\n      {\n        "id": "1",\n        "name": "无线蓝牙耳机",\n        "price": 299,\n        "originalPrice": 399,\n        "image": "https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/yunying/new-home/markplace/home_icon_14.svg",\n        "category": "electronics",\n        "rating": 4.5,\n        "stock": 50\n      },\n      {\n        "id": "2",\n        "name": "智能手表",\n        "price": 899,\n        "originalPrice": 1299,\n        "image": "https://res-static.hc-cdn.cn/cloudbu-site/public/new-product-icon/BusinessApplications/Cloudsite.png",\n        "category": "electronics",\n        "rating": 4.8,\n        "stock": 30\n      },\n      {\n        "id": "3",\n        "name": "运动T恤",\n        "price": 129,\n        "originalPrice": 199,\n        "image": "https://res-static.hc-cdn.cn/cloudbu-site/public/new-product-icon/BusinessApplications/mail0918.png",\n        "category": "clothing",\n        "rating": 4.3,\n        "stock": 100\n      },\n      {\n        "id": "4",\n        "name": "背包",\n        "price": 199,\n        "originalPrice": 299,\n        "image": "https://res-static.hc-cdn.cn/cloudbu-site/public/new-product-icon/BusinessApplications/Domains.png",\n        "category": "accessories",\n        "rating": 4.6,\n        "stock": 45\n      },\n      {\n        "id": "5",\n        "name": "笔记本电脑",\n        "price": 5999,\n        "originalPrice": 7999,\n        "image": "https://tinyengine-assets.obs.cn-north-4.myhuaweicloud.com/files/designer-default-icon.jpg",\n        "category": "electronics",\n        "rating": 4.9,\n        "stock": 15\n      },\n      {\n        "id": "6",\n        "name": "保温杯",\n        "price": 89,\n        "originalPrice": 129,\n        "image": "https://res-static.hc-cdn.cn/cloudbu-site/china/zh-cn/yunying/new-home/markplace/home_icon_14.svg",\n        "category": "home",\n        "rating": 4.4,\n        "stock": 80\n      }\n    ],\n    "categories": [\n      {\n        "id": "all",\n        "name": "全部商品"\n      },\n      {\n        "id": "electronics",\n        "name": "电子产品"\n      },\n      {\n        "id": "clothing",\n        "name": "服装服饰"\n      },\n      {\n        "id": "home",\n        "name": "家居用品"\n      },\n      {\n        "id": "accessories",\n        "name": "配件配饰"\n      }\n    ]\n  },\n  "methods": {\n    "handleSearch": {\n      "type": "JSFunction",\n      "value": "function handleSearch(value) { console.log(\'搜索关键词:\', value); this.state.searchKeyword = value; }"\n    },\n    "filterProducts": {\n      "type": "JSFunction",\n      "value": "function filterProducts() { const { products, selectedCategory, searchKeyword } = this.state; let filtered = products; if (selectedCategory !== \'all\') { filtered = filtered.filter(product => product.category === selectedCategory); } if (searchKeyword) { filtered = filtered.filter(product => product.name.includes(searchKeyword)); } return filtered; }"\n    },\n    "addToCart": {\n      "type": "JSFunction",\n      "value": "function addToCart(product) { const existingItem = this.state.cartItems.find(item => item.id === product.id); if (existingItem) { existingItem.quantity += 1; } else { this.state.cartItems.push({ ...product, quantity: 1 }); } console.log(\'添加到购物车:\', product.name); }"\n    },\n    "selectCategory": {\n      "type": "JSFunction",\n      "value": "function selectCategory(categoryId) { this.state.selectedCategory = categoryId; }"\n    },\n    "getCartTotal": {\n      "type": "JSFunction",\n      "value": "function getCartTotal() { return this.state.cartItems.reduce((total, item) => total + (item.price * item.quantity), 0); }"\n    }\n  },\n  "props": {\n    "style": "width: 414px; background: #f5f5f5;"\n  },\n  "children": [\n    {\n      "componentName": "TinyCard",\n      "children": [\n        {\n          "componentName": "div",\n          "props": {\n            "style": "padding: 16px; background: #ffffff;"\n          },\n          "children": [\n            {\n              "componentName": "div",\n              "props": {\n                "style": "display: flex; align-items: center; margin-bottom: 16px;"\n              },\n              "children": [\n                {\n                  "componentName": "h1",\n                  "props": {\n                    "style": "font-size: 24px; font-weight: bold; margin: 0; flex: 1;"\n                  },\n                  "children": "电商商城"\n                },\n                {\n                  "componentName": "div",\n                  "props": {\n                    "style": "position: relative;"\n                  },\n                  "children": [\n                    {\n                      "componentName": "Icon",\n                      "props": {\n                        "name": "IconDel"\n                      }\n                    },\n                    {\n                      "componentName": "div",\n                      "props": {\n                        "style": "position: absolute; top: -8px; right: -8px; background: #ff4444; color: white; border-radius: 50%; width: 16px; height: 16px; font-size: 12px; display: flex; align-items: center; justify-content: center;"\n                      },\n                      "children": [\n                        {\n                          "componentName": "Text",\n                          "props": {\n                            "text": {\n                              "type": "JSExpression",\n                              "value": "this.state.cartItems.length"\n                            }\n                          }\n                        }\n                      ]\n                    }\n                  ]\n                }\n              ]\n            },\n            {\n              "componentName": "TinySearch",\n              "props": {\n                "modelValue": {\n                  "type": "JSExpression",\n                  "model": true,\n                  "value": "this.state.searchKeyword"\n                },\n                "placeholder": "搜索商品名称",\n                "onSearch": {\n                  "type": "JSExpression",\n                  "value": "this.handleSearch"\n                }\n              }\n            }\n          ]\n        }\n      ]\n    },\n    {\n      "componentName": "TinyCard",\n      "props": {\n        "style": "margin-top: 8px;"\n      },\n      "children": [\n        {\n          "componentName": "div",\n          "props": {\n            "style": "padding: 16px;"\n          },\n          "children": [\n            {\n              "componentName": "Text",\n              "props": {\n                "style": "font-size: 16px; font-weight: bold; margin-bottom: 12px; display: block;",\n                "text": "商品分类"\n              }\n            },\n            {\n              "componentName": "div",\n              "props": {\n                "style": "display: flex; overflow-x: auto; gap: 8px;"\n              },\n              "children": [\n                {\n                  "componentName": "div",\n                  "loop": {\n                    "type": "JSExpression",\n                    "value": "this.state.categories"\n                  },\n                  "loopArgs": ["category"],\n                  "props": {\n                    "style": {\n                      "type": "JSExpression",\n                      "value": "this.state.selectedCategory === category.id ? \'padding: 8px 16px; background: #1890ff; color: white; border-radius: 20px; white-space: nowrap; cursor: pointer;\' : \'padding: 8px 16px; background: #f0f0f0; border-radius: 20px; white-space: nowrap; cursor: pointer;\'"\n                    },\n                    "onClick": {\n                      "type": "JSExpression",\n                      "value": "this.selectCategory",\n                      "params": ["category.id"]\n                    }\n                  },\n                  "children": [\n                    {\n                      "componentName": "Text",\n                      "props": {\n                        "text": {\n                          "type": "JSExpression",\n                          "value": "category.name"\n                        }\n                      }\n                    }\n                  ]\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    },\n    {\n      "componentName": "TinyCard",\n      "props": {\n        "style": "margin-top: 8px;"\n      },\n      "children": [\n        {\n          "componentName": "div",\n          "props": {\n            "style": "padding: 16px;"\n          },\n          "children": [\n            {\n              "componentName": "Text",\n              "props": {\n                "style": "font-size: 16px; font-weight: bold; margin-bottom: 16px; display: block;",\n                "text": "热门商品"\n              }\n            },\n            {\n              "componentName": "TinyLayout",\n              "props": {\n                "cols": 12\n              },\n              "children": [\n                {\n                  "componentName": "TinyRow",\n                  "props": {\n                    "gutter": 16\n                  },\n                  "children": [\n                    {\n                      "componentName": "TinyCol",\n                      "loop": {\n                        "type": "JSExpression",\n                        "value": "this.filterProducts()"\n                      },\n                      "loopArgs": ["product"],\n                      "props": {\n                        "span": 6\n                      },\n                      "children": [\n                        {\n                          "componentName": "div",\n                          "props": {\n                            "style": "background: white; border-radius: 8px; overflow: hidden; box-shadow: 0 2px 8px rgba(0,0,0,0.1); margin-bottom: 16px;"\n                          },\n                          "children": [\n                            {\n                              "componentName": "Img",\n                              "props": {\n                                "src": {\n                                  "type": "JSExpression",\n                                  "value": "product.image"\n                                },\n                                "style": "width: 100%; height: 120px; object-fit: cover;"\n                              }\n                            },\n                            {\n                              "componentName": "div",\n                              "props": {\n                                "style": "padding: 12px;"\n                              },\n                              "children": [\n                                {\n                                  "componentName": "Text",\n                                  "props": {\n                                    "style": "font-size: 14px; font-weight: bold; margin-bottom: 4px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;",\n                                    "text": {\n                                      "type": "JSExpression",\n                                      "value": "product.name"\n                                    }\n                                  }\n                                },\n                                {\n                                  "componentName": "div",\n                                  "props": {\n                                    "style": "display: flex; align-items: center; margin-bottom: 8px;"\n                                  },\n                                  "children": [\n                                    {\n                                      "componentName": "Text",\n                                      "props": {\n                                        "style": "font-size: 16px; font-weight: bold; color: #ff4444; margin-right: 8px;",\n                                        "text": {\n                                          "type": "JSExpression",\n                                          "value": "`¥${product.price}`"\n                                        }\n                                      }\n                                    },\n                                    {\n                                      "componentName": "Text",\n                                      "props": {\n                                        "style": "font-size: 12px; color: #999; text-decoration: line-through;",\n                                        "text": {\n                                          "type": "JSExpression",\n                                          "value": "`¥${product.originalPrice}`"\n                                        }\n                                      }\n                                    }\n                                  ]\n                                },\n                                {\n                                  "componentName": "div",\n                                  "props": {\n                                    "style": "display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px;"\n                                  },\n                                  "children": [\n                                    {\n                                      "componentName": "div",\n                                      "props": {\n                                        "style": "display: flex; align-items: center;"\n                                      },\n                                      "children": [\n                                        {\n                                          "componentName": "Icon",\n                                          "props": {\n                                            "name": "IconDel"\n                                          }\n                                        },\n                                        {\n                                          "componentName": "Text",\n                                          "props": {\n                                            "style": "font-size: 12px; color: #666; margin-left: 4px;",\n                                            "text": {\n                                              "type": "JSExpression",\n                                              "value": "product.rating"\n                                            }\n                                          }\n                                        }\n                                      ]\n                                    },\n                                    {\n                                      "componentName": "Text",\n                                      "props": {\n                                        "style": "font-size: 12px; color: #666;",\n                                        "text": {\n                                          "type": "JSExpression",\n                                          "value": "`库存${product.stock}`"\n                                        }\n                                      }\n                                    }\n                                  ]\n                                },\n                                {\n                                  "componentName": "TinyButton",\n                                  "props": {\n                                    "text": "加入购物车",\n                                    "size": "mini",\n                                    "type": "primary",\n                                    "style": "width: 100%;",\n                                    "onClick": {\n                                      "type": "JSExpression",\n                                      "value": "this.addToCart",\n                                      "params": ["product"]\n                                    }\n                                  }\n                                }\n                              ]\n                            }\n                          ]\n                        }\n                      ]\n                    }\n                  ]\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    },\n    {\n      "componentName": "TinyCard",\n      "props": {\n        "style": "margin-top: 8px; margin-bottom: 16px;"\n      },\n      "children": [\n        {\n          "componentName": "div",\n          "props": {\n            "style": "padding: 16px;"\n          },\n          "children": [\n            {\n              "componentName": "Text",\n              "props": {\n                "style": "font-size: 16px; font-weight: bold; margin-bottom: 12px; display: block;",\n                "text": "购物车"\n              }\n            },\n            {\n              "componentName": "div",\n              "condition": {\n                "type": "JSExpression",\n                "value": "this.state.cartItems.length === 0"\n              },\n              "children": [\n                {\n                  "componentName": "div",\n                  "props": {\n                    "style": "text-align: center; padding: 40px 0; color: #999;"\n                  },\n                  "children": [\n                    {\n                      "componentName": "Icon",\n                      "props": {\n                        "name": "IconDel"\n                      }\n                    },\n                    {\n                      "componentName": "Text",\n                      "props": {\n                        "style": "display: block; margin-top: 8px;",\n                        "text": "购物车空空如也"\n                      }\n                    }\n                  ]\n                }\n              ]\n            },\n            {\n              "componentName": "div",\n              "condition": {\n                "type": "JSExpression",\n                "value": "this.state.cartItems.length > 0"\n              },\n              "children": [\n                {\n                  "componentName": "TinyGrid",\n                  "props": {\n                    "data": {\n                      "type": "JSExpression",\n                      "value": "this.state.cartItems"\n                    },\n                    "columns": [\n                      {\n                        "field": "name",\n                        "title": "商品名称",\n                        "width": "120"\n                      },\n                      {\n                        "field": "price",\n                        "title": "单价",\n                        "width": "80",\n                        "formatText": "function(h, params) { return `¥${params.cell}`; }"\n                      },\n                      {\n                        "field": "quantity",\n                        "title": "数量",\n                        "width": "80"\n                      },\n                      {\n                        "field": "total",\n                        "title": "小计",\n                        "width": "100",\n                        "formatText": "function(h, params) { return `¥${params.row.price * params.row.quantity}`; }"\n                      }\n                    ],\n                    "maxHeight": "200px"\n                  }\n                },\n                {\n                  "componentName": "div",\n                  "props": {\n                    "style": "display: flex; justify-content: space-between; align-items: center; margin-top: 16px; padding-top: 16px; border-top: 1px solid #f0f0f0;"\n                  },\n                  "children": [\n                    {\n                      "componentName": "Text",\n                      "props": {\n                        "style": "font-size: 16px; font-weight: bold;",\n                        "text": {\n                          "type": "JSExpression",\n                          "value": "`合计:¥${this.getCartTotal()}`"\n                        }\n                      }\n                    },\n                    {\n                      "componentName": "TinyButton",\n                      "props": {\n                        "text": "去结算",\n                        "type": "primary"\n                      }\n                    }\n                  ]\n                }\n              ]\n            }\n          ]\n        }\n      ]\n    }\n  ]\n}',
            'id': '0fedb8ce-27f8-4aa3-8812-7c4aa8b2550a',
          },
        ],
        'finishInfo': {
          'object': 'chat.completion.chunk',
          'model': 'deepseek/deepseek-chat',
          'created': 1774861743578,
          'choices': [
            {
              'index': 0,
              'delta': {},
              'finish_reason': 'length',
            },
          ],
          'usage': {
            'prompt_tokens': 58395,
            'completion_tokens': 4171,
            'total_tokens': 62566,
          },
        },
      },
      {
        'role': 'user',
        'content': '部门、职位、状态要支持筛选',
      },
    ],
  },
];