{"id":25836889,"url":"https://github.com/fun123dotcn/llmai2ext","last_synced_at":"2025-10-16T16:20:07.639Z","repository":{"id":279334793,"uuid":"938466394","full_name":"fun123dotcn/LLMAI2Ext","owner":"fun123dotcn","description":"App Inventor 2 LLMAI2Ext 拓展：接入DeepSeek、Kimi、通义千问...等国内大模型。","archived":false,"fork":false,"pushed_at":"2025-02-25T02:41:39.000Z","size":462,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-25T03:29:51.904Z","etag":null,"topics":["ai","ai2","appinventor","appinventor2","deepseek","deepseek-r1","dify","extension","kimi","llm","ollama","qwen"],"latest_commit_sha":null,"homepage":"https://www.fun123.cn/reference/extensions/LLMAI2Ext.html","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fun123dotcn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2025-02-25T02:09:20.000Z","updated_at":"2025-02-25T02:41:42.000Z","dependencies_parsed_at":"2025-02-25T03:40:00.975Z","dependency_job_id":null,"html_url":"https://github.com/fun123dotcn/LLMAI2Ext","commit_stats":null,"previous_names":["fun123dotcn/llmai2ext"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fun123dotcn%2FLLMAI2Ext","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fun123dotcn%2FLLMAI2Ext/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fun123dotcn%2FLLMAI2Ext/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fun123dotcn%2FLLMAI2Ext/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fun123dotcn","download_url":"https://codeload.github.com/fun123dotcn/LLMAI2Ext/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":241309090,"owners_count":19941722,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ai","ai2","appinventor","appinventor2","deepseek","deepseek-r1","dify","extension","kimi","llm","ollama","qwen"],"created_at":"2025-03-01T02:36:26.073Z","updated_at":"2025-10-16T16:20:07.545Z","avatar_url":"https://github.com/fun123dotcn.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"## 官网原文链接\n\n[App Inventor 2 LLMAI2Ext 自研拓展：接入DeepSeek、Kimi、通义千问...等国内大模型](https://www.fun123.cn/reference/extensions/LLMAI2Ext.html)\n\n* [\u003cimg src=\"LLMAI2Ext/deepseek.png\" style=\"width:16px;margin:-4px 0 0 5px\"\u003e DeepSeek](https://www.fun123.cn/reference/extensions/LLMAI2Ext.html#DeepSeek)\n* [\u003cimg src=\"LLMAI2Ext/kimi.png\" style=\"width:16px;margin:-4px 0 0 5px\"\u003e Kimi](https://www.fun123.cn/reference/extensions/LLMAI2Ext.html#Kimi)\n* [\u003cimg src=\"LLMAI2Ext/qwen.png\" style=\"width:16px;margin:-4px 0 0 5px\"\u003e 阿里通义千问](https://www.fun123.cn/reference/extensions/LLMAI2Ext.html#Qwen)\n\n## AppInventor2中文网开发国内大模型拓展的初衷\n\nApp Inventor 2 原生的ChatGPT组件由于是国外的，使用起来不太便捷，且各种限制。\n\n如今我们又身处AI浪潮之中，包括很多学校在内的国内用户都有AI结合传统的App来开发具有智能App的需求，因此，必须开发拓展以接入国内大模型，对，它专门接国内大模型的，国外的不接。\n\n拓展接口参考了原生ChatGPT组件的简洁设计，在其基础上更加简化，还引入了它不支持的流式输出模式，且**默认输出模式就是流式**的，类似打字机的效果，当然也可以切换非流式，模型回答完成时一把输出。\n\nv1.0 版本现已上线，暂时支持3个大模型的接入（DeepSeek、Kimi、通义千问），**免费开放给全球用户**，当然由于拓展是在最新源码平台上编译出来的，可能有些较老的平台不能很好的运行，有条件的话还是建议使用我们的平台，也会优先获得反馈支持。\n\n当然，好的产品是需要不断迭代的，这款拓展也不例外，欢迎使用并期待您的反馈！\n\n![ext](LLMAI2Ext/feedback.png)\n\n## 拓展下载，免费开放\n* .aix 拓展下载：\n\n[cn.fun123.LLMAI2Ext.aix - v1.0](https://www.fun123.cn/reference/extensions/LLMAI2Ext/cn.fun123.LLMAI2Ext.aix)\n\n注：所有大模型拓展共一个.aix拓展文件，里面有多个拓展组件，导入.aix效果参考如下：\n\n![ext](LLMAI2Ext/ext.png)\n\n回答效果参考如下：\n\n![llm](LLMAI2Ext/llm_kimi.gif)\n\n我们尽量将接口方法设计得简单易用，由于demo中包含了APIKey，因此不直接提供aia源码，这里以Kimi为例，附上代码块：\n\n开始对话：\n\n![kimi](LLMAI2Ext/kimi_chat.png)\n\n切换输出模式（默认流式输出，可切换非流式一把输出内容）：\n\n![kimi](LLMAI2Ext/kimi_switch.png)\n\n流式输出响应事件，每输出一部分内容都会回调一次，追加展示；最后一次回调时 `finished` 参数为`真`：\n\n![kimi](LLMAI2Ext/kimi_stream.png)\n\n非流式输出，只回调一次，内容直接展示即可：\n\n![kimi](LLMAI2Ext/kimi_text.png)\n\n\n## \u003cimg src=\"LLMAI2Ext/deepseek.png\" style=\"width:16px;margin:-4px 0 0 5px\"\u003e  DeepSeek\n\n使用AppInventor2接入DeepSeek大模型。\u003ca href=\"https://platform.deepseek.com/api_keys\" target=\"_blank\"\u003e从深度求索获取 API Key \u003e\u003e\u003c/a\u003e\n\n当然也可以对接其他厂商部署的DeepSeek服务，比如百度、阿里都有部署，这里选择阿里的DeepSeek服务进行测试验证：\n\n`BaseURL` 由官方的改为：`https://dashscope.aliyuncs.com/compatible-mode/v1`\n\n`APIKey` 用阿里云的。\n\n`ModelName` 指定：deepseek-v3 或 deepseek-r1    （注意：第三方的模型名称和官方的不太一样）\n\n参考测试结果如下：\n\n![llm](LLMAI2Ext/llm_deepseek.gif)\n\n### 属性\n\n{:id=\"DeepSeek.APIKey\" .text} *APIKey*\n: 模型的Api Key。\n\n{:id=\"DeepSeek.BaseURL\" .text} *BaseURL*\n: DeepSeek 基础 URL，默认是官方地址，可修改接入第三方DeepSeek服务地址。\n\n{:id=\"DeepSeek.ModelName\" .text} *ModelName*\n: 模型名称。官方的DeepSeek-V3模型填：deepseek-chat  或  DeepSeek-R1推理模型填：deepseek-reasoner。 （注意：第三方的模型名称和官方的不太一样）\n\n{:id=\"DeepSeek.StreamMode\" .boolean} *StreamMode*\n: 流式输出模式是否开启，默认'真'。\n流式输出，即生成内容时边计算边返回，减少等待时间，提高响应速度，适用于聊天、代码补全等场景。\n不开启，则是最终仅一次返回全部内容。\n\n### 事件\n\n{:id=\"DeepSeek.GotStream\"} GotStream(*part*{:.text},*finished*{:.boolean})\n: 流式输出，每当有内容返回时都会触发该事件。part 为当前增量的部分内容，finished 标识输出是否已结束。\n\n{:id=\"DeepSeek.GotText\"} GotText(*text*{:.text})\n: 非流式输出完成时触发该事件。text 为完整输出内容。\n\n### 方法\n\n{:id=\"DeepSeek.Chat\" class=\"method\"} \u003ci/\u003e Chat(*content*{:.text})\n: 开始与 DeepSeek 大模型进行对话。\n\n\n\n## \u003cimg src=\"LLMAI2Ext/kimi.png\" style=\"width:16px;margin:-4px 0 0 5px\"\u003e  Kimi\n\n使用AppInventor2接入Kimi大模型。\u003ca href=\"https://platform.moonshot.cn/console/api-keys\" target=\"_blank\"\u003e从 Moonshot 获取 API Key \u003e\u003e\u003c/a\u003e\n\n### 属性\n\n{:id=\"Kimi.APIKey\" .text} *APIKey*\n: 模型的Api Key。\n\n{:id=\"Kimi.ModelName\" .text} *ModelName*\n: 模型名称。\n\n{:id=\"Kimi.StreamMode\" .boolean} *StreamMode*\n: 流式输出模式是否开启，默认'真'。\n流式输出，即生成内容时边计算边返回，减少等待时间，提高响应速度，适用于聊天、代码补全等场景。\n不开启，则是最终仅一次返回全部内容。\n\n### 事件\n\n{:id=\"Kimi.GotStream\"} GotStream(*part*{:.text},*finished*{:.boolean})\n: 流式输出，每当有内容返回时都会触发该事件。part 为当前增量的部分内容，finished 标识输出是否已结束。\n\n{:id=\"Kimi.GotText\"} GotText(*text*{:.text})\n: 非流式输出完成时触发该事件。text 为完整输出内容。\n\n### 方法\n\n{:id=\"Kimi.Chat\" class=\"method\"} \u003ci/\u003e Chat(*content*{:.text})\n: 开始与 Kimi 大模型进行对话。\n\n\n\n## \u003cimg src=\"LLMAI2Ext/qwen.png\" style=\"width:16px;margin:-4px 0 0 5px\"\u003e 阿里通义千问\n\n使用AppInventor2接入阿里通义千问大模型。\u003ca href=\"https://dashscope.console.aliyun.com/api-key_management\" target=\"_blank\"\u003e从阿里云获取 API Key \u003e\u003e\u003c/a\u003e\n\n![llm](LLMAI2Ext/llm_qwen.gif)\n\n### 属性\n\n{:id=\"Qwen.APIKey\" .text} *APIKey*\n: 模型的Api Key。\n\n{:id=\"Qwen.ModelName\" .text} *ModelName*\n: 模型名称。\n\n{:id=\"Qwen.StreamMode\" .boolean} *StreamMode*\n: 流式输出模式是否开启，默认'真'。\n流式输出，即生成内容时边计算边返回，减少等待时间，提高响应速度，适用于聊天、代码补全等场景。\n不开启，则是最终仅一次返回全部内容。\n\n### 事件\n\n{:id=\"Qwen.GotStream\"} GotStream(*part*{:.text},*finished*{:.boolean})\n: 流式输出，每当有内容返回时都会触发该事件。part 为当前增量的部分内容，finished 标识输出是否已结束。\n\n{:id=\"Qwen.GotText\"} GotText(*text*{:.text})\n: 非流式输出完成时触发该事件。text 为完整输出内容。\n\n### 方法\n\n{:id=\"Qwen.Chat\" class=\"method\"} \u003ci/\u003e Chat(*content*{:.text})\n: 开始与千问大模型进行对话。\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffun123dotcn%2Fllmai2ext","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffun123dotcn%2Fllmai2ext","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffun123dotcn%2Fllmai2ext/lists"}