? Gdańsk AI ?
GdańskAi是一個完整的堆棧AI語音聊天機器人(語音到文本,LLM,文本到語音),並集成到Auth0,OpenAI,Google Cloud API和Stripe-Web App,API和AI
它使用Stripe提供付款基礎架構,因此用戶可以購買bibs
- API令牌。 Auth0用於提供身份驗證和授權。您可以免費使用它們-Auth0每月最多可以免費使用7000個用戶。條紋僅收取購買費用,因此您沒有任何一個持續的費用。
如果要使用這些服務,則必須設置條紋和Auth0帳戶,並將API鍵放入Web .env
web-api/
Directory中。
Node.js,TypeScript和Express此處使用
.env_example
顯示您必須設置的值
CHATBOT_API_KEY={whatever you decide; this value is reused among ai-api, web-api and web in this project}
OPEN_AI_API_KEY={go to platform.openai.com, generate and copy-paste api key here}
# Google Cloud API
type=service_account
project_id={project id}
private_key_id=
private_key={multiline private key with structure like this:-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----n}
client_email={project name}@{project id}.iam.gserviceaccount.com
client_id=
auth_uri=https://accounts.google.com/o/oauth2/auth
token_uri=https://oauth2.googleapis.com/token
auth_provider_x509_cert_url=https://www.googleapis.com/oauth2/v1/certs
client_x509_cert_url=https://www.googleapis.com/robot/v1/metadata/x509/{project-name}%40{project-id}.iam.gserviceaccount.com
universe_domain=googleapis.com
# Stripe
STRIPE_SECRET_KEY={sk_...}
STRIPE_PUBLISHABLE_KEY={pk_...}
TOKENS_PRICE_ID={price_some characters here - you need to create a price in Stripe for tokens first and then copy-paste it here}
# TOKENS_PER_TRANSACTION defines how many interactions user can make with AI per single bibs purchase
TOKENS_PER_TRANSACTION=5
# Auth0
AUTH0_ISSUER_BASE_URL='https://{tenant-name}.us.auth0.com'
AUTH0_DOMAIN='{tenant-name}.us.auth0.com'
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=
AUTH0_AUDIENCE="https://{tenant-name}.us.auth0.com/api/v2/"
AUTH0_SCOPE="openid profile email offline_access"
CLIENT_URL={url pointing to where web is deployed}
AI_API_URL={url pointing to where ai api is deployed}
web-api
目錄npm install
或npm ci
npm run build
npm run start
或npm run dev
可以使用熱率加載它目前在Google Chrome中起作用。您可以按GdańskAi徽標記錄音頻,然後再次按下將其發送到Web API。成功響應後,向您播放了收到的音頻。
Next.js此處與Vercel的模板一起使用
.env_example
顯示您必須設置的值
CHATBOT_API_KEY={whatever you decide; this value is reused among ai-api, web-api and web in this project}
CHATBOT_API_URL={url to where api is deployed}
NEXT_PUBLIC_API_URL={url pointing to where api is deployed}
API_URL={url to where api is deployed}
# Auth0
NEXT_PUBLIC_AUTH0_ISSUER_BASE_URL="https://{tenant-name}.us.auth0.com"
NEXT_PUBLIC_AUTH0_CLIENT_ID=
AUTH0_SECRET=
AUTH0_BASE_URL={url pointing to where web is deployed}
AUTH0_ISSUER_BASE_URL='https://{tenant-name}.us.auth0.com'
AUTH0_DOMAIN='{tenant-name}.us.auth0.com'
AUTH0_CLIENT_ID=
AUTH0_CLIENT_SECRET=
AUTH0_AUDIENCE="https://{tenant-name}.us.auth0.com/api/v2/"
AUTH0_SCOPE="openid profile email offline_access"
CLIENT_URL={url pointing to where web is deployed}
web
目錄npm install
或npm ci
npm run build
/webhook
stripe listen --forward-to http://localhost:3000/webhook
(如果您更改了3000,請調整端口npm run start
signup.ts
中刪除/評論screen_hint: "signup",
OpenAI和Google Cloud API在這裡用於提供語音到文本(Whisper-1),LLM(GPT-3.5-Turbo)和文本對語音(Google Cloud Cloud TextTospeechClient)服務。
Python和Fastapi在這裡
.env_example
顯示您必須設置的值
CHATBOT_API_KEY={whatever you decide; this value is reused among ai-api, web-api and web in this project}
OPEN_AI_API_KEY={go to platform.openai.com, generate and copy-paste api key here}
# Google Cloud API start
type=service_account
project_id={project id}
private_key_id=
private_key={multiline private key with structure like this:-----BEGIN PRIVATE KEY-----...-----END PRIVATE KEY-----n}
client_email={project name}@{project id}.iam.gserviceaccount.com
client_id=
auth_uri=https://accounts.google.com/o/oauth2/auth
token_uri=https://oauth2.googleapis.com/token
auth_provider_x509_cert_url=https://www.googleapis.com/oauth2/v1/certs
client_x509_cert_url=https://www.googleapis.com/robot/v1/metadata/x509/{project-name}%40{project-id}.iam.gserviceaccount.com
universe_domain=googleapis.com
PORT=9000
ai-api
目錄創建一個帳戶,然後創建一個新房客。您需要設置:
申請
蜜蜂
創建一個帳戶,轉動測試模式,除非您想在生產和處理真實付款中運行它,請轉到開發人員選項卡,然後轉到API鍵。在這裡,您可以找到stripe_secret_key和stripe_publishable_key的值。現在,轉到產品選項卡,添加代表單次購買的產品(一個圍嘴 - 與用戶的AI交互)。創建它後,將PriceID複製並將其放入.env中為Tokens_price_id。
創建一個帳戶,轉到platform.openai.com,生成API密鑰,在.env文件中使用它
創建一個帳戶,轉到IAM&Admin,然後服務帳戶並創建一個項目 - 您需要項目的ID才能放入.ENV文件中。然後,您需要生成具有憑據的JSON,並將值從文件中提取到.env文件。轉到創建訪問憑據頁面(您可以使用搜索引擎查找鏈接)。然後鍵 - >添加鍵 - >創建新鍵 - > json->創建。您應該獲得憑據。最後,您需要啟用文本到語音API服務,您已經準備好了
感謝Jeff McJunkin通過從頭開始填寫配置過程並填補文檔中的空白,從而改善了讀數。
GNU GPL V2
如果您在研究中使用此軟件,請使用以下引用:
@software { Maczan_Gdansk_AI_2023 ,
author = { Maczan, Jędrzej Paweł } ,
title = { {Gdańsk AI - Full stack voice chatbot} } ,
url = { https://github.com/jmaczan/gdansk-ai } ,
year = { 2023 } ,
publisher = { GitHub }
}
jędrzejpawełMaczan於2023年在波蘭的Gdańsk製造