别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书

博思AIPPT

字数 2097,阅读大约需 11 分钟

久等了各位!
朋友们苦等的Dify触发器终于上线了!

别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书

前言Dify终于不用写代码让dify工作流定时运行了!
因为Dify 最新版v1.10.0新增一员大将:触发器我先踩个点,帮大家试试看效果😁

别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书
Dify 1.10.0

🎯 本章学习目标在本章中,你将收获以下内容:

  1. 1. 了解什么是触发器?Dify为什么要加触发器?帮你实现哪些自动化操作?支持哪些触发方式?
  2. 2. 掌握【dify+飞书自动化】
  3. 3. 实战演练:每天早上8点自动获取最新AI资讯并写入飞书多维表格
  • • 更多详情:Dify 1.10.0-rc1日志[1]
  • • 更新命令:见文末

Q1.什么是触发器?专业解释:在特定条件或事件发生时自动执行预定义的操作大白话解释:自动做某件事的开关,当满足X条件时就开始做Y动作
比如:

  • • 当室内温度超过30度(X条件)→ 开空调(Y动作)
  • • 每周周五18:00(X条件)→ 写周报(Y动作)

Q2.为什么要加触发器?昨天先展示了一篇[为什么Dify1.10.0要新增触发器](https://mp.weixin.qq.com/s/kpaQWnzygLL46oAmLspm6w),没看过的小伙伴看过来,一句话解释一下:

Dify老版本不能满足触发需求的场景,所以新增了【触发器】。

比如我想定时运行工作流,老版本需要借助外部代码才能做到Q3.触发器有什么用?触发器的作用是将第三方事件转化为 Dify 能接受的入参格式。更多介绍见:Dify 触发器插件[2]Q4.有哪些形式触发?触发器支持以下3种形式

a.WebHook触发器:通过http调用,开始做一件事(运行工作流1号)
b.定时(Schedule)触发器:比如每天8点,获取AI日报(运行工作流2号)
c.插件(Plugins)触发器:jian ting第三方平台(如 Github、Slack、Linear 等),当这些SaaS 平台在指定事件发生时开始(运行工作流3号)

别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书

Q5. 新版本具体新在哪?①新增开始节点类型选择的弹窗:新建工作流,进去就能看到一个弹窗:是普通开始节点,还是触发器开始节点

别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书
新增开始节点类型选择的弹窗

默认提供这两个触发器,插件触发器需要安装

别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书
默认提供两个触发器

②新增”开始“类型节点:旧版Dify 只有”节点“和”工具“两种类型,可以到插件市场查看更多触发器(但我没搜到)

别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书
新增”开始“类型节点

下面我们来用一个案例测试下,【定时】触发器怎么使用吧!1. 案例展示【案例目标】每天早上8点,将最新AI资讯写入飞书多维表格。完整的工作流和写入效果,如下图所示:

别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书

2. 案例实战2.1 搭建工作流

准备工作略长,先放#2.2,熟练的小伙伴可以可以直接搭建,感兴趣的再看 ,有需要的可在交流群中提问

整体工作流由以下5个节点构成:节点1.定时触发器

  1. 1. 开始节点类型:选择触发器
  2. 2. 选择定时触发器
  3. 3. 配置触发器:[频率:每日],[时间:8点]。
  4. 4. 点击确定

    别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书

节点2.API请求

  1. 1. 新增HTTP节点
  2. 2. 手动配置,或导入cURL(见# 2.2.1

    别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书

节点3格式处理

  1. 1. 新增代码节点
  2. 2. 设置输入变量body
  3. 3. 贴入代码

    别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23

importre

defmain(body:str):
# 1.正则把每条新闻的 4 个字段原样抓出来
pattern = re.compile(
r'"ctime"\s*:\s*"(?P.*?)"'
r'.*?"title"\s*:\s*"(?P.*?)"'<br /> r'.*?"description"\s*:\s*"(?P.*?)"'<br /> r'.*?"url"\s*:\s*"(?P.*?)"',<br /> re.S</p> <p> )<br /> # 2.遍历取字段值,按列名组成list<br /> extracted = [<br /> {<br /> "时间": m["ctime"],<br /> "文章标题": m["title"],<br /> "文章描述": m["desc"],<br /> "文章地址": m["url"]<br /> }<br /> forminpattern.finditer(body)<br /> ]<br /> return{"result": extracted}</section> <p></section> <p></code></pre> <p>节点4.转String</p> <ol style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;padding-left: 1.5em;margin-left: 0;color: #3f3f3f" class="list-paddingleft-1"> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>1. 新增<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">模版转换</strong>节点</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>2. 写入:<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">{{ arg1 | tojson}}</code></p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="//www.szxn.com/wp-content/uploads/2025/11/1762380350-20251105220550-690bca3e3cee7.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888"></figcaption></figure> </section> </li> </ol> <p>节点5.新增多条记录</p> <ol style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;padding-left: 1.5em;margin-left: 0;color: #3f3f3f" class="list-paddingleft-1"> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>1. 新增飞书多维表格的<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">新增多条记录</strong>节点</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>2. 选择凭证(见<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px"><a class="wx_topic_link" style="color: #576B95 !important" data-topic="1">#2</a>.2.2</code>— 步骤3)</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>3. 填app_token:[别复制,这里填你的多维表格](见<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px"><a class="wx_topic_link" style="color: #576B95 !important" data-topic="1">#2</a>.2.2</code>—<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">步骤2</strong>的<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">TableToken</code>)</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>4. 填tobel_id:[别复制,这里填你的多维表格](见<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px"><a class="wx_topic_link" style="color: #576B95 !important" data-topic="1">#2</a>.2.2</code>—<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">步骤2</strong><code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">TableId</code>)</p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="//www.szxn.com/wp-content/uploads/2025/11/1762380350-20251105220550-690bca3e4850c.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888"></figcaption></figure> </section> </li> </ol> <p>完整工作流完整工作流如下图所示</p> <ol style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;padding-left: 1.5em;margin-left: 0;color: #3f3f3f" class="list-paddingleft-1"> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>1. 测试时候,将定时器改为下一分钟,测试–>等待写入即可</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>2. 发布成功后,等待你自己的定时,就能自动写入了</p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="//www.szxn.com/wp-content/uploads/2025/11/1762380350-20251105220550-690bca3e57949.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888"></figcaption></figure> </section> </li> </ol> <p>恭喜你完成了 【每日8点的AI资讯系统】🎊2.2 准备工作2.2.1 申请天聚数行API网址:AI资讯<sup>[3]</sup><br /><strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">步骤1</strong>. 登录并申请接口<br /><strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">步骤2</strong>. 复制你的API-KEY<br /><strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">步骤3</strong>. 导入curl,替换你的API-KEY<code style="padding: 0.5em 1em 1em;text-indent: 0;text-align: left;line-height: 1.75;font-family: 'Fira Code', Menlo, Operator Mono, Consolas, Monaco, monospace;font-size: 90%;margin: 0"></p> <section style="align-items:flex-start;width:100%;max-width:100%;padding:0"></p> <section style="text-align:right;padding:8px 0;background:var(--code-bg,transparent)"> <section style="padding:0 10px 0 0;line-height:1.75">1</section> </section> <p></p> <section style="flex:1 1 auto;padding:8px;min-width:0">curl "https://apis.tianapi.com/ai/index?key=YOUR_API_KEY&num=5"</section> <p></section> <p></code></pre> <blockquote style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;font-style: italic;padding: 1em 1em 1em 2em;border-radius: 6px;background: #f7f7f7;margin-bottom: 1em"><p>该接口普通会员每天赠送100次调用额度,足够使用,放心食用</p></blockquote> <p>2.2.2 准备飞书多维表格<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">步骤1</strong>. 在飞书开发者后台<sup>[4]</sup>申请1个应用:<br />开通权限:搜索“多维表格”,都勾选,开通。<br />然后发布应用。<br />复制这两个值:<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">AppID</code>和<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">App secret</code></p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="//www.szxn.com/wp-content/uploads/2025/11/1762380350-20251105220550-690bca3e65178.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888"></figcaption></figure> <p><strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">步骤2</strong>. 在飞书云盘中,新建1个多维表格。<br /><strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">新建如下4列</strong>:时间、文章标题、文章描述和文章地址(均为<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">文本</strong>类型,可按需修改)</p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="//www.szxn.com/wp-content/uploads/2025/11/1762380350-20251105220550-690bca3e71d19.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888">新建飞书多维表格</figcaption></figure> <p>把多维表格的地址,复制浏览器打开,查看<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">多维表格 Token</strong>和<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">多维表格 ID</strong><br />a. 多维表格 Token:<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">base/</code>和<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">?table=</code>之间的那串字符。我的是<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">B5xkbamiea2k8qsiCQ4cLNDundf</code><br />b. 多维表格 ID:<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">?table=</code>和<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">&view=</code>之间的那串字符。我的是<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">tbleEfvRyOoPmP5G</code></p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="//www.szxn.com/wp-content/uploads/2025/11/1762380350-20251105220550-690bca3e7c655.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888">多维表格的Token和ID</figcaption></figure> <p>然后,给多维表格添加应用</p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="//www.szxn.com/wp-content/uploads/2025/11/1762380350-20251105220550-690bca3e866a5.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888"></figcaption></figure> <p><strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">步骤3</strong>. 安装<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">飞书多维表格</strong>插件</p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="//www.szxn.com/wp-content/uploads/2025/11/1762380350-20251105220550-690bca3e95d73.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888">安装 **飞书多维表格** 插件</figcaption></figure> <p>把步骤1的<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">AppID</code>和<code style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 90%;color: #d14;padding: 3px 5px;border-radius: 4px">App secret</code>填入</p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="//www.szxn.com/wp-content/uploads/2025/11/1762380350-20251105220550-690bca3ea1de4.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888">配置凭证</figcaption></figure> <p>3.安装最新版Dify 1.10我试过直接git clone,但不是最新版,建议小伙伴使用下面的指令<code style="padding: 0.5em 1em 1em;text-indent: 0;text-align: left;line-height: 1.75;font-family: 'Fira Code', Menlo, Operator Mono, Consolas, Monaco, monospace;font-size: 90%;margin: 0"></p> <section style="align-items:flex-start;width:100%;max-width:100%;padding:0"></p> <section style="text-align:right;padding:8px 0;background:var(--code-bg,transparent)"> <section style="padding:0 10px 0 0;line-height:1.75">1</section> <section style="padding:0 10px 0 0;line-height:1.75">2</section> <section style="padding:0 10px 0 0;line-height:1.75">3</section> <section style="padding:0 10px 0 0;line-height:1.75">4</section> <section style="padding:0 10px 0 0;line-height:1.75">5</section> <section style="padding:0 10px 0 0;line-height:1.75">6</section> </section> <p></p> <section style="flex:1 1 auto;padding:8px;min-width:0"># 1.指定分支<br />git clone https://github.com/langgenius/dify.git -b1.10.0-rc1</p> <p># 2.启动服务<br />cd dify\docker<br />docker compose up -d</section> <p></section> <p></code></pre> <p>结语📢<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">提示:当前AI资讯系统并非“最终版”哦!</strong>你完全可以根据自己的需求:</p> <ul style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;padding-left: 1.5em;margin-left: 0;color: #3f3f3f" class="list-paddingleft-1"> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>• ✅ 修改触发时间(比如改成中午12点推送)</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>• ✅ 调整内容格式(如Markdown)</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>• ✅ 指定渠道、某主题信息</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>• ✅ 添加更多内容字段(如封面、热度指数等)</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>• ✅ 抓取你关心的内容平台(公众号、小红书、X/Twitter、知乎、新闻网站等)</section> </li> </ul> <p>💡<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">定制属于你的智能资讯助手,才是真正的价值所在!</strong></p> <hr style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;border-style: solid;border-width: 2px 0 0;height: 1px;margin: 2em 0;border: none;background: linear-gradient(to right, rgba(0,0,0,0), rgba(0,0,0,0.1), rgba(0,0,0,0))" />👥<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">加入交流群</strong><br />我会把本案例的资料发在交流群里(微信 &飞书都有),欢迎入群交流,群内不定期分享Dify、智能体和AI相关消息~<br />1️⃣完整工作流<br />2️⃣飞书多维表格详细教程<br />(注:在任一交流群的不用重复加群,进群后 @我 即可领取)</p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="//www.szxn.com/wp-content/uploads/2025/11/1762380350-20251105220550-690bca3eb0bbb.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888"></figcaption></figure> <p>附:n8n 共学群【限时限免】最近在对比 Dify、Coze 和 n8n 的过程中,我越来越意识到:<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">n8n 的生态和组件能力,其实是很多后来者的灵感来源</strong>,包括 今天讲的 Dify新增模块——<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">触发器</strong>。</p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="/images/2025/1106/kqabklz3cho16591_20251106060514.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888"></figcaption></figure> <p>为此,我建了一个<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">n8n 共学交流群</strong>,旨在为 AI 技术爱好者和小白提供一个学习、交流、实操分享的平台。我会在群里不定期分享:</p> <ul style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;padding-left: 1.5em;margin-left: 0;color: #3f3f3f" class="list-paddingleft-1"> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>• n8n 核心功能解析</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>• 工作流搭建实战</section> </li> <li style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 0.5em 8px;color: #3f3f3f"> <section>• 常见问题与避坑指南</section> </li> </ul> <p>📌<strong style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: inherit;font-weight: bold">限时免费开放,🈵 100 人后改为付费加入</strong>,欢迎对智能体、自动化感兴趣的朋友加入,一起从 0 到 1 学习 n8n!</p> <figure style="text-align: left;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 16px;margin: 1.5em 8px;color: #3f3f3f"><img decoding="async" data-src="/images/2025/1106/xcu5quzk5l416592_20251106060514.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"><figcaption style="text-align: center;line-height: 1.75;font-family: -apple-system-font,BlinkMacSystemFont, Helvetica Neue, PingFang SC, Hiragino Sans GB , Microsoft YaHei UI , Microsoft YaHei ,Arial,sans-serif;font-size: 0.8em;color: #888"></figcaption></figure> <p>引用链接<code style="font-size: 90%;opacity: 0.6">[1]</code>Dify 1.10.0-rc1日志:<i>https://github.com/langgenius/dify/releases/tag/1.10.0-rc1</i><br /><code style="font-size: 90%;opacity: 0.6">[2]</code>Dify 触发器插件:<i>https://docs.dify.ai/plugin-dev-zh/0222-trigger-plugin#%E8%A7%A6%E5%8F%91%E5%99%A8%E6%8F%92%E4%BB%B6%E6%98%AF%E4%BB%80%E4%B9%88%EF%BC%9F</i><br /><code style="font-size: 90%;opacity: 0.6">[3]</code>AI资讯:<i>https://www.tianapi.com/apiview/22-1</i><br /><code style="font-size: 90%;opacity: 0.6">[4]</code>飞书开发者后台:<i>https://open.feishu.cn/app?lang=zh-CN</i><br /></section> <p>实践出真知,与君共勉</p> <section data-pm-slice="0 0 []" style="margin-bottom: 0px"></section> <section style="margin-bottom: 0px"></section> <section style="font-size: 16px;margin-bottom: 0px" data-pm-slice="0 0 []"> <section style="text-align: center;margin-top: 10px;line-height: 0"> <section style="vertical-align: middle;line-height: 0;width: 183.927px;height: auto"><img decoding="async" data-src="/images/2025/1106/yo1t353kpfg16593_20251106060514.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"></section> </section> <section style="margin-top: 4px;margin-bottom: 10px;text-align: center"> <section style="background-image: linear-gradient(90deg, rgb(48, 97, 207) 0%, rgb(212, 165, 206) 100%);height: 1px"></section> </section> <section style="text-align: center;justify-content: center;flex-flow: row;margin-top: 10px;margin-bottom: 10px"> <section style="vertical-align: top;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: flex-start"> <section style="line-height: 0"> <section></section> <section></section> <section></section> <section></section> <section></section> <section style="vertical-align: middle;line-height: 0;width: 19px;height: auto"><img decoding="async" data-src="/images/2025/1106/qeg2fphkfwv16594_20251106060514.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"></section> </section> </section> <section style="vertical-align: middle;width: auto;align-self: center;flex: 0 0 auto;min-width: 5%;height: auto"> <section style="width: 100%;flex-flow: column"> <section style="z-index: 1"> <section style="text-align: justify;padding-right: 7px;padding-left: 7px"><strong>点击下方卡片 关注我们</strong></section> </section> </section> <section style="margin-top: -13px"> <section style="width: 100%;height: 16px;vertical-align: top;overflow: hidden;border-radius: 22px"> <section style="text-align: justify"></section> </section> </section> </section> <section style="vertical-align: middle;width: auto;min-width: 5%;flex: 0 0 auto;height: auto;align-self: center"> <section> <section style="line-height: 0"> <section style="vertical-align: middle;line-height: 0;width: 19px;height: auto"><img decoding="async" data-src="/images/2025/1106/vjr22mki5cp16595_20251106060514.png" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t.png" / alt="别再手动运行了!Dify 1.10版「触发器」深度解读,3步实现AI资讯自动写入飞书"></section> </section> </section> </section> </section> </section> <section class="mp_profile_iframe_wrp" style="margin-bottom: 0px"> </div> <div class="post-tags my-3"><i class="iconfont icon-tags mr-2"></i><a href="https://www.szxn.com/aik" class="vc-l-theme btn btn-sm text-height-xs m-1 rounded-pill text-xs" rel="tag" title="查看更多"><i class="iconfont icon-folder mr-1"></i>AI 知识库</a><a href="https://www.szxn.com/aik/jc/hyjc" class="vc-l-theme btn btn-sm text-height-xs m-1 rounded-pill text-xs" rel="tag" title="查看更多"><i class="iconfont icon-folder mr-1"></i>行业教程</a><a href="https://www.szxn.com/tag/ai%e6%97%a9%e9%ab%98%e5%b3%b0" class="vc-l-violet btn btn-sm text-height-xs m-1 rounded-pill text-xs" rel="tag" title="查看更多"># AI早高峰</a></div><div class="text-xs text-muted"><div><span>©</span> 版权声明</div><div class="posts-copyright">文章版权归作者所有,未经允许请勿转载。</div></div> </div> </div> <div class="near-navigation mt-4 py-2"> <div class="nav previous border-right border-color"> <a class="near-permalink" href="https://www.szxn.com/51300.html"> <span class="text-muted">上一篇</span> <h4 class="near-title">阿里味儿的AI山姆,我是一个都不敢点。</h4> </a> </div> <div class="nav next border-left border-color"> <a class="near-permalink" href="https://www.szxn.com/51284.html"> <span class="text-muted">下一篇</span> <h4 class="near-title">国产开源 AI CRM 系统,用它替换了 7 年的 Salesforce。</h4> </a> </div> </div> <h4 class="text-gray text-lg my-4"><i class="site-tag iconfont icon-book icon-lg mr-1" ></i>相关文章</h4><div class="posts-row"><article class="posts-item post-item d-flex style-post-card post-10246 col-2a col-md-4a"> <div class="item-header"> <div class="item-media"> <a class="item-image" href="https://www.szxn.com/10246.html" target="_blank"> <img class="fill-cover lazy unfancybox" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t1.svg" data-src="https://www.szxn.com/wp-content/uploads/2025/05/1747719732-20250520054212-682c16349f3ed.jpg" height="auto" width="auto" alt="方便的ppt自动生成免费ai盘点 2025可靠的ppt自动生成免费ai排行榜"> </a> </div> </div> <div class="item-body d-flex flex-column flex-fill"> <h3 class="item-title line2"> <a href="https://www.szxn.com/10246.html" title="方便的ppt自动生成免费ai盘点 2025可靠的ppt自动生成免费ai排行榜"target="_blank">方便的ppt自动生成免费ai盘点 2025可靠的ppt自动生成免费ai排行榜</a> </h3> <div class="mt-auto"> <div class="item-tags overflow-x-auto no-scrollbar"><a href="https://www.szxn.com/aik/jc/aippt" class="badge vc-l-theme text-ss mr-1" rel="tag" title="查看更多文章"><i class="iconfont icon-folder mr-1"></i>AI PPT</a><a href="https://www.szxn.com/aik/jc" class="badge vc-l-theme text-ss mr-1" rel="tag" title="查看更多文章"><i class="iconfont icon-folder mr-1"></i>AI教程</a><a href="https://www.szxn.com/tag/ai%e5%8a%9e%e5%85%ac%e8%bd%af%e4%bb%b6" class="badge text-ss mr-1" rel="tag" title="查看更多文章"># ai办公软件</a></div> <div class="item-meta d-flex align-items-center flex-fill text-muted text-xs"><div class="meta-left"><a href="https://www.szxn.com/author/225" class="avatar-sm mr-1" target="_blank"><img alt='' src='https://cdn.iocdn.cc/avatar/?s=20&d=mm&r=g' srcset='https://cdn.iocdn.cc/avatar/?s=40&d=mm&r=g 2x' class='avatar avatar-20 photo avatar-default' height='20' width='20' loading='lazy' decoding='async'/></a><span title="2025-10-21 14:17:30" class="meta-time">2周前</span></div><div class="ml-auto meta-right"><span class="meta-view"><i class="iconfont icon-chakan-line"></i>12,996</span><span class="meta-like d-none d-md-inline-block"><i class="iconfont icon-like-line"></i>682</span></div></div> </div> </div> </article><article class="posts-item post-item d-flex style-post-card post-43962 col-2a col-md-4a"> <div class="item-header"> <div class="item-media"> <a class="item-image" href="https://www.szxn.com/43962.html" target="_blank"> <img class="fill-cover lazy unfancybox" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t1.svg" data-src="https://www.szxn.com/wp-content/uploads/2025/10/1760649769-20251016212249-68f162293a654.png" height="auto" width="auto" alt="Sora爆火视频有什么特质?别再纠结画质和水印了"> </a> </div> </div> <div class="item-body d-flex flex-column flex-fill"> <h3 class="item-title line2"> <a href="https://www.szxn.com/43962.html" title="Sora爆火视频有什么特质?别再纠结画质和水印了"target="_blank">Sora爆火视频有什么特质?别再纠结画质和水印了</a> </h3> <div class="mt-auto"> <div class="item-tags overflow-x-auto no-scrollbar"><a href="https://www.szxn.com/aik" class="badge vc-l-theme text-ss mr-1" rel="tag" title="查看更多文章"><i class="iconfont icon-folder mr-1"></i>AI 知识库</a><a href="https://www.szxn.com/aik/jc/hyjc" class="badge vc-l-theme text-ss mr-1" rel="tag" title="查看更多文章"><i class="iconfont icon-folder mr-1"></i>行业教程</a><a href="https://www.szxn.com/tag/k%e5%a7%90%e7%a0%94%e7%a9%b6%e7%a4%be" class="badge text-ss mr-1" rel="tag" title="查看更多文章"># K姐研究社</a></div> <div class="item-meta d-flex align-items-center flex-fill text-muted text-xs"><div class="meta-left"><a href="https://www.szxn.com/author/478" class="avatar-sm mr-1" target="_blank"><img alt='' src='https://cdn.iocdn.cc/avatar/?s=20&d=mm&r=g' srcset='https://cdn.iocdn.cc/avatar/?s=40&d=mm&r=g 2x' class='avatar avatar-20 photo avatar-default' height='20' width='20' loading='lazy' decoding='async'/></a><span title="2025-10-16 10:31:00" class="meta-time">3周前</span></div><div class="ml-auto meta-right"><span class="meta-view"><i class="iconfont icon-chakan-line"></i>1,339</span><span class="meta-like d-none d-md-inline-block"><i class="iconfont icon-like-line"></i>394</span></div></div> </div> </div> </article><article class="posts-item post-item d-flex style-post-card post-21416 col-2a col-md-4a"> <div class="item-header"> <div class="item-media"> <a class="item-image" href="https://www.szxn.com/21416.html" target="_blank"> <img class="fill-cover lazy unfancybox" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t1.svg" data-src="https://www.szxn.com/wp-content/uploads/2025/06/1750828483-20250625051443-685b85c34c05e.png" height="auto" width="auto" alt="即梦AI 【水果】【西瓜】| 用西瓜制作姓氏,附提示词"> </a> </div> </div> <div class="item-body d-flex flex-column flex-fill"> <h3 class="item-title line2"> <a href="https://www.szxn.com/21416.html" title="即梦AI 【水果】【西瓜】| 用西瓜制作姓氏,附提示词"target="_blank">即梦AI 【水果】【西瓜】| 用西瓜制作姓氏,附提示词</a> </h3> <div class="mt-auto"> <div class="item-tags overflow-x-auto no-scrollbar"><a href="https://www.szxn.com/aik" class="badge vc-l-theme text-ss mr-1" rel="tag" title="查看更多文章"><i class="iconfont icon-folder mr-1"></i>AI 知识库</a><a href="https://www.szxn.com/aik/jc/jm" class="badge vc-l-theme text-ss mr-1" rel="tag" title="查看更多文章"><i class="iconfont icon-folder mr-1"></i>即梦AI</a><a href="https://www.szxn.com/tag/ai%e7%bb%98%e8%a7%86%e7%95%8c" class="badge text-ss mr-1" rel="tag" title="查看更多文章"># AI绘视界</a></div> <div class="item-meta d-flex align-items-center flex-fill text-muted text-xs"><div class="meta-left"><a href="https://www.szxn.com/author/290" class="avatar-sm mr-1" target="_blank"><img alt='' src='https://cdn.iocdn.cc/avatar/?s=20&d=mm&r=g' srcset='https://cdn.iocdn.cc/avatar/?s=40&d=mm&r=g 2x' class='avatar avatar-20 photo avatar-default' height='20' width='20' loading='lazy' decoding='async'/></a><span title="2025-06-25 13:16:40" class="meta-time">4个月前</span></div><div class="ml-auto meta-right"><span class="meta-view"><i class="iconfont icon-chakan-line"></i>8,766</span><span class="meta-like d-none d-md-inline-block"><i class="iconfont icon-like-line"></i>224</span></div></div> </div> </div> </article><article class="posts-item post-item d-flex style-post-card post-42356 col-2a col-md-4a"> <div class="item-header"> <div class="item-media"> <a class="item-image" href="https://www.szxn.com/42356.html" target="_blank"> <img class="fill-cover lazy unfancybox" src="https://www.szxn.com/wp-content/themes/onenav/assets/images/t1.svg" data-src="https://www.szxn.com/wp-content/uploads/2025/10/1760133675-20251010220115-68e9822baf6c2.png" height="auto" width="auto" alt="别再乱堆提示词了!这份《Sora 2 提示词指南》,才是真正的Sora2使用手册!"> </a> </div> </div> <div class="item-body d-flex flex-column flex-fill"> <h3 class="item-title line2"> <a href="https://www.szxn.com/42356.html" title="别再乱堆提示词了!这份《Sora 2 提示词指南》,才是真正的Sora2使用手册!"target="_blank">别再乱堆提示词了!这份《Sora 2 提示词指南》,才是真正的Sora2使用手册!</a> </h3> <div class="mt-auto"> <div class="item-tags overflow-x-auto no-scrollbar"><a href="https://www.szxn.com/aik" class="badge vc-l-theme text-ss mr-1" rel="tag" title="查看更多文章"><i class="iconfont icon-folder mr-1"></i>AI 知识库</a><a href="https://www.szxn.com/aik/jc/hyjc" class="badge vc-l-theme text-ss mr-1" rel="tag" title="查看更多文章"><i class="iconfont icon-folder mr-1"></i>行业教程</a><a href="https://www.szxn.com/tag/ai%e6%8a%80%e6%9c%af%e7%a0%94%e4%b9%a0%e7%a4%be" class="badge text-ss mr-1" rel="tag" title="查看更多文章"># AI技术研习社</a></div> <div class="item-meta d-flex align-items-center flex-fill text-muted text-xs"><div class="meta-left"><a href="https://www.szxn.com/author/502" class="avatar-sm mr-1" target="_blank"><img alt='' src='https://cdn.iocdn.cc/avatar/?s=20&d=mm&r=g' srcset='https://cdn.iocdn.cc/avatar/?s=40&d=mm&r=g 2x' class='avatar avatar-20 photo avatar-default' height='20' width='20' loading='lazy' decoding='async'/></a><span title="2025-10-10 08:33:00" class="meta-time">4周前</span></div><div class="ml-auto meta-right"><span class="meta-view"><i class="iconfont icon-chakan-line"></i>2,700</span><span class="meta-like d-none d-md-inline-block"><i class="iconfont icon-like-line"></i>18</span></div></div> </div> </div> </article></div> </div> </div> <div class="sidebar sidebar-tools d-none d-lg-block"> <div id="add-widgets" class="card widget_text bk"> <div class="card-header"> <span><i class="iconfont icon-category mr-2"></i>添加小工具</span> </div> <div class="card-body text-sm"> <a href="https://www.szxn.com/wp-admin/widgets.php" target="_blank">点此为“正文侧边栏”添加小工具</a> </div> </div> </div> </div> </main> <footer class="main-footer footer-stick"> <div class="switch-container container-footer container"> <div class="footer row pt-5 text-center text-md-left"> <div class="col-12 col-md-4 mb-4 mb-md-0"><a href="https://www.szxn.com" class="logo-expanded footer-logo"><img src="https://www.szxn.com/wp-content/uploads/2025/04/1744596188-ailogo.png" height="40" switch-src="https://www.szxn.com/wp-content/uploads/2025/04/1744596188-ailogo.png" is-dark="false" alt="AI 智能体"></a><div class="text-sm mt-4">本平台内容均来源于投稿和网络,部分内容由 AI 生成,请仔细甄别。本站对其实际跳转后内容不负任何责任。收录时内容正常,但不保证内容长期真实完整。如无意侵犯您的权益,请联系本站,我们将及时处理。</div></div> <div class="col-12 col-md-5 my-4 my-md-0"> </div> <div class="col-12 col-md-3 text-md-right mb-4 mb-md-0"><div class="footer-mini-img text-center" data-toggle="tooltip" title="扫码关注公众号"><div class="bg-l br-md p-1"><img class=" " src="https://www.szxn.com/wp-content/uploads/2025/05/1747710658-szms.jpg" alt="扫码关注公众号AI 智能体"></div><span class="text-muted text-xs mt-2">扫码关注公众号</span></div><div class="footer-mini-img text-center" data-toggle="tooltip" title="扫码加微信好友"><div class="bg-l br-md p-1"><img class=" " src="https://www.szxn.com/wp-content/uploads/2025/04/1744272267-wechat_qrcode.jpg" alt="扫码加微信好友AI 智能体"></div><span class="text-muted text-xs mt-2">扫码加微信好友</span></div></div> <div class="footer-copyright m-3 text-xs"> Copyright © 2025 <a href="https://www.szxn.com" title="AI 智能体" class="" rel="home">AI 智能体</a> <a href="https://beian.miit.gov.cn/" target="_blank" class="" rel="link noopener">粤ICP备2025399194号-1</a> <script> var _hmt = _hmt || []; (function() { var hm = document.createElement("script"); hm.src = "https://hm.baidu.com/hm.js?7d5c274f1c30c046838120c8e993544b"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(hm, s); })(); </script> </div> </div> </div> </footer><script type="speculationrules"> {"prefetch":[{"source":"document","where":{"and":[{"href_matches":"\/*"},{"not":{"href_matches":["\/wp-*.php","\/wp-admin\/*","\/wp-content\/uploads\/*","\/wp-content\/*","\/wp-content\/plugins\/*","\/wp-content\/themes\/onenav\/*","\/*\\?(.+)"]}},{"not":{"selector_matches":"a[rel~=\"nofollow\"]"}},{"not":{"selector_matches":".no-prefetch, .no-prefetch a"}}]},"eagerness":"conservative"}]} </script> <!-- AI问答系统浮动聊天机器人 --> <div id="ai-floating-chatbot" class="ai-floating-chatbot"> <!-- 聊天窗口 --> <div id="ai-chat-window" class="ai-chat-window" style="display: none;"> <div class="ai-chat-header" id="ai-chat-header"> <div class="ai-chat-title"> <span class="ai-chat-avatar">🤖</span> <span class="ai-chat-name">AI智能助手</span> </div> <div class="ai-chat-actions"> <button class="ai-chat-clear-history" title="清空对话">🗑️</button> <button class="ai-chat-minimize" title="最小化">−</button> <button class="ai-chat-close" title="关闭">×</button> </div> </div> <div class="ai-chat-messages" id="ai-chat-messages"> </div> <!-- 调整高度手柄 --> <div class="ai-resize-handle" id="ai-resize-handle"></div> <div class="ai-chat-input-container"> <div class="ai-chat-input-wrapper"> <textarea class="ai-chat-input" placeholder="请输入您的问题..." rows="2" ></textarea> </div> <div class="ai-chat-buttons-wrapper"> <button class="ai-chat-send">发送</button> <button class="ai-chat-clear">清除</button> </div> <div class="ai-chat-actions"> <button class="ai-chat-action-btn" data-action="ai-dialog" data-type="ai-dialog"> 🎯 站长留言 </button> <button class="ai-chat-action-btn" data-action="suggest" data-type="question"> 💡 帮我提问 </button> <button class="ai-chat-action-btn" data-action="suggest" data-type="explain"> 📚 解释概念 </button> <button class="ai-chat-action-btn" data-action="suggest" data-type="summary"> 📝 总结内容 </button> </div> <div class="ai-disclaimer-footer"> 本回答由 AI 生成,内容仅供参考,请仔细甄别。 </div> </div> </div> <!-- 浮动按钮 - 增加随机文字显示 --> <div id="ai-chat-toggle" class="ai-chat-toggle"> <div class="ai-floating-text" id="ai-floating-text" style="display: none;"> 点击图标与AI对话 </div> <div class="ai-chat-icon">🤖</div> <div class="ai-chat-tooltip">点击图标给AI发送信息</div> <div class="ai-chat-badge" style="display: none;">1</div> </div> </div> <style> /* 浮动聊天机器人样式 */ .ai-floating-chatbot { position: fixed; z-index: 999999; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; } /* 聊天窗口样式 */ .ai-chat-window { width: 380px; height: 500px; background: white; border-radius: 12px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2); display: flex; flex-direction: column; overflow: hidden; animation: slideInUp 0.3s ease; position: absolute; resize: vertical; min-height: 400px; max-height: 800px; top: 20px; left: 20px; } @keyframes slideInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } @keyframes slideOutDown { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(20px); } } .ai-chat-window.hidden { animation: slideOutDown 0.3s ease; } .ai-chat-header { background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 12px 16px; display: flex; justify-content: space-between; align-items: center; border-bottom: 1px solid rgba(255, 255, 255, 0.2); cursor: move; user-select: none; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; } .ai-chat-title { display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: 14px; } .ai-chat-avatar { font-size: 16px; } .ai-chat-actions { display: flex; gap: 4px; } .ai-chat-clear-history, .ai-chat-minimize, .ai-chat-close { background: rgba(255, 255, 255, 0.2); border: none; color: white; width: 24px; height: 24px; border-radius: 50%; cursor: pointer; font-size: 12px; display: flex; align-items: center; justify-content: center; transition: all 0.3s ease; -webkit-tap-highlight-color: transparent; } .ai-chat-clear-history:hover, .ai-chat-minimize:hover, .ai-chat-close:hover { background: rgba(255, 255, 255, 0.3); transform: scale(1.1); } .ai-chat-messages { flex: 1; overflow-y: auto; padding: 12px; background: #f8f9fa; display: flex; flex-direction: column; gap: 12px; min-height: 200px; -webkit-overflow-scrolling: touch; } .ai-chat-messages .ai-message { display: flex; animation: fadeIn 0.3s ease; } .ai-chat-messages .ai-message.user { flex-direction: row-reverse; } .ai-chat-messages .ai-message-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; } .ai-chat-messages .ai-message.user .ai-message-avatar { background: #667eea; margin-left: 8px; } .ai-chat-messages .ai-message.assistant .ai-message-avatar { background: #28a745; margin-right: 8px; } .ai-chat-messages .ai-message-content { flex: 1; max-width: 80%; } .ai-chat-messages .ai-message.user .ai-message-content { text-align: right; } .ai-chat-messages .ai-message-text { background: white; padding: 8px 12px; border-radius: 12px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); line-height: 1.4; word-wrap: break-word; font-size: 13px; word-break: break-word; } .ai-chat-messages .ai-message.user .ai-message-text { background: #667eea; color: white; } .ai-chat-messages .ai-message-time { font-size: 11px; color: #6c757d; margin-top: 4px; } /* 调整高度手柄 */ .ai-resize-handle { height: 6px; background: #e9ecef; cursor: ns-resize; border-top: 1px solid #dee2e6; border-bottom: 1px solid #dee2e6; position: relative; transition: background-color 0.3s ease; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } .ai-resize-handle:hover { background: #667eea; } .ai-resize-handle::after { content: ''; position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 20px; height: 2px; background: #6c757d; border-radius: 1px; } .ai-resize-handle:hover::after { background: white; } .ai-chat-input-container { border-top: 1px solid #e9ecef; padding: 12px; background: white; } .ai-chat-input-wrapper { margin-bottom: 8px; } .ai-chat-input { width: 100%; border: 1px solid #e9ecef; border-radius: 8px; padding: 8px 12px; resize: vertical; font-family: inherit; font-size: 13px; transition: border-color 0.3s ease; box-sizing: border-box; min-height: 40px; max-height: 80px; -webkit-appearance: none; -moz-appearance: none; appearance: none; } .ai-chat-input:focus { outline: none; border-color: #667eea; } .ai-chat-buttons-wrapper { display: flex; justify-content: center; gap: 8px; margin-bottom: 8px; } .ai-chat-send { background: #667eea; color: white; border: none; border-radius: 6px; padding: 6px 16px; cursor: pointer; font-weight: 600; transition: all 0.3s ease; min-width: 60px; font-size: 12px; -webkit-tap-highlight-color: transparent; } .ai-chat-send:hover:not(:disabled) { background: #5a6fd8; transform: translateY(-1px); } .ai-chat-send:disabled { background: #6c757d; cursor: not-allowed; } .ai-chat-clear { background: #6c757d; color: white; border: none; border-radius: 6px; padding: 6px 16px; cursor: pointer; font-weight: 600; transition: all 0.3s ease; min-width: 60px; font-size: 12px; -webkit-tap-highlight-color: transparent; } .ai-chat-clear:hover { background: #5a6268; transform: translateY(-1px); } .ai-chat-actions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-bottom: 8px; } .ai-chat-action-btn { background: #f8f9fa; border: 1px solid #dee2e6; border-radius: 14px; padding: 4px 10px; font-size: 11px; cursor: pointer; transition: all 0.3s ease; color: #495057; -webkit-tap-highlight-color: transparent; white-space: nowrap; } .ai-chat-action-btn:hover { background: #e9ecef; transform: translateY(-1px); } .ai-chat-action-btn[data-type="ai-dialog"] { background: linear-gradient(135deg, #ff6b6b 0%, #ee5a24 100%); color: white; border-color: #ff6b6b; } .ai-chat-action-btn[data-type="ai-dialog"]:hover { background: linear-gradient(135deg, #ff5252 0%, #d63031 100%); } .ai-disclaimer-footer { font-size: 10px; color: #999; font-style: italic; text-align: center; line-height: 1.3; padding: 6px 0 0 0; border-top: 1px solid #f0f0f0; margin-top: 6px; } /* 浮动按钮样式 */ .ai-chat-toggle { display: flex; align-items: center; justify-content: center; cursor: pointer; transition: all 0.3s ease; position: fixed; -webkit-tap-highlight-color: transparent; touch-action: manipulation; background: transparent !important; box-shadow: none !important; width: auto; height: auto; border-radius: 0; z-index: 1000000; flex-direction: column; } .ai-chat-icon { font-size: 68px; filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3)); transition: all 0.3s ease; } .ai-chat-toggle:hover .ai-chat-icon { filter: drop-shadow(0 6px 12px rgba(0, 0, 0, 0.4)); transform: scale(1.1); } /* 浮动文字样式 */ .ai-floating-text { position: absolute; top: -35px; left: 50%; transform: translateX(-50%); background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4); z-index: 1000001; animation: floatText 3s ease-in-out; opacity: 0; } @keyframes floatText { 0% { opacity: 0; transform: translateX(-50%) translateY(10px); } 20% { opacity: 1; transform: translateX(-50%) translateY(0); } 80% { opacity: 1; transform: translateX(-50%) translateY(0); } 100% { opacity: 0; transform: translateX(-50%) translateY(-10px); } } .ai-chat-tooltip { position: absolute; top: 100%; /* 改为在图标下方 */ left: 50%; /* 水平居中 */ transform: translateX(-50%); /* 水平居中 */ margin-top: 8px; /* 与图标的间距 */ background: rgba(0, 0, 0, 0.8); color: white; padding: 6px 12px; border-radius: 6px; font-size: 12px; white-space: nowrap; animation: fadeIn 0.3s ease; opacity: 0; pointer-events: none; transition: opacity 0.3s ease; } .ai-chat-toggle:hover .ai-chat-tooltip { opacity: 1; } .ai-chat-badge { position: absolute; top: -5px; right: -5px; background: #ff4757; color: white; border-radius: 50%; width: 20px; height: 20px; font-size: 11px; display: flex; align-items: center; justify-content: center; font-weight: bold; animation: bounce 1s infinite; } @keyframes bounce { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.1); } } /* 加载状态 */ .ai-loading-message { display: flex; animation: fadeIn 0.3s ease; } .ai-loading-avatar { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 14px; flex-shrink: 0; background: #28a745; margin-right: 8px; } .ai-loading-content { flex: 1; max-width: 80%; } .ai-loading-text { background: white; padding: 8px 12px; border-radius: 12px; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1); line-height: 1.4; display: flex; align-items: center; gap: 8px; color: #6c757d; font-size: 13px; } .ai-loading-spinner { width: 12px; height: 12px; border: 2px solid #e9ecef; border-top: 2px solid #667eea; border-radius: 50%; animation: spin 1s linear infinite; } @keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } /* 响应式设计 - 移动端优化 */ @media (max-width: 768px) { .ai-floating-chatbot { position: fixed !important; z-index: 999999; } .ai-chat-window { width: calc(100vw - 40px) !important; height: 70vh !important; min-height: 500px; max-height: 80vh; top: 20px !important; left: 20px !important; right: 20px !important; bottom: auto !important; transform: none !important; position: fixed !important; border-radius: 16px; } .ai-chat-toggle { width: auto; height: auto; } .ai-chat-icon { font-size: 58px; } .ai-floating-text { top: -30px; font-size: 11px; padding: 5px 10px; } .ai-chat-tooltip { display: none; } .ai-chat-messages .ai-message-content { max-width: 75%; } .ai-chat-actions { gap: 8px; padding: 0 10px; } .ai-chat-action-btn { font-size: 12px; padding: 8px 12px; flex: 1; min-width: 0; text-align: center; } .ai-chat-header { padding: 10px 15px; } /* 移动端隐藏最小化按钮 */ .ai-chat-minimize { display: none !important; } /* 移动端按钮变大 */ .ai-chat-clear-history, .ai-chat-close { width: 32px !important; height: 32px !important; font-size: 14px !important; } .ai-chat-input-container { padding: 15px; } .ai-chat-input { font-size: 16px; min-height: 50px; } .ai-chat-buttons-wrapper { gap: 12px; margin-bottom: 12px; } .ai-chat-send, .ai-chat-clear { padding: 10px 20px; font-size: 14px; flex: 1; } .ai-resize-handle { height: 8px; } } @media (max-width: 480px) { .ai-chat-window { width: calc(100vw - 30px) !important; height: 80vh !important; min-height: 610px; top: 15px !important; left: 15px !important; right: 15px !important; } .ai-chat-icon { font-size: 48px; } .ai-floating-text { top: -25px; font-size: 10px; padding: 4px 8px; } .ai-chat-messages .ai-message-content { max-width: 70%; } .ai-chat-messages .ai-message-avatar { width: 28px; height: 28px; font-size: 12px; } .ai-chat-messages .ai-message-text { font-size: 14px; padding: 10px 14px; } .ai-chat-actions { flex-direction: row; flex-wrap: wrap; gap: 6px; } .ai-chat-action-btn { font-size: 11px; padding: 6px 10px; flex: 0 0 calc(50% - 3px); } .ai-chat-buttons-wrapper { flex-direction: row; } .ai-chat-send, .ai-chat-clear { width: auto; padding: 10px 16px; font-size: 13px; } .ai-disclaimer-footer { font-size: 11px; padding: 8px 0 0 0; } } /* 防止iOS Safari的点击延迟 */ .ai-chat-toggle, .ai-chat-action-btn, .ai-chat-send, .ai-chat-clear, .ai-chat-clear-history, .ai-chat-minimize, .ai-chat-close { cursor: pointer; -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } /* 防止移动端缩放 */ .ai-chat-input { font-size: 16px; /* 防止iOS缩放 */ } /* 移动端拖拽优化 */ @media (hover: none) and (pointer: coarse) { .ai-resize-handle { height: 12px; /* 在触摸设备上增加可触摸区域 */ } .ai-chat-header { cursor: default; } .ai-chat-toggle:hover { transform: none; } .ai-chat-action-btn:hover, .ai-chat-send:hover, .ai-chat-clear:hover { transform: none; } } /* 拖拽时的样式 - 优化流畅度 */ .ai-chat-window.dragging { transition: none !important; opacity: 0.95; box-shadow: 0 15px 40px rgba(0, 0, 0, 0.3); z-index: 1000000; } .ai-chat-header.dragging { cursor: grabbing !important; background: linear-gradient(135deg, #5a6fd8 0%, #6a4890 100%); } /* 优化拖拽性能 */ .ai-chat-window { will-change: transform; backface-visibility: hidden; -webkit-backface-visibility: hidden; transform: translate3d(0, 0, 0); -webkit-transform: translate3d(0, 0, 0); } /* 随机移动动画 */ @keyframes float { 0%, 100% { transform: translate(0, 0) rotate(0deg); } 25% { transform: translate(5px, -8px) rotate(2deg); } 50% { transform: translate(-3px, 6px) rotate(-1deg); } 75% { transform: translate(4px, -7px) rotate(1deg); } } .ai-chat-toggle { animation: float 6s ease-in-out infinite; } .ai-chat-toggle.paused { animation-play-state: paused; } </style> <script> jQuery(document).ready(function($) { const chatbot = $('#ai-floating-chatbot'); const chatWindow = $('#ai-chat-window'); const chatHeader = $('#ai-chat-header'); const messagesContainer = $('#ai-chat-messages'); const resizeHandle = $('#ai-resize-handle'); const chatToggle = $('#ai-chat-toggle'); const floatingText = $('#ai-floating-text'); const input = chatWindow.find('.ai-chat-input'); const sendBtn = chatWindow.find('.ai-chat-send'); const clearBtn = chatWindow.find('.ai-chat-clear'); const clearHistoryBtn = chatWindow.find('.ai-chat-clear-history'); const minimizeBtn = chatWindow.find('.ai-chat-minimize'); const closeBtn = chatWindow.find('.ai-chat-close'); const badge = chatToggle.find('.ai-chat-badge'); // 检查是否在首页 function isHomePage() { return window.location.pathname === '/' || window.location.pathname === '/index.php' || window.location.pathname === 'https://www.szxn.com' || document.body.classList.contains('home'); } // 如果没有在首页,隐藏聊天机器人 if (!isHomePage()) { chatbot.hide(); return; } // AI赋能教育教学问题库 const aiEducationQuestions = [ "AI如何帮助教师个性化教学?", ]; let isChatOpen = false; let unreadCount = 0; let isDragging = false; let isResizing = false; let dragOffset = { x: 0, y: 0 }; let startHeight = 0; let startY = 0; let closeClickHandler = null; let isMobile = window.innerWidth <= 768; let moveInterval = null; let textInterval = null; let isHovering = false; // 初始化欢迎消息 if (messagesContainer.children().length === 0) { addMessage('您好!我是AI助手,有什么可以帮您的吗?', 'assistant'); } // 移动端滚动隐藏功能 function initScrollHide() { if (!isMobile) return; let scrollTimer; let isScrolling = false; $(window).on('scroll', function() { if (!isChatOpen) { isScrolling = true; chatToggle.stop().animate({opacity: 0}, 50); clearTimeout(scrollTimer); scrollTimer = setTimeout(function() { isScrolling = false; if (!isChatOpen) { chatToggle.stop().animate({opacity: 1}, 100); } }, 1000); } }); } function scrollToBottom() { messagesContainer.scrollTop(messagesContainer[0].scrollHeight); } function addMessage(content, type, isTemp = false) { const timestamp = new Date().toLocaleTimeString('zh-CN', { hour: '2-digit', minute: '2-digit' }); const messageId = isTemp ? 'temp-' + Date.now() : ''; const messageHtml = ` <div class="ai-message ${type}" ${messageId ? 'id="' + messageId + '"' : ''}> <div class="ai-message-avatar"> <span>${type === 'user' ? '👤' : '🤖'}</span> </div> <div class="ai-message-content"> <div class="ai-message-text">${content.replace(/\n/g, '<br>')}</div> <div class="ai-message-time">${timestamp}</div> </div> </div> `; messagesContainer.append(messageHtml); scrollToBottom(); if (!isChatOpen && type === 'assistant' && !isTemp) { unreadCount++; updateBadge(); } return messageId; } function addLoadingMessage() { const loadingHtml = ` <div class="ai-loading-message" id="ai-loading-message"> <div class="ai-loading-avatar"> <span>🤖</span> </div> <div class="ai-loading-content"> <div class="ai-loading-text"> <div class="ai-loading-spinner"></div> <span>AI正在思考中...</span> </div> </div> </div> `; messagesContainer.append(loadingHtml); scrollToBottom(); return 'ai-loading-message'; } function removeLoadingMessage() { $('#ai-loading-message').remove(); } function setLoading(state) { if (state) { sendBtn.prop('disabled', true); input.prop('disabled', true); } else { sendBtn.prop('disabled', false); input.prop('disabled', false); } } function updateBadge() { if (unreadCount > 0) { badge.text(unreadCount).show(); } else { badge.hide(); } } // 计算居中位置 function getCenteredPosition() { const windowWidth = $(window).width(); const windowHeight = $(window).height(); const chatWidth = 380; const chatHeight = 500; const left = (windowWidth - chatWidth) / 2; const top = (windowHeight - chatHeight) / 2; return { left: Math.max(20, left), top: Math.max(20, top) }; } // 随机移动函数 - 保持原有逻辑 function startRandomMovement() { if (moveInterval) { clearInterval(moveInterval); } // 初始随机位置 const initialX = Math.random() * ($(window).width() - 100); const initialY = Math.random() * ($(window).height() - 100); chatToggle.css({ left: initialX + 'px', top: initialY + 'px' }); moveInterval = setInterval(() => { if (isChatOpen || isHovering) { return; } const windowWidth = $(window).width() - 100; const windowHeight = $(window).height() - 100; const randomX = Math.floor(Math.random() * windowWidth); const randomY = Math.floor(Math.random() * windowHeight); chatToggle.animate({ left: randomX + 'px', top: randomY + 'px' }, 3000, 'linear'); }, 4000); } // 随机显示浮动文字 - 新增功能 function startRandomTextDisplay() { if (textInterval) { clearInterval(textInterval); } if (floatingText.length === 0) return; // 为每个用户生成不同的随机间隔时间(5-15秒) const userHash = Math.floor(Math.random() * 1000); const baseInterval = 5000 + (userHash % 10000); textInterval = setInterval(() => { if (isChatOpen || isHovering) return; // 显示浮动文字 floatingText.show().css('animation', 'none'); setTimeout(() => { floatingText.css('animation', 'floatText 3s ease-in-out'); }, 10); // 3秒后隐藏(动画持续时间) setTimeout(() => { floatingText.hide(); }, 3000); }, baseInterval); } function openChat() { if (!isChatOpen) { console.log('Opening chat window...'); // 停止随机移动 if (moveInterval) { clearInterval(moveInterval); moveInterval = null; } // 移动端滚动时确保图标可见 if (isMobile) { chatToggle.stop().animate({opacity: 1}, 200); } // 确保聊天窗口可见且正确设置位置 chatWindow.css({ position: 'fixed', display: 'flex', opacity: '1', zIndex: '1000001' }); // 设置聊天窗口在屏幕正中间 const centeredPosition = getCenteredPosition(); chatWindow.css({ left: centeredPosition.left + 'px', top: centeredPosition.top + 'px', right: 'auto', bottom: 'auto' }); // 设置输入框提示文字 input.attr('placeholder', '给AI发送信息……'); // 显示聊天窗口 chatWindow.show().removeClass('hidden'); isChatOpen = true; unreadCount = 0; updateBadge(); // 恢复保存的高度 const savedHeight = localStorage.getItem('ai_chat_window_height'); if (savedHeight) { chatWindow.height(parseInt(savedHeight)); } // 移动端隐藏最小化按钮 if (isMobile) { minimizeBtn.hide(); } else { minimizeBtn.show(); } // 添加外部点击关闭监听 setupCloseOnOutsideClick(); // 聚焦输入框 setTimeout(() => { input.focus(); }, 100); console.log('Chat window opened successfully at center position'); } } function closeChat() { if (isChatOpen) { console.log('Closing chat window...'); chatWindow.addClass('hidden'); setTimeout(() => { chatWindow.hide(); isChatOpen = false; removeCloseOnOutsideClick(); if (!isHovering) { startRandomMovement(); } console.log('Chat window closed successfully'); }, 300); } } function setupCloseOnOutsideClick() { removeCloseOnOutsideClick(); closeClickHandler = function(e) { const $target = $(e.target); const isInsideChat = $target.closest('#ai-chat-window').length > 0; const isInsideToggle = $target.closest('#ai-chat-toggle').length > 0; if (!isInsideChat && !isInsideToggle) { closeChat(); } }; setTimeout(() => { $(document).on('click', closeClickHandler); }, 0); } function removeCloseOnOutsideClick() { if (closeClickHandler) { $(document).off('click', closeClickHandler); closeClickHandler = null; } } function sendMessage() { const message = input.val().trim(); if (!message) return; input.val(''); addMessage(message, 'user'); const loadingId = addLoadingMessage(); setLoading(true); $.ajax({ url: 'https://www.szxn.com/wp-admin/admin-ajax.php', type: 'POST', data: { action: 'ai_ask_question', question: message, type: 'chat', security: '8ea271b559' }, success: function(response) { removeLoadingMessage(); setLoading(false); if (response.success && response.data) { addMessage(response.data.answer, 'assistant'); } else { const errorMsg = response.data && response.data.error ? response.data.error : '抱歉,发生了错误,请稍后重试。'; addMessage(errorMsg, 'assistant'); } }, error: function() { removeLoadingMessage(); setLoading(false); addMessage('网络错误,请检查您的网络连接后重试。', 'assistant'); } }); } // 修复点击事件 function initChatToggleEvents() { chatToggle.off('click'); chatToggle.on('click', function(e) { console.log('Chat toggle clicked - event triggered'); e.preventDefault(); e.stopPropagation(); if (isChatOpen) { closeChat(); } else { openChat(); } return false; }); chatToggle.on('touchstart', function(e) { console.log('Chat toggle touched - event triggered'); e.preventDefault(); e.stopPropagation(); if (isChatOpen) { closeChat(); } else { openChat(); } return false; }); } // 防止聊天窗口内的点击事件冒泡 chatWindow.on('click', function(e) { e.stopPropagation(); }); // 鼠标悬停事件 chatToggle.on('mouseenter', function() { isHovering = true; chatToggle.addClass('paused'); chatToggle.stop(true); if (moveInterval) { clearInterval(moveInterval); moveInterval = null; } }); chatToggle.on('mouseleave', function() { isHovering = false; chatToggle.removeClass('paused'); if (!isChatOpen && !isHovering) { startRandomMovement(); } }); sendBtn.on('click', sendMessage); clearBtn.on('click', function() { input.val(''); input.focus(); }); clearHistoryBtn.on('click', function() { if (confirm('确定要清空对话历史吗?')) { $.ajax({ url: 'https://www.szxn.com/wp-admin/admin-ajax.php', type: 'POST', data: { action: 'ai_clear_history', type: 'qa', security: '8ea271b559' }, success: function() { messagesContainer.empty(); addMessage('您好!我是AI助手,有什么可以帮您的吗?', 'assistant'); }, error: function() { alert('清空历史记录失败,请重试'); } }); } }); minimizeBtn.on('click', function(e) { e.stopPropagation(); closeChat(); }); closeBtn.on('click', function(e) { e.stopPropagation(); closeChat(); }); input.on('keydown', function(e) { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault(); sendMessage(); } }); // 快捷操作按钮 $('.ai-chat-action-btn').on('click', function() { const action = $(this).data('action'); const type = $(this).data('type'); if (action === 'suggest') { let suggestion = ''; switch (type) { case 'question': suggestion = '请帮我生成一些关于这个主题的问题:'; break; case 'explain': suggestion = '请解释这个概念:'; break; case 'summary': suggestion = '请总结以下内容:'; break; } input.val(suggestion); input.focus(); } else if (action === 'ai-dialog') { input.val(''); input.attr('placeholder', '欢迎给站长留言:'); input.focus(); } }); // 拖拽功能 function startDrag(e) { if ($(e.target).is('button') || $(e.target).closest('button').length > 0) { return; } e.preventDefault(); e.stopPropagation(); isDragging = true; const clientX = e.type.includes('touch') ? e.originalEvent.touches[0].clientX : e.clientX; const clientY = e.type.includes('touch') ? e.originalEvent.touches[0].clientY : e.clientY; const windowRect = chatWindow[0].getBoundingClientRect(); dragOffset.x = clientX - windowRect.left; dragOffset.y = clientY - windowRect.top; chatWindow.addClass('dragging'); chatHeader.addClass('dragging'); chatWindow.css({ 'transition': 'none' }); $('body').css('user-select', 'none'); } function doDrag(e) { if (!isDragging) return; e.preventDefault(); e.stopPropagation(); const clientX = e.type.includes('touch') ? e.originalEvent.touches[0].clientX : e.clientX; const clientY = e.type.includes('touch') ? e.originalEvent.touches[0].clientY : e.clientY; if (!clientX || !clientY) return; const newX = clientX - dragOffset.x; const newY = clientY - dragOffset.y; const maxX = window.innerWidth - chatWindow.outerWidth(); const maxY = window.innerHeight - chatWindow.outerHeight(); const boundedX = Math.max(0, Math.min(newX, maxX)); const boundedY = Math.max(0, Math.min(newY, maxY)); chatWindow.css({ 'left': boundedX + 'px', 'top': boundedY + 'px', 'right': 'auto', 'bottom': 'auto' }); } function stopDrag() { if (isDragging) { isDragging = false; chatWindow.removeClass('dragging'); chatHeader.removeClass('dragging'); chatWindow.css('transition', ''); $('body').css('user-select', ''); localStorage.setItem('ai_chat_window_left', chatWindow.css('left')); localStorage.setItem('ai_chat_window_top', chatWindow.css('top')); } } // 绑定拖拽事件 chatHeader.on('mousedown', startDrag); chatHeader.on('touchstart', startDrag, { passive: false }); $(document).on('mousemove', doDrag); $(document).on('touchmove', doDrag, { passive: false }); $(document).on('mouseup', stopDrag); $(document).on('touchend', stopDrag); // 窗口调整大小功能 resizeHandle.on('mousedown touchstart', function(e) { e.preventDefault(); isResizing = true; startHeight = chatWindow.height(); if (e.type === 'mousedown') { startY = e.clientY; } else { const touch = e.originalEvent.touches[0]; startY = touch.clientY; } chatWindow.css('transition', 'none'); }); $(document).on('mousemove touchmove', function(e) { if (!isResizing) return; e.preventDefault(); let clientY; if (e.type === 'mousemove') { clientY = e.clientY; } else { const touch = e.originalEvent.touches[0]; clientY = touch.clientY; } const deltaY = startY - clientY; let newHeight = startHeight + deltaY; newHeight = Math.max(400, Math.min(800, newHeight)); chatWindow.height(newHeight); }); $(document).on('mouseup touchend', function() { if (isResizing) { isResizing = false; chatWindow.css('transition', ''); localStorage.setItem('ai_chat_window_height', chatWindow.height()); } }); // 初始化恢复保存的位置 const savedLeft = localStorage.getItem('ai_chat_window_left'); const savedTop = localStorage.getItem('ai_chat_window_top'); if (savedLeft && savedTop && !isMobile) { chatWindow.css({ left: savedLeft, top: savedTop, right: 'auto', bottom: 'auto' }); } // 防止移动端输入框获得焦点时页面滚动 input.on('focus', function() { if (isMobile) { setTimeout(() => { const rect = chatWindow[0].getBoundingClientRect(); if (rect.bottom > window.innerHeight) { chatWindow[0].scrollIntoView({ behavior: 'smooth', block: 'end' }); } }, 100); } }); // 处理移动端的触摸事件 if (isMobile) { chatHeader.off('mousedown touchstart'); $(document).off('mousemove touchmove', doDrag); $(document).off('mouseup touchend', stopDrag); resizeHandle.on('touchstart', function(e) { e.preventDefault(); const currentHeight = chatWindow.height(); const newHeight = currentHeight === 400 ? 600 : 400; chatWindow.height(newHeight); localStorage.setItem('ai_chat_window_height', newHeight); }); } // 页面加载时滚动到底部 setTimeout(scrollToBottom, 100); // 窗口大小变化时更新 $(window).on('resize', function() { isMobile = window.innerWidth <= 768; if (isMobile) { minimizeBtn.hide(); } else { minimizeBtn.show(); } if (!isChatOpen && !isHovering) { startRandomMovement(); } }); // 初始化事件绑定 initChatToggleEvents(); // 初始化移动端滚动隐藏功能 initScrollHide(); // 开始随机移动和文字显示 startRandomMovement(); startRandomTextDisplay(); console.log('AI Chatbot initialized successfully - Homepage only'); }); </script> <div id="footer-tools" class="tools-right io-footer-tools d-flex flex-column"> <a href="javascript:" class="btn-tools go-to-up go-up my-1" rel="go-up" style="display: none"> <i class="iconfont icon-to-up"></i> </a> <a href="javascript:" class="btn-tools switch-dark-mode my-1" data-toggle="tooltip" data-placement="left" title="夜间模式"> <i class="mode-ico iconfont icon-light"></i> </a> </div> <div class="search-modal" id="search-modal"><div class="search-body mx-0 mx-md-3"><form role="search" method="get" class="search-form search-card" action="https://www.szxn.com/"><div class="search-box"><div class="dropdown" select-dropdown><a href="javascript:" role="button" class="btn" data-toggle="dropdown" aria-expanded="false"><span class="select-item">网址</span><i class="iconfont i-arrow icon-arrow-b ml-2"></i></a><input type="hidden" name="post_type" value="sites"><div class="dropdown-menu"><a class="dropdown-item" href="javascript:" data-value="sites">网址</a><a class="dropdown-item" href="javascript:" data-value="post">文章</a><a class="dropdown-item" href="javascript:" data-value="app">软件</a><a class="dropdown-item" href="javascript:" data-value="book">书籍</a></div></div><input type="search" class="form-control" required="required" placeholder="你想了解些什么" value="" name="s" /><button type="submit" class="btn vc-theme search-submit"><i class="iconfont icon-search"></i></button></div></form><div class="search-body-box d-flex flex-column flex-md-row"></div></div></div><script type="text/javascript">window.IO = {"ajaxurl":"https:\/\/www.szxn.com\/wp-admin\/admin-ajax.php","uri":"https:\/\/www.szxn.com\/wp-content\/themes\/onenav","homeUrl":"https:\/\/www.szxn.com","minAssets":".min","uid":"","homeWidth":"1260","loginurl":"https:\/\/www.szxn.com\/login\/?redirect_to=https:\/\/www.szxn.com\/51271.html","sitesName":"AI 智能体","addico":"https:\/\/www.szxn.com\/wp-content\/themes\/onenav\/assets\/images\/add.png","order":"asc","formpostion":"top","defaultclass":"io-grey-mode","isCustomize":false,"faviconApi":"https:\/\/t1.gstatic.cn\/faviconV2?client=SOCIAL&type=FAVICON&fallback_opts=TYPE,SIZE,URL&size=128&url=%url%","customizemax":10,"newWindow":true,"lazyload":true,"minNav":false,"loading":false,"hotWords":"baidu","classColumns":" col-2a col-sm-2a col-md-2a col-lg-3a col-xl-5a col-xxl-6a ","apikey":"TURjeU1ESXhOVGMzTWpreU5UUT11OHNSU05UZzJWMFZoVnpoTmRrVmpVRXgzTm14TU4zUTJVWEpGVDBGSmFreFVWRU55","isHome":false,"themeType":"auto-system","mceCss":"https:\/\/www.szxn.com\/wp-content\/themes\/onenav\/assets\/css\/editor-style.css","version":"5.56","isShowAsideSub":false,"asideWidth":"140","localize":{"liked":"您已经赞过了!","like":"谢谢点赞!","networkError":"网络错误 --.","parameterError":"参数错误 --.","selectCategory":"为什么不选分类。","addSuccess":"添加成功。","timeout":"访问超时,请再试试,或者手动填写。","lightMode":"日间模式","nightMode":"夜间模式","editBtn":"编辑","okBtn":"确定","urlExist":"该网址已经存在了 --.","cancelBtn":"取消","successAlert":"成功","infoAlert":"信息","warningAlert":"警告","errorAlert":"错误","extractionCode":"网盘提取码已复制,点“确定”进入下载页面。","wait":"请稍候","loading":"正在处理请稍后...","userAgreement":"请先阅读并同意用户协议","reSend":"秒后重新发送","weChatPay":"微信支付","alipay":"支付宝","scanQRPay":"请扫码支付","payGoto":"支付成功,页面跳转中","clearFootprint":"确定要清空足迹记录吗?"},"postData":{"postId":51271,"postType":"post"}};</script><script src="https://www.szxn.com/wp-content/themes/onenav/assets/js/dock.js"></script> <link rel="stylesheet" href="https://www.szxn.com/wp-content/themes/onenav/assets/css/dock.css"> <script src="https://www.szxn.com/wp-content/themes/onenav/assets/js/user-site.js"></script> <link rel="stylesheet" href="https://www.szxn.com/wp-content/themes/onenav/assets/css/user-site.css"> <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/davidshimjs-qrcodejs@0.0.2/qrcode.min.js?ver=0.0.2" id="qrcode-generator-js"></script> <script type="text/javascript" src="https://www.szxn.com/wp-content/themes/onenav/assets/js/bootstrap.bundle.min.js?ver=5.56" id="bootstrap-js-js"></script> <script type="text/javascript" src="https://www.szxn.com/wp-content/themes/onenav/assets/js/require.js?ver=5.56" id="require-js"></script> <script type="text/javascript"> jQuery(document).ready(function($) { // 前端图片上传 $('#modal_upload_image_btn').on('click', function() { // 创建文件输入元素 var fileInput = $('<input type="file" accept="image/*" style="display: none;">'); $('body').append(fileInput); fileInput.on('change', function(e) { if (this.files.length === 0) return; var formData = new FormData(); formData.append('action', 'upload_image_file'); formData.append('file', this.files[0]); formData.append('_wpnonce', '93099f89b8'); formData.append('content_type', $('#form_content_type').val()); $('#modal_image_upload_status').text('上传中...').removeClass('success error').addClass('uploading'); $.ajax({ url: 'https://www.szxn.com/wp-admin/admin-ajax.php', type: 'POST', data: formData, processData: false, contentType: false, success: function(response) { if (response.success) { $('#modal_image_file').val(response.data.file_path); $('#modal_image_url').val(response.data.file_url); $('#modal_image_upload_status').text('✓ 上传成功!').removeClass('uploading').addClass('success'); } else { $('#modal_image_upload_status').text('✗ ' + response.data).removeClass('uploading').addClass('error'); } }, error: function() { $('#modal_image_upload_status').text('✗ 上传失败').removeClass('uploading').addClass('error'); } }); // 清理 fileInput.remove(); }); // 触发文件选择 fileInput.click(); }); // 前端HTML文件上传 $('#modal_upload_html_btn').on('click', function() { // 创建文件输入元素 var fileInput = $('<input type="file" accept=".html,.htm,.txt" style="display: none;">'); $('body').append(fileInput); fileInput.on('change', function(e) { if (this.files.length === 0) return; var formData = new FormData(); formData.append('action', 'upload_html_file'); formData.append('file', this.files[0]); formData.append('_wpnonce', '2cb9196f93'); formData.append('content_type', $('#form_content_type').val()); $('#modal_html_upload_status').text('上传中...').removeClass('success error').addClass('uploading'); $.ajax({ url: 'https://www.szxn.com/wp-admin/admin-ajax.php', type: 'POST', data: formData, processData: false, contentType: false, success: function(response) { if (response.success) { $('#modal_html_file').val(response.data.file_path); $('#modal_html_url').val(response.data.file_url); $('#modal_html_upload_status').text('✓ 上传成功!').removeClass('uploading').addClass('success'); } else { $('#modal_html_upload_status').text('✗ ' + response.data).removeClass('uploading').addClass('error'); } }, error: function() { $('#modal_html_upload_status').text('✗ 上传失败').removeClass('uploading').addClass('error'); } }); // 清理 fileInput.remove(); }); // 触发文件选择 fileInput.click(); }); // 处理表单提交 $('#html-submit-form').on('submit', function(e) { e.preventDefault(); var form = $(this); var submitBtn = form.find('button[type="submit"]'); var messageDiv = $('#submit-message'); var modal = document.getElementById('html-submit-modal'); // 显示加载状态 submitBtn.prop('disabled', true).text('提交中...'); messageDiv.hide(); // 收集表单数据 var formData = { action: 'submit_html_content', _wpnonce: form.find('input[name="_wpnonce"]').val(), title: form.find('input[name="title"]').val(), author_info: form.find('input[name="author_info"]').val(), contact_info: form.find('input[name="contact_info"]').val(), content_type: form.find('input[name="content_type"]').val(), category: form.find('select[name="category"]').val(), image_url: form.find('input[name="image_url"]').val(), html_url: form.find('input[name="html_url"]').val(), link_url: form.find('input[name="link_url"]').val(), image_file: form.find('input[name="image_file"]').val(), html_file: form.find('input[name="html_file"]').val() }; $.ajax({ url: 'https://www.szxn.com/wp-admin/admin-ajax.php', type: 'POST', data: formData, success: function(response) { if (response.success) { messageDiv.removeClass('error').addClass('success').text(response.data).show(); form[0].reset(); setTimeout(function() { if (modal) { modal.style.display = 'none'; document.body.style.overflow = 'auto'; } messageDiv.hide(); resetForm(); }, 2000); } else { messageDiv.removeClass('success').addClass('error').text(response.data).show(); } }, error: function() { messageDiv.removeClass('success').addClass('error').text('提交失败,请重试').show(); }, complete: function() { submitBtn.prop('disabled', false).text('提交'); } }); }); // 重置表单函数 function resetForm() { var form = document.getElementById('html-submit-form'); var message = document.getElementById('submit-message'); if (form) form.reset(); if (message) { message.style.display = 'none'; message.textContent = ''; } // 重置状态消息 $('.status-message').text('').removeClass('uploading success error'); } }); </script> </body> </html>