{"id":19233779,"url":"https://github.com/ossrs/ai-talk","last_synced_at":"2025-04-21T04:33:27.756Z","repository":{"id":210999678,"uuid":"727695572","full_name":"ossrs/ai-talk","owner":"ossrs","description":"AI-Talk allows you to talk with OpenAI GPT.","archived":false,"fork":false,"pushed_at":"2024-02-26T11:46:46.000Z","size":753,"stargazers_count":39,"open_issues_count":0,"forks_count":11,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-16T08:15:37.082Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://ai-talk.ossrs.net","language":"Go","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/ossrs.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}},"created_at":"2023-12-05T11:42:31.000Z","updated_at":"2025-02-18T15:41:12.000Z","dependencies_parsed_at":"2023-12-15T09:27:33.589Z","dependency_job_id":"4fb38d19-1df0-42f4-842a-73e30960ace9","html_url":"https://github.com/ossrs/ai-talk","commit_stats":null,"previous_names":["winlinvip/gpt-microphone","winlinvip/ai-talk","ossrs/ai-talk"],"tags_count":48,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Fai-talk","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Fai-talk/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Fai-talk/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ossrs%2Fai-talk/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ossrs","download_url":"https://codeload.github.com/ossrs/ai-talk/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249996263,"owners_count":21358098,"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-11-09T16:11:51.946Z","updated_at":"2025-04-21T04:33:27.373Z","avatar_url":"https://github.com/ossrs.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# AI Talk\n\n[![](https://badgen.net/discord/members/q29TwKwC2C)](https://discord.gg/q29TwKwC2C)\n\nAI-Talk allows you to talk with OpenAI GPT.\n\n\u003cdetails\u003e\n\u003csummary\u003eGeneral Assistant\u003c/summary\u003e\n\nPlease setup the envirionments:\n```\nAIT_SYSTEM_PROMPT='You are a helpful assistant.'\n```\n\nhttps://github.com/ossrs/ai-talk/assets/2777660/57599a76-37d7-4b12-99be-cb3b96e1742a\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eSpoken English Coach\u003c/summary\u003e\n\nPlease setup the envirionments:\n```\nAIT_SYSTEM_PROMPT='I want you to act as a spoken English teacher and improver. I will speak to you in English and you will reply to me in English to practice my spoken English. I want you to  I want you to strictly correct my grammar mistakes, typos, and factual errors. I want you to ask me a question in your reply. Now let us start practicing, you could ask me a question first. Remember, I want you to strictly correct my grammar mistakes, typos, and factual errors.'\n```\n    \nhttps://github.com/ossrs/ai-talk/assets/2777660/b797e8a4-7656-410b-8250-e0abaa4b037d\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eSimultaneous English Translation\u003c/summary\u003e\n\nPlease setup the envirionments:\n```\nAIT_SYSTEM_PROMPT='Translate to simple and easy to understand english. Never answer questions but only translate text to English.'\n```\n\nhttps://github.com/ossrs/ai-talk/assets/2777660/a33e56c2-0f88-499f-8e4a-7b537a1e9ba9\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003eChinese Words Solitaire Game\u003c/summary\u003e\n\nPlease setup the envirionments:\n```\nAIT_ASR_LANGUAGE=zh\nAIT_SYSTEM_PROMPT='我希望你是一个儿童的词语接龙的助手。我希望你做两个词的词语接龙。我希望你不要用重复的词语。我希望你重复我说的词，然后再接龙。我希望你回答时，解释下词语的含义。请记住，你讲的答案是给6岁小孩听得懂的。请记住，你要做词语接龙。例如：我：苹果。你：苹果，果园。苹果，是一种水果，长在树上，是红色的。果园，是一种地方，有很多树，有很多果子。'\n```\n\nhttps://github.com/ossrs/ai-talk/assets/2777660/bb350595-23a6-47df-a050-c931699ac7e3\n\u003c/details\u003e\n    \n\u003e Note: You can find more prompts from [awesome-chatgpt-prompts](https://github.com/f/awesome-chatgpt-prompts).\n\n## Usage\n\nTo run in docker:\n\n```bash\ndocker run --rm -it -p 80:3000 -p 443:3443 \\\n    -e OPENAI_API_KEY=sk-xxx -e OPENAI_PROXY=https://api.openai.com/v1 \\\n    -e AIT_SYSTEM_PROMPT=\"You are a helpful assistant.\" \\\n    -e AIT_CHAT_MODEL=\"gpt-4-1106-preview\" \\\n    ossrs/ai-talk:v1\n```\n\n\u003e Note: Setup the `OPENAI_PROXY` if you are not able to access the API directly.\n\n\u003e Note: Please use `registry.cn-hangzhou.aliyuncs.com/ossrs/ai-talk:v1` in China.\n\nThen you can access by http://localhost and happy to talk with AI.\n\nThen you can access by https://your-server-ip from your mobile browser.\n\n\u003e Note: The HTTPS certificate is self-signed, you need to accept it in your mobile browser.\n\n## aaPanel or BaoTa\n\nYou can use [aaPanel](https://www.aapanel.com/) or [BaoTa](https://www.bt.cn/) to deploy AI-Talk.\n\nFirst, run AI Talk in docker, only listen at HTTP:\n\n```bash\ndocker run --rm -it -p 3000:3000 \\\n    -e OPENAI_API_KEY=sk-xxx -e OPENAI_PROXY=https://api.openai.com/v1 \\\n    -e AIT_SYSTEM_PROMPT=\"You are a helpful assistant.\" \\\n    -e AIT_CHAT_MODEL=\"gpt-4-1106-preview\" \\\n    ossrs/ai-talk:v1\n```\n\nThen, create a website in aaPanel or BaoTa, with nginx config as bellow:\n\n```nginx\n    location / {\n      proxy_pass http://127.0.0.1:3000$request_uri;\n    }\n    if ($server_port !~ 443){\n        rewrite ^(/.*)$ https://$host$1 permanent;\n    }\n```\n\nNext, setup HTTPS by aaPanel or BaoTa.\n\nFinally, access the website by https://your-domain-name.\n\n## Environment Variables\n\nNecessary environment variables that you must configure:\n\n* `OPENAI_API_KEY`: The OpenAI API key, get from [https://platform.openai.com/api-keys](https://platform.openai.com/api-keys).\n\nOptionally, you might need to set the following environment variables:\n\n* `OPENAI_PROXY`: The OpenAI API proxy, default to `https://api.openai.com/v1`, which directly access OpenAI API without proxy.\n  * `OPENAI_ORGANIZATION`: The OpenAI organization.\n  * `ASR_OPENAI_API_KEY`: The OpenAI API key for ASR, default to `OPENAI_API_KEY`. \n  * `ASR_OPENAI_PROXY`: The OpenAI API proxy for ASR, default to `OPENAI_PROXY`.\n  * `CHAT_OPENAI_API_KEY`: The OpenAI API key for chat, default to `OPENAI_API_KEY`.\n  * `CHAT_OPENAI_PROXY`: The OpenAI API proxy for chat, default to `OPENAI_PROXY`.\n  * `TTS_OPENAI_API_KEY`: The OpenAI API key for TTS, default to `OPENAI_API_KEY`.\n  * `TTS_OPENAI_PROXY`: The OpenAI API proxy for TTS, default to `OPENAI_PROXY`.\n* `AIT_SYSTEM_PROMPT`: The system prompt, default to `You are a helpful assistant.`.\n  * To make sure AI response limit words to avoid long audio, we always append `Keep your reply neat, limiting the reply to ${AIT_REPLY_LIMIT} words.` to system prompt.\n  * You can set `AIT_REPLY_LIMIT` to limit the words of AI response, default to `50`.\n  * Please use `AIT_EXTRA_ROBOTS` to set the number of extra robots, default to `0`.\n* `AIT_CHAT_MODEL`: The AI model, default to `gpt-3.5-turbo-1106` which is good enough. See [link](https://platform.openai.com/docs/models).\n  * `gpt-4-1106-preview`: The latest GPT-4 model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.\n  * `gpt-3.5-turbo-1106`: The latest GPT-3.5 Turbo model with improved instruction following, JSON mode, reproducible outputs, parallel function calling, and more.\n  * `gpt-3.5-turbo`: Our most capable and cost effective model in the GPT-3.5 family.\n* `AIT_ASR_LANGUAGE`: The language for Whisper ASR, default to `en`, see [ISO-639-1](https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes), bellow are some examples:\n  * `en`: English\n  * `zh`: Chinese\n  * `fr`: French \n  * `de`: German\n  * `it`: Italian\n  * `ja`: Japanese\n  * `ko`: Korean\n  * `pt`: Portuguese\n  * `ru`: Russian\n  * `es`: Spanish\n* `AIT_ASR_MODEL`: The model for Whisper ASR, default to `whisper-1`. See [link](https://platform.openai.com/docs/api-reference/audio/createTranscription).\n* `AIT_TTS_VOICE`: The void for OpenAI TTS, default to `nova`. Supported voices are `alloy`, `echo`, `fable`, `onyx`, `nova`, and `shimmer`. See [link](https://platform.openai.com/docs/api-reference/audio/createSpeech).\n* `AIT_TTS_MODEL`: The model to use for OpenAI TTS, default to `tts-1`. See [link](https://platform.openai.com/docs/api-reference/audio/createSpeech)\n\nOptionally, additional robots can be incorporated into various environments:\n\n* `AIT_ROBOT_0_ID`: The id for extra robot `#0`, for example, `english-spoken-coach`.\n* `AIT_ROBOT_0_LABEL`: The label for extra robot `#0`, for example, `English Spoken Coach`.\n* `AIT_ROBOT_0_PROMPT`: The prompt for extra robot `#0`, for example, `I want you to act as a spoken English teacher and improver.`.\n* `AIT_ROBOT_0_ASR_LANGUAGE`: **(Optional)** The language for extra robot `#0`, default to `AIT_ASR_LANGUAGE`.\n* `AIT_ROBOT_0_REPLY_PREFIX`: **(Optional)** The prefix for the first sentence for extra robot `#0`, default to `AIT_REPLY_PREFIX`.\n* `AIT_ROBOT_0_REPLY_LIMIT`: **(Optional)** The limit words for extra robot `#0`, default to `AIT_REPLY_LIMIT`.\n* `AIT_ROBOT_0_CHAT_MODEL`: **(Optional)** The AI chat model for extra robot `#0`, default to `AIT_CHAT_MODEL`.\n* `AIT_ROBOT_0_CHAT_WINDOW`: **(Optional)** The AI chat window for extra robot `#0`, default to `AIT_CHAT_WINDOW`.\n\nLess frequently used optional environment variables:\n\n* `AIT_HTTP_LISTEN`: The HTTP listen address, default to `:3000`, please use `-p 80:3000` to map to a different port.\n* `AIT_HTTPS_LISTEN`: The HTTPS listen address, default to `:3443`, please use `-p 443:3443` to map to a different port.\n* `AIT_PROXY_STATIC`: Whether proxy to static files, default to `false`.\n* `AIT_REPLY_PREFIX`: If AI reply is very short for TTS not good, prefix with this text, default is not set.\n* `AIT_MAX_TOKENS`: The max tokens, default to `1024`.\n* `AIT_TEMPERATURE`: The temperature, default to `0.9`.\n* `AIT_KEEP_FILES`: Whether keep audio files, default to `false`.\n* `AIT_REPLY_LIMIT`: The AI reply limit words, default to `30`.\n* `AIT_CHAT_WINDOW`: The AI chat window to store historical messages, default to `5`.\n* `AIT_DEFAULT_ROBOT`: Whether enable the default robot, prompt is `AIT_SYSTEM_PROMPT`, default to `true`.\n* `AIT_STAGE_TIMEOUT`: The timeout in seconds for each stage, default to `300`.\n\n## HTTPS Certificate\n\nYou can buy and download HTTPS certificate, then mount to docker by `-v` as bellow:\n\n```bash\ndocker run \\\n    -v /path/to/domain.crt:/g/server.crt -v /path/to/domain.key:/g/server.key \\\n    ossrs/ai-talk:v1\n```\n\nPlease make sure the file `/path/to/domain.crt` and `/path/to/domain.key` exists.\n\n## Changelog\n\nThe changelog:\n\n* Support mobile and PC browser. v1.0.0\n* Request microphone permission when starting. v1.0.2\n* Support single assistant to talk with. v1.0.3\n* Dispose recorder and stream when record done. v1.0.4\n* Setup the website title to AI Talk whatever. v1.0.6\n* Limit the response words to 50 words by default. v1.0.10\n* Support multiple assistants and select before start. v1.0.11\n* Setup model and robots by environment variables. [v1.0.12](https://github.com/ossrs/ai-talk/releases/tag/v1.0.12)\n* Fix Android browser select button label issue. v1.0.13\n* Add micWorking and attention state to avoid data loss. v1.0.14\n* Refine the UI for mobile browser. v1.0.15\n* Fast require microphone permission. v1.0.16\n* Save user select robot to local storage. [v1.0.17](https://github.com/ossrs/ai-talk/releases/tag/v1.0.17)\n* Refine the UI and history message style. v1.0.18\n* Limit to 30 words and config in robot. v1.0.19\n* Use css to draw a microphone icon. [v1.0.20](https://github.com/ossrs/ai-talk/releases/tag/v1.0.20)\n* Refine the data loss before and after record. v1.0.21\n* Add text tips label to use microphone. v1.0.22\n* Refine the startup waiting UI. [v1.0.23](https://github.com/ossrs/ai-talk/releases/tag/v1.0.23)\n* Support setup chat AI model for each robot. v1.0.24\n* Support setup chat window for each robot. [v1.0.25](https://github.com/ossrs/ai-talk/releases/tag/v1.0.25)\n* Alert error when not HTTPS. v1.0.26\n* Support HTTPS proxy for OpenAI. v1.0.27\n* Support official OpenAI API without proxy. [v1.0.28](https://github.com/ossrs/ai-talk/releases/tag/v1.0.28)\n* Always use HTTPS proxy if not specified. v1.0.29\n* Do not require some variables. v1.0.30\n* Refine the logs for user and bot. v1.0.31\n* Detect user silent and warning. v1.0.32\n* Refine bot log for the first time. [v1.0.33](https://github.com/ossrs/ai-talk/releases/tag/v1.0.33)\n* Allow user retry when error. v1.0.34\n* Refine badcase for user input. v1.0.35\n* Fix bug for setting window for robot. [v1.0.36](https://github.com/ossrs/ai-talk/releases/tag/v1.0.36)\n* Support setup API proxy and key for ASR,Chat,TTS. v1.0.37\n* Support Tencent Speech to speed up. v1.0.37\n* Support share logging text mode. v1.0.38\n* Fix some badcase for sentence determine. [v1.0.39](https://github.com/ossrs/ai-talk/releases/tag/v1.0.39)\n* Speed up the ASR, without transcode. v1.0.40\n* Refine the stat for elapsed time cost of upload. v1.0.41\n* Refine the log label. [v1.0.46](https://github.com/ossrs/ai-talk/releases/tag/v1.0.46)\n* Support OpenAI organization. v1.0.47\n\nWinlin, 2023.12\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossrs%2Fai-talk","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fossrs%2Fai-talk","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fossrs%2Fai-talk/lists"}