{"id":13754210,"url":"https://github.com/zhangliwei7758/unity-AI-Chat-Toolkit","last_synced_at":"2025-05-09T22:31:37.091Z","repository":{"id":183056346,"uuid":"669527953","full_name":"zhangliwei7758/unity-AI-Chat-Toolkit","owner":"zhangliwei7758","description":"使用unity实现AI聊天相关功能。目前这个库包含了对chatgpt、chatglm等大语言模型的api调用的代码实现以及实现了微软Azure以及百度AI的语音服务功能，语音服务均采用web api实现，支持Windows/WebGL/Android等平台","archived":false,"fork":false,"pushed_at":"2025-02-26T15:12:38.000Z","size":597103,"stargazers_count":602,"open_issues_count":20,"forks_count":82,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-04-21T14:31:42.334Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":null,"has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/zhangliwei7758.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null}},"created_at":"2023-07-22T15:13:36.000Z","updated_at":"2025-04-21T10:40:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"de8db4cc-41ab-4ef2-8261-f47e68d248f7","html_url":"https://github.com/zhangliwei7758/unity-AI-Chat-Toolkit","commit_stats":null,"previous_names":["zhangliwei7758/unity-ai-chat-toolkit"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangliwei7758%2Funity-AI-Chat-Toolkit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangliwei7758%2Funity-AI-Chat-Toolkit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangliwei7758%2Funity-AI-Chat-Toolkit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/zhangliwei7758%2Funity-AI-Chat-Toolkit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/zhangliwei7758","download_url":"https://codeload.github.com/zhangliwei7758/unity-AI-Chat-Toolkit/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253335699,"owners_count":21892714,"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":[],"created_at":"2024-08-03T09:01:50.120Z","updated_at":"2025-05-09T22:31:32.063Z","avatar_url":"https://github.com/zhangliwei7758.png","language":null,"funding_links":[],"categories":["A01_文本生成_文本对话"],"sub_categories":["大语言对话模型及数据"],"readme":"\n# Unity-AI-Chat-Toolkit\n\n这是一个提供给unity开发者的工具库，用于快速实现AI聊天相关功能。目前这个库包含了对chatgpt、rwkv以及chatglm等大语言模型的api调用的代码实现以及实现了微软Azure以及百度AI的语音合成、语音识别的web api接入。在这个库我们可以通过这代码库，在unity上，快速实现跨平台的应用。\n\n![image](https://github.com/zhangliwei7758/unity-AI-Chat-Toolkit/assets/42199471/b214a24e-1fb9-49d3-b405-1a24c9a9ffba)\n\n## 1. unity版本要求\n\n要求unity2020.3.44及以上版本\n\n## 2. 工具内置功能说明\n\n这个工具是根据我之前的AI二次元小姐姐项目整合后的工具包，目前是整合了通用模块，把相关模型包括Vroid以及live2d模型全部删除了，如果需要使用老版本资源的话，文档后面我会放上传送门，自行下载就可以了。\n\n### 2.1 项目的主要结构\n\n目前这个工具，主要模块包括LLM以及TTS\u0026\u0026STT两个模块：\n\n![image](https://github.com/zhangliwei7758/unity-AI-Chat-Toolkit/assets/42199471/87a261a6-d266-43c1-936d-5bfa41c72352)\n\n### LLM模块：\n=====================\n\n实现的就是针对不同的大语言模型的api调用的代码实现。目前已经实现的大语言模型包括：\n###  chatgpt: \n集成了chatgpt 3.5/4 的api接口，使用这个脚本，需要在脚本参数里填写openai的api key, 默认设置的模型是chatgpt-3.5,如果要替换chatgpt4，需要自行修改模型名称；\n###  chatglm: \n集成了对chatglm官方示例的api接口，如果使用chatglm官方的仓库部署的api服务，就可以直接使用，需要配置的内容是，配置部署好的api地址即可；\n###  rwkv: \n集成了针对rwkv runner开源项目的api接口，因为rwkv runner这个项目的api格式和chatgpt是一样的，如果下载rwkv runner这个项目使用的话，可以使用工具提供的脚本，只需要在api地址参数配置实际的地址就可以了。\n###  星火大模型: \n集成了科大讯飞的星火大模型的api对接功能，可根据需求自行配置V1.5/V2.0版本\n###  百度智能云千帆大模型平台: \n集成了百度智能云千帆大模型平台模型api服务，包括文心一言等十种模型\n###  智谱AI开放平台: \n集成了智谱AI开放平台下，chatGLM Turbo模型的api支持\n###  Ollama工具: \n集成对Ollama部署的本地大模型的API调用支持，可以利用chatOllama模块驱动AI小姐姐聊天\n\n### TTS\u0026\u0026STT模块：\n=====================\n\n这个模块实现了对语言模型反馈信息的语音合成功能的代码实现，以及发送信息时，可能用到的语音识别服务相关的代码实现。目前已实现的语音产品包括：\n###  微软Azure语音合成以及语音识别服务：\n如果使用这个服务，需要准备微软Azure的语音服务令牌，自行注册账号，开通服务获得；\n###  百度AI的语音合成以及语音识别服务：\n使用这个服务时，注册百度AI开放平台的账号，开通语音合成、语音识别服务，创建应用获取到相关的密钥，填入相应脚本即可。\n###  OpenAI平台提供的在线Whisper语音识别服务：\n集成了openAI平台的Whisper在线语音识别api，需要使用openai的api key\n集成了openAI平台的TTS语音合成api，可实现语音合成功能\n###  提供针对开源的Whisper模型的api集成：\n集成的项目是github上开源项目：https://github.com/ahmetoner/whisper-asr-webservice\n部署这个项目，可使用本模块来调用语音识别的api\n###  提供针对科大讯飞语音服务的api集成：\n实现了对科大讯飞语音服务的api集成，采用了websocket方式，可使用科大讯飞的语音识别以及语音合成服务\n\n### WOV模块：\n=====================\n\n这个模块实现了关键词语音唤醒相关的功能，能够通过实时监听关键词，进行对话功能的唤醒\n###  Unity内置关键词识别：\n使用了windows.speech库，实现的关键词识别功能，支持在windows平台下的语音唤醒功能\n\n\n### 角色口型：\n=====================\n\n使用了Oculus的Lipsync方案，并集成到了项目包里，可以使用本方案实现windows平台的音频转口型的效果。\n完整的插件地址，可以自行下载：https://developer.oculus.com/downloads/package/oculus-lipsync-unity/\n\n\n### 2.2 模型如何使用\n\n示例场景里编写了一个调用示例，查看一下ChatAgent对象。\n\n![image](https://github.com/zhangliwei7758/unity-AI-Chat-Toolkit/assets/42199471/c4e8e414-177b-464e-a5e3-c5922c750717)\n\n在配置面板上，根据自己的需求，配置chatmodel以及tts\\stt脚本就可以了。\n\n\n## 3. 关于发布到WebGL方法\n\n因为这个项目用到了unity内置的microphone类，webgl是不支持这个类的，所以工具也整合了别的大佬的解决方案，具体可在工具包路径下找到Tool,查看具体的配置说明。unity端的代码已经在示例场景做过配置，不需要再处理，只需要在导出的webgl项目中做相应的代码调整即可\n\n![image](https://github.com/zhangliwei7758/unity-AI-Chat-Toolkit/assets/42199471/a42768f2-060f-49da-a42e-08fa31a35c84)\n\n\n## 4. 旧版本项目传送门\n\n旧版本项目会包含chatgpt\\chatglm\\微软azure\\baiduAI\\VITS等几个项目示例，可以以下传送门获取\n\nchatGPTAIGirlFriendSample：https://gitee.com/DammonSpace/chat-gptaigirl-friend-sample\n\nvits-chatgpt-live2d-unity-wife：https://gitee.com/DammonSpace/vits-chatgpt-live2d-unity-wife\n\n\n\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangliwei7758%2Funity-AI-Chat-Toolkit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fzhangliwei7758%2Funity-AI-Chat-Toolkit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fzhangliwei7758%2Funity-AI-Chat-Toolkit/lists"}