From 1a475ecc4229bf439c044b1cf9daa7037e688d09 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Fri, 13 Sep 2024 22:42:04 +0800 Subject: [PATCH 1/3] feat: add OPENAI_BASE_URL envs --- .github/workflows/aws-preview.yml | 1 + .github/workflows/aws-prod.yml | 1 + README.en-US.md | 5 +-- README.ja-JP.md | 5 +-- README.md | 1 + template.yml | 60 +++++++++++++++++-------------- 6 files changed, 42 insertions(+), 31 deletions(-) diff --git a/.github/workflows/aws-preview.yml b/.github/workflows/aws-preview.yml index 9b5c2c8b..21763a77 100644 --- a/.github/workflows/aws-preview.yml +++ b/.github/workflows/aws-preview.yml @@ -64,6 +64,7 @@ jobs: GithubAppsClientId=${{ secrets.X_GITHUB_APPS_CLIENT_ID }} \ GithubAppsClientSecret=${{ secrets.X_GITHUB_APPS_CLIENT_SECRET }} \ OpenAIAPIKey=${{ secrets.OPENAI_API_KEY }} \ + OpenAIBaseUrl=${{ vars.OPENAI_BASE_URL }} \ GeminiAPIKey=${{ secrets.GEMINI_API_KEY }} \ SupabaseServiceKey=${{ secrets.SUPABASE_SERVICE_KEY }} \ SupabaseUrl=${{ secrets.SUPABASE_URL }} \ diff --git a/.github/workflows/aws-prod.yml b/.github/workflows/aws-prod.yml index 47f56b63..8db0397d 100644 --- a/.github/workflows/aws-prod.yml +++ b/.github/workflows/aws-prod.yml @@ -58,6 +58,7 @@ jobs: GithubAppsClientId=${{ secrets.X_GITHUB_APPS_CLIENT_ID }} \ GithubAppsClientSecret=${{ secrets.X_GITHUB_APPS_CLIENT_SECRET }} \ OpenAIAPIKey=${{ secrets.OPENAI_API_KEY }} \ + OpenAIBaseUrl=${{ vars.OPENAI_BASE_URL }} \ GeminiAPIKey=${{ secrets.GEMINI_API_KEY }} \ SupabaseServiceKey=${{ secrets.SUPABASE_SERVICE_KEY }} \ SupabaseUrl=${{ secrets.SUPABASE_URL }} \ diff --git a/README.en-US.md b/README.en-US.md index e992e9ad..3016c5c0 100644 --- a/README.en-US.md +++ b/README.en-US.md @@ -121,8 +121,9 @@ The project requires environment variables to be set: | `API_IDENTIFIER` | Required | Auth0 API Identifier | `https://petercat.us.auth0.com/api/v2/` | | **LLM Related Environment Variables** | | `OPENAI_API_KEY` | Required | OpenAI API key | `sk-xxxx` | -| `GEMINI_API_KEY` | Required | Gemini API key | `xxxx` | -| `TAVILY_API_KEY` | Required | Tavily API key | `tvly-xxxxx` | +| `OPENAI_BASE_URL` | Optional | Base URL for API requests. Only specify if using a proxy or service emulator. | `https://api.openai.com/v1` +| `GEMINI_API_KEY` | Optional | Gemini API key | `xxxx` | +| `TAVILY_API_KEY` | Optional | Tavily API key | `tvly-xxxxx` | | **GitHub App Registration Environment Variables** | | `X_GITHUB_APP_ID` | Optional | GitHub App ID | `123456` | | `X_GITHUB_APPS_CLIENT_ID` | Optional | GitHub App Client ID | `Iv1.xxxxxxx` | diff --git a/README.ja-JP.md b/README.ja-JP.md index 51ed0ca0..4dae2b70 100644 --- a/README.ja-JP.md +++ b/README.ja-JP.md @@ -104,8 +104,9 @@ | `API_IDENTIFIER` | 必須 | Auth0 API識別子 | `https://petercat.us.auth0.com/api/v2/` | | **LLM関連環境変数** | | `OPENAI_API_KEY` | 必須 | OpenAI APIキー | `sk-xxxx` | -| `GEMINI_API_KEY` | 必須 | Gemini APIキー | `xxxx` | -| `TAVILY_API_KEY` | 必須 | Tavily APIキー | `tvly-xxxxx` | +| `OPENAI_BASE_URL` | オプション | APIリクエストのためのベースURL。プロキシやサービスエミュレーターを使用する場合のみ指定します。 | `https://api.openai.com/v1` | +| `GEMINI_API_KEY` | オプション | Gemini APIキー | `xxxx` | +| `TAVILY_API_KEY` | オプション | Tavily APIキー | `tvly-xxxxx` | | **GitHub App登録環境変数** | | `X_GITHUB_APP_ID` | オプション | GitHub App ID | `123456` | | `X_GITHUB_APPS_CLIENT_ID` | オプション | GitHub AppクライアントID | `Iv1.xxxxxxx` | diff --git a/README.md b/README.md index 58788a22..a6790f32 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,7 @@ | `API_IDENTIFIER` | 必选 | auth0 的 API Identifier | `https://petercat.us.auth0.com/api/v2/` | **LLM相关的 env** | | `OPENAI_API_KEY` | 必选 | OpenAI 的密钥 | `sk-xxxx` +| `OPENAI_BASE_URL` | 可选 | API 请求的基础 URL。仅在使用代理或服务模拟器时指定。| `https://api.openai.com/v1` | `GEMINI_API_KEY` | 可选 | Gemini 的密钥 | `xxxx` | `TAVILY_API_KEY` | 必选 | Tavily 的密钥 | `tvly-xxxxx` | **注册为 Github App 的 env** | diff --git a/template.yml b/template.yml index f80f76c0..70133959 100644 --- a/template.yml +++ b/template.yml @@ -10,47 +10,51 @@ Globals: Parameters: PetercatEnv: Type: String - Description: Environment mark of PetercatEnv + Description: Environment marker for Petercat Default: 1 GitHubAppID: Type: Number - Description: Github App Id + Description: GitHub Application ID Default: 1 GithubAppsClientId: Type: String - Description: Github App Id + Description: GitHub Application Client ID Default: 1 GitHubToken: Type: String - Description: Github Token + Description: GitHub Token for authentication Default: 1 WebUrl: Type: String - Description: Web URL + Description: Web application URL Default: 1 StaticUrl: Type: String - Description: Static file url + Description: URL for static files Default: 1 APIUrl: Type: String - Description: API URL + Description: API endpoint URL Default: 1 APIIdentifier: Type: String - Description: APIIdentifier + Description: Identifier for the API Default: 1 FastAPISecretKey: Type: String - Description: FastAPISecretKey + Description: Secret key for FastAPI Default: 1 GithubAppsClientSecret: Type: String - Description: Github App Id + Description: GitHub Application Client Secret Default: 1 OpenAIAPIKey: Type: String - Description: Github App Id + Description: OpenAI API Key + Default: 1 + OpenAIBaseUrl: + Type: String + Description: OpenAI Base URL Default: 1 GeminiAPIKey: Type: String @@ -58,60 +62,61 @@ Parameters: Default: 1 SupabaseServiceKey: Type: String - Description: Github App Id + Description: Supabase Service Key Default: 1 SupabaseUrl: Type: String - Description: Github App Id + Description: Supabase URL Default: 1 TavilyAPIKey: Type: String - Description: Github App Id + Description: Tavily API Key Default: 1 SQSQueueName: Type: String - Description: SQS Queue Name + Description: Name of the SQS queue Default: 1 SQSQueueUrl: Type: String - Description: SQS Queue Url + Description: URL of the SQS queue Default: 1 - Auth0Domain: + Auth0Domain: Type: String Description: Auth0 Domain Default: 1 Auth0ClientId: Type: String - Description: Auth0 ClientId + Description: Auth0 Client ID Default: 1 Auth0ClientSecret: Type: String - Description: Auth0 Clientt Secret + Description: Auth0 Client Secret Default: 1 AWSGithubSecretName: Type: String - Description: Github Secret Name Store in AWS + Description: Name of the GitHub secret stored in AWS Secrets Manager Default: 1 AWSStaticSecretName: Type: String - Description: Static Secret Name Store in AWS + Description: Name of the static secret stored in AWS Secrets Manager Default: 1 - AWSLLMTokenSecretName: + AWSLLMTokenSecretName: Type: String - Description: AWS Secret Name Store in AWS + Description: Name of the LLM token secret stored in AWS Secrets Manager Default: 1 AWSLLMTokenPublicName: Type: String - Description: AWS Public Name Store in AWS + Description: Name of the LLM public token stored in AWS Secrets Manager Default: 1 - AWSStaticKeyPairId: + AWSStaticKeyPairId: Type: String - Description: Static Key Pair Id + Description: Key Pair ID for static resources Default: 1 S3TempBucketName: Type: String - Description: S3 Bucket Name + Description: Name of the temporary S3 bucket Default: 1 + Resources: FastAPIFunction: Type: AWS::Serverless::Function @@ -137,6 +142,7 @@ Resources: API_IDENTIFIER: !Ref APIIdentifier FASTAPI_SECRET_KEY: !Ref FastAPISecretKey OPENAI_API_KEY: !Ref OpenAIAPIKey + OPENAI_BASE_URL: !Ref OpenAIBaseUrl GEMINI_API_KEY: !Ref GeminiAPIKey SUPABASE_SERVICE_KEY: !Ref SupabaseServiceKey SUPABASE_URL: !Ref SupabaseUrl From 29f5f0456305d649fffcd97b3638a91b883a00d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Fri, 13 Sep 2024 22:46:27 +0800 Subject: [PATCH 2/3] 1 --- .github/workflows/aws-preview.yml | 2 +- .github/workflows/aws-prod.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/aws-preview.yml b/.github/workflows/aws-preview.yml index 21763a77..aaa17d1d 100644 --- a/.github/workflows/aws-preview.yml +++ b/.github/workflows/aws-preview.yml @@ -64,7 +64,7 @@ jobs: GithubAppsClientId=${{ secrets.X_GITHUB_APPS_CLIENT_ID }} \ GithubAppsClientSecret=${{ secrets.X_GITHUB_APPS_CLIENT_SECRET }} \ OpenAIAPIKey=${{ secrets.OPENAI_API_KEY }} \ - OpenAIBaseUrl=${{ vars.OPENAI_BASE_URL }} \ + OpenAIBaseUrl=${{ vars.OPENAI_BASE_URL:-"https://api.openai.com/v1" }} \ GeminiAPIKey=${{ secrets.GEMINI_API_KEY }} \ SupabaseServiceKey=${{ secrets.SUPABASE_SERVICE_KEY }} \ SupabaseUrl=${{ secrets.SUPABASE_URL }} \ diff --git a/.github/workflows/aws-prod.yml b/.github/workflows/aws-prod.yml index 8db0397d..5d7e19ec 100644 --- a/.github/workflows/aws-prod.yml +++ b/.github/workflows/aws-prod.yml @@ -58,7 +58,7 @@ jobs: GithubAppsClientId=${{ secrets.X_GITHUB_APPS_CLIENT_ID }} \ GithubAppsClientSecret=${{ secrets.X_GITHUB_APPS_CLIENT_SECRET }} \ OpenAIAPIKey=${{ secrets.OPENAI_API_KEY }} \ - OpenAIBaseUrl=${{ vars.OPENAI_BASE_URL }} \ + OpenAIBaseUrl=${{ vars.OPENAI_BASE_URL:-"https://api.openai.com/v1" }} \ GeminiAPIKey=${{ secrets.GEMINI_API_KEY }} \ SupabaseServiceKey=${{ secrets.SUPABASE_SERVICE_KEY }} \ SupabaseUrl=${{ secrets.SUPABASE_URL }} \ From fd475b30bdafe48b989b54b094e4915ec7e64050 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=86=E6=B2=89?= Date: Fri, 13 Sep 2024 22:52:01 +0800 Subject: [PATCH 3/3] 1 --- .github/workflows/aws-preview.yml | 2 +- .github/workflows/aws-prod.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/aws-preview.yml b/.github/workflows/aws-preview.yml index aaa17d1d..8d2a3d76 100644 --- a/.github/workflows/aws-preview.yml +++ b/.github/workflows/aws-preview.yml @@ -64,7 +64,7 @@ jobs: GithubAppsClientId=${{ secrets.X_GITHUB_APPS_CLIENT_ID }} \ GithubAppsClientSecret=${{ secrets.X_GITHUB_APPS_CLIENT_SECRET }} \ OpenAIAPIKey=${{ secrets.OPENAI_API_KEY }} \ - OpenAIBaseUrl=${{ vars.OPENAI_BASE_URL:-"https://api.openai.com/v1" }} \ + OpenAIBaseUrl=${{ vars.OPENAI_BASE_URL || 'https://api.openai.com/v1' }} \ GeminiAPIKey=${{ secrets.GEMINI_API_KEY }} \ SupabaseServiceKey=${{ secrets.SUPABASE_SERVICE_KEY }} \ SupabaseUrl=${{ secrets.SUPABASE_URL }} \ diff --git a/.github/workflows/aws-prod.yml b/.github/workflows/aws-prod.yml index 5d7e19ec..e3292556 100644 --- a/.github/workflows/aws-prod.yml +++ b/.github/workflows/aws-prod.yml @@ -58,7 +58,7 @@ jobs: GithubAppsClientId=${{ secrets.X_GITHUB_APPS_CLIENT_ID }} \ GithubAppsClientSecret=${{ secrets.X_GITHUB_APPS_CLIENT_SECRET }} \ OpenAIAPIKey=${{ secrets.OPENAI_API_KEY }} \ - OpenAIBaseUrl=${{ vars.OPENAI_BASE_URL:-"https://api.openai.com/v1" }} \ + OpenAIBaseUrl=${{ vars.OPENAI_BASE_URL || 'https://api.openai.com/v1' }} \ GeminiAPIKey=${{ secrets.GEMINI_API_KEY }} \ SupabaseServiceKey=${{ secrets.SUPABASE_SERVICE_KEY }} \ SupabaseUrl=${{ secrets.SUPABASE_URL }} \