Gdańsk AI 项目教程

Gdańsk AI 项目教程

gdansk-ai🦭 Full stack AI voice chatbot (speech-to-text, LLM, text-to-speech) with integrations to Auth0, OpenAI, Google Cloud and Stripe - Web App, Web API and AI API项目地址:https://gitcode.com/gh_mirrors/gd/gdansk-ai

1. 项目的目录结构及介绍

Gdańsk AI 项目的目录结构如下:

gdansk-ai/
├── ai-api/
│   ├── app/
│   ├── tests/
│   ├── Dockerfile
│   ├── requirements.txt
│   └── ...
├── web-api/
│   ├── src/
│   ├── public/
│   ├── package.json
│   ├── tsconfig.json
│   └── ...
├── web/
│   ├── components/
│   ├── pages/
│   ├── styles/
│   ├── next.config.js
│   ├── package.json
│   └── ...
├── .env.example
├── LICENSE
├── README.md
└── ...

目录介绍

  • ai-api/: 包含 AI API 的后端代码,使用 Python 和 FastAPI。
  • web-api/: 包含 Web API 的后端代码,使用 Node.js 和 TypeScript。
  • web/: 包含前端代码,使用 Next.js 和 React。
  • .env.example: 配置文件示例。
  • LICENSE: 项目许可证。
  • README.md: 项目说明文档。

2. 项目的启动文件介绍

ai-api 启动文件

ai-api/ 目录下,主要的启动文件是 app/main.py。这个文件包含了 FastAPI 应用的入口点。

# app/main.py
from fastapi import FastAPI
from app.routes import router

app = FastAPI()
app.include_router(router)

web-api 启动文件

web-api/ 目录下,主要的启动文件是 src/index.ts。这个文件包含了 Node.js 应用的入口点。

// src/index.ts
import express from 'express';
import { router } from './routes';

const app = express();
app.use('/api', router);
app.listen(3000, () => {
  console.log('Server is running on port 3000');
});

web 启动文件

web/ 目录下,主要的启动文件是 pages/_app.tsx。这个文件是 Next.js 应用的入口点。

// pages/_app.tsx
import '../styles/globals.css'
import type { AppProps } from 'next/app'

function MyApp({ Component, pageProps }: AppProps) {
  return <Component {...pageProps} />
}

export default MyApp

3. 项目的配置文件介绍

.env.example

.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

ai-api 配置文件

ai-api/ 目录下,配置文件主要是 app/config.py

# app/config.py
import os
from dotenv import load_dotenv

load_dotenv()

CHATBOT_API_KEY = os.getenv('CHATBOT_API_KEY')
OPEN_AI_API_KEY = os.getenv('OPEN_AI_API_KEY')

web-api 配置文件

web-api/ 目录下,配置文件主要是 src/config.ts

// src/config.ts
import dotenv from 'dotenv';

dotenv.config();

export const CHATBOT_API_KEY = process.env.CHATBOT_API_

gdansk-ai🦭 Full stack AI voice chatbot (speech-to-text, LLM, text-to-speech) with integrations to Auth0, OpenAI, Google Cloud and Stripe - Web App, Web API and AI API项目地址:https://gitcode.com/gh_mirrors/gd/gdansk-ai

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

蒋素萍Marilyn

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值