{"url_pattern":"^https?://jimeng\\.jianying\\.com(/.*)?$","site_name":"jimeng","allowed_domains":["example.com","jimeng.jianying.com"],"tools":[{"name":"jimeng_history","description":"即梦AI 查看最近生成的作品","inputSchema":{"type":"object","properties":{"limit":{"type":"number","description":"","default":5}},"required":null},"handler":"(params) => {\n  const args = Object.assign({\"limit\": 5}, params || {});\n  let data = null;\n  let __wbContextUrl = globalThis.location?.href || '';\n  let __wbContextDocument = globalThis.document || null;\n    const __wbDefault = (value, fallback) => (value === undefined || value === null || value === '' ? fallback : value);\n    const __wbJoin = (value, separator) => Array.isArray(value) ? value.join(separator) : (value ?? '');\n    const __wbGet = (value, path) => {\n      if (!path) return value;\n      return String(path).split('.').reduce((acc, part) => (acc == null ? undefined : acc[part]), value);\n    };\n    const __wbBaseUrl = () => (__wbContextUrl || globalThis.location?.href || 'https://example.com/');\n    const __wbResolve = (target, base) => {\n      if (target == null) return '';\n      const text = String(target);\n      try {\n        return /^https?:/i.test(text) ? text : new URL(text, base || __wbBaseUrl()).toString();\n      } catch (_error) {\n        return text;\n      }\n    };\n    const __wbFetch = async (target, options) => {\n      const url = __wbResolve(target, __wbBaseUrl());\n      const resp = await globalThis.fetch(url, Object.assign({ credentials: 'include' }, options || {}));\n      if (!resp.ok) {\n        throw new Error(`HTTP ${resp.status} for ${url}`);\n      }\n      const text = await resp.text();\n      try {\n        return { url, text, data: JSON.parse(text) };\n      } catch (_error) {\n        return { url, text, data: text };\n      }\n    };\n  return (async () => {\n    {\n      const __wbResp = await __wbFetch(\"https://jimeng.jianying.com/ai-tool/generate?type=image&workspace=0\");\n      __wbContextUrl = __wbResp.url;\n      __wbContextDocument = new DOMParser().parseFromString(__wbResp.text, 'text/html');\n      data = __wbContextDocument;\n    }\n    {\n      const document = __wbContextDocument || globalThis.document;\n      const location = new URL(__wbBaseUrl());\n      const window = { document, location };\n      const fetch = (target, options) => globalThis.fetch(__wbResolve(target, __wbBaseUrl()), Object.assign({ credentials: 'include' }, options || {}));\n      data = await (((async () => {\n  const limit = (args.limit);\n  const res = await fetch('/mweb/v1/get_history?aid=513695&device_platform=web&region=cn&da_version=3.3.11&web_version=7.5.0&aigc_features=app_lip_sync', {\n    method: 'POST',\n    credentials: 'include',\n    headers: { 'Content-Type': 'application/json' },\n    body: JSON.stringify({ cursor: '', count: limit, need_page_item: true, need_aigc_data: true, aigc_mode_list: ['workbench'] })\n  });\n  const data = await res.json();\n  const items = data?.data?.history_list || [];\n  return items.slice(0, limit).map(item => {\n    const params = item.aigc_image_params?.text2image_params || {};\n    const images = item.image?.large_images || [];\n    return {\n      prompt: params.prompt || item.common_attr?.title || 'N/A',\n      model: params.model_config?.model_name || 'unknown',\n      status: item.common_attr?.status === 102 ? 'completed' : 'pending',\n      image_url: images[0]?.image_url || '',\n      created_at: new Date((item.common_attr?.create_time || 0) * 1000).toLocaleString('zh-CN'),\n    };\n  });\n})())());\n    }\n    {\n      const source = Array.isArray(data) ? data : (data == null ? [] : [data]);\n      data = source.map((item, index) => ({\n        \"prompt\": item.prompt,\n        \"model\": item.model,\n        \"status\": item.status,\n        \"image_url\": item.image_url,\n        \"created_at\": item.created_at,\n      }));\n    }\n    if (Array.isArray(data)) data = data.slice(0, Number(args.limit) || 0);\n    return data;\n  })();\n}"}]}