Skip to content

Commit

Permalink
Merge branch 'main' into feat/add-update-rag
Browse files Browse the repository at this point in the history
  • Loading branch information
sedationh committed Dec 20, 2024
2 parents 4f69245 + f5443ba commit ae2a11a
Show file tree
Hide file tree
Showing 140 changed files with 2,866 additions and 1,896 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/aws-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,11 @@ jobs:
WebUrl="https://petercat.ai" \
StaticUrl="https://static.petercat.ai" \
PetercatEnv="preview" \
AWSGithubSecretName=${{ secrets.AWS_GITHUB_SECRET_NAME }} \
AWSStaticSecretName=${{ secrets.AWS_STATIC_SECRET_NAME }} \
AWSLLMTokenSecretName=${{ vars.AWS_LLM_TOKEN_SECRET_NAME }} \
AWSLLMTokenPublicName=${{ vars.AWS_LLM_TOKEN_PUBLIC_NAME }} \
AWSStaticKeyPairId=${{ secrets.AWS_STATIC_KEYPAIR_ID }} \
GithubSecretName=${{ secrets.X_GITHUB_SECRET_NAME }} \
StaticSecretName=${{ secrets.STATIC_SECRET_NAME }} \
LLMTokenSecretName=${{ vars.LLM_TOKEN_SECRET_NAME }} \
LLMTokenPublicName=${{ vars.LLM_TOKEN_PUBLIC_NAME }} \
StaticKeyPairId=${{ secrets.STATIC_KEYPAIR_ID }} \
S3TempBucketName=${{ vars.S3_TEMP_BUCKET_NAME }} \
GitHubAppID=${{ secrets.X_GITHUB_APP_ID }} \
GithubAppsClientId=${{ secrets.X_GITHUB_APPS_CLIENT_ID }} \
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/aws-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,11 @@ jobs:
WebUrl="https://petercat.ai" \
StaticUrl="https://static.petercat.ai" \
PetercatEnv="production" \
AWSGithubSecretName=${{ secrets.AWS_GITHUB_SECRET_NAME }} \
AWSStaticSecretName=${{ secrets.AWS_STATIC_SECRET_NAME }} \
AWSLLMTokenSecretName=${{ vars.AWS_LLM_TOKEN_SECRET_NAME }} \
AWSLLMTokenPublicName=${{ vars.AWS_LLM_TOKEN_PUBLIC_NAME }} \
AWSStaticKeyPairId=${{ secrets.AWS_STATIC_KEYPAIR_ID }} \
GithubSecretName=${{ secrets.X_GITHUB_SECRET_NAME }} \
StaticSecretName=${{ secrets.STATIC_SECRET_NAME }} \
LLMTokenSecretName=${{ vars.LLM_TOKEN_SECRET_NAME }} \
LLMTokenPublicName=${{ vars.LLM_TOKEN_PUBLIC_NAME }} \
StaticKeyPairId=${{ secrets.STATIC_KEYPAIR_ID }} \
S3TempBucketName=${{ vars.S3_TEMP_BUCKET_NAME }} \
GitHubAppID=${{ secrets.X_GITHUB_APP_ID }} \
GithubAppsClientId=${{ secrets.X_GITHUB_APPS_CLIENT_ID }} \
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Docker volumnes
docker/volumes/db/data
docker/volumes/storage

# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
__pycache__/
*.pyc
Expand Down Expand Up @@ -59,4 +63,3 @@ next-env.d.ts

dist/
lui/src/style.css

10 changes: 5 additions & 5 deletions README.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,11 +104,11 @@ The project requires environment variables to be set:
| `WEB_URL` | Required | Domain of the frontend web service | `https://petercat.ai` |
| `STATIC_URL` | Required | Static resource domain | `https://static.petercat.ai` |
| **AWS Related Environment Variables** |
| `AWS_GITHUB_SECRET_NAME` | Required | AWS secret file name | `prod/githubapp/petercat/pem` |
| `AWS_STATIC_SECRET_NAME` | Optional | The name of the AWS-managed CloudFront private key. If configured, CloudFront signed URLs will be used to protect your resources. For more information, see the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html). | `prod/petercat/static` |
| `AWS_LLM_TOKEN_SECRET_NAME` | Optional | The name of the LLM signing private key managed by AWS. If configured, Petercat will use the RSA algorithm to manage the user's LLM Token. | `prod/petercat/llm` |
| `AWS_LLM_TOKEN_PUBLIC_NAME` | Optional | The name of the LLM signing public key managed by AWS. If configured, Petercat will use the RSA algorithm to manage the user's LLM Token. | `prod/petercat/llm/pub` |
| `AWS_STATIC_KEYPAIR_ID` | Optional | The Key Pair ID for AWS CloudFront. If configured, CloudFront signed URLs will be used to protect your resources. For more information, see the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html). | `APKxxxxxxxx` |
| `X_GITHUB_SECRET_NAME` | Required | AWS secret file name | `prod/githubapp/petercat/pem` |
| `STATIC_SECRET_NAME` | Optional | The name of the AWS-managed CloudFront private key. If configured, CloudFront signed URLs will be used to protect your resources. For more information, see the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html). | `prod/petercat/static` |
| `LLM_TOKEN_SECRET_NAME` | Optional | The name of the LLM signing private key managed by AWS. If configured, Petercat will use the RSA algorithm to manage the user's LLM Token. | `prod/petercat/llm` |
| `LLM_TOKEN_PUBLIC_NAME` | Optional | The name of the LLM signing public key managed by AWS. If configured, Petercat will use the RSA algorithm to manage the user's LLM Token. | `prod/petercat/llm/pub` |
| `STATIC_KEYPAIR_ID` | Optional | The Key Pair ID for AWS CloudFront. If configured, CloudFront signed URLs will be used to protect your resources. For more information, see the [AWS documentation](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html). | `APKxxxxxxxx` |
| `S3_TEMP_BUCKET_NAME` | Required | AWS S3 bucket for temporary image files | `xxx-temp` |
| `SQS_QUEUE_URL` | Required | AWS SQS queue URL | `https://sqs.ap-northeast-1.amazonaws.com/xxx/petercat-task-queue` |
| **Supabase Related Environment Variables** |
Expand Down
10 changes: 5 additions & 5 deletions README.ja-JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,11 @@
| `WEB_URL` | 必須 | フロントエンドウェブサービスのドメイン | `https://petercat.ai` |
| `STATIC_URL` | 必須 | 静的リソースドメイン | `https://static.petercat.ai` |
| **AWS関連環境変数** |
| `AWS_GITHUB_SECRET_NAME` | 必須 | AWSシークレットファイル名 | `prod/githubapp/petercat/pem` |
| `AWS_STATIC_SECRET_NAME` | オプション | AWSが管理するCloudFrontのプライベートキーの名前。設定されている場合、CloudFrontの署名付きURLが使用され、リソースが保護されます。詳細については、[AWSドキュメント](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html)を参照してください。 | `prod/petercat/static` |
| `AWS_LLM_TOKEN_SECRET_NAME` | オプション | AWSが管理するLLM署名プライベートキーの名前。設定されている場合、PetercatはRSAアルゴリズムを使用してユーザーのLLMトークンを管理します。 | `prod/petercat/llm` |
| `AWS_LLM_TOKEN_PUBLIC_NAME` | オプション | AWSが管理するLLM署名公開キーの名前。設定されている場合、PetercatはRSAアルゴリズムを使用してユーザーのLLMトークンを管理します。 | `prod/petercat/llm/pub` |
| `AWS_STATIC_KEYPAIR_ID` | オプション | AWS CloudFrontのキーID。設定されている場合、CloudFrontの署名付きURLが使用され、リソースが保護されます。詳細については、[AWSドキュメント](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html)を参照してください。 | `APKxxxxxxxx` |
| `X_GITHUB_SECRET_NAME` | 必須 | AWSシークレットファイル名 | `prod/githubapp/petercat/pem` |
| `STATIC_SECRET_NAME` | オプション | AWSが管理するCloudFrontのプライベートキーの名前。設定されている場合、CloudFrontの署名付きURLが使用され、リソースが保護されます。詳細については、[AWSドキュメント](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html)を参照してください。 | `prod/petercat/static` |
| `LLM_TOKEN_SECRET_NAME` | オプション | AWSが管理するLLM署名プライベートキーの名前。設定されている場合、PetercatはRSAアルゴリズムを使用してユーザーのLLMトークンを管理します。 | `prod/petercat/llm` |
| `LLM_TOKEN_PUBLIC_NAME` | オプション | AWSが管理するLLM署名公開キーの名前。設定されている場合、PetercatはRSAアルゴリズムを使用してユーザーのLLMトークンを管理します。 | `prod/petercat/llm/pub` |
| `STATIC_KEYPAIR_ID` | オプション | AWS CloudFrontのキーID。設定されている場合、CloudFrontの署名付きURLが使用され、リソースが保護されます。詳細については、[AWSドキュメント](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html)を参照してください。 | `APKxxxxxxxx` |
| `S3_TEMP_BUCKET_NAME` | 必須 | 一時的な画像ファイル用のAWS S3バケット | `xxx-temp` |
| `SQS_QUEUE_URL` | 必須 | AWS SQSキューURL | `https://sqs.ap-northeast-1.amazonaws.com/xxx/petercat-task-queue` |
| **Supabase関連環境変数** |
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,11 @@
| `WEB_URL` | 必选 | 前端 Web 服务的域名 | `https://petercat.ai`
| `STATIC_URL` | 必选 | 静态资源域名 | `https://static.petercat.ai`
| **AWS 相关环境变量** |
| `AWS_GITHUB_SECRET_NAME` | 必选 | AWS 托管的 Github 私钥文件名 | `prod/githubapp/petercat/pem`
| `AWS_STATIC_SECRET_NAME` | 可选 | AWS 托管的 CloudFront 签名私钥名称。如果配置了该项,将使用 CloudFront 签名 URL 来保护你的资源。更多信息请参阅 [AWS 文档](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html)| `prod/petercat/static` |
| `AWS_LLM_TOKEN_SECRET_NAME` | 可选 | AWS 托管的 llm 签名私钥名称。如果配置了该项,petercat 将使用 RSA 算法托管用户的 LLM Token | `prod/petercat/llm` |
| `AWS_LLM_TOKEN_PUBLIC_NAME` | 可选 | AWS 托管的 llm 签名公钥名称。如果配置了该项,petercat 将使用 RSA 算法托管用户的 LLM Token | `prod/petercat/llm/pub` |
| `AWS_STATIC_KEYPAIR_ID` | 可选 | AWS CloudFront 的 Key Pair ID。如果配置了该项,将使用 CloudFront 签名 URL 来保护你的资源。更多信息请参阅 [AWS 文档](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html)| `APKxxxxxxxx` |
| `X_GITHUB_SECRET_NAME` | 必选 | AWS 托管的 Github 私钥文件名 | `prod/githubapp/petercat/pem`
| `STATIC_SECRET_NAME` | 可选 | AWS 托管的 CloudFront 签名私钥名称。如果配置了该项,将使用 CloudFront 签名 URL 来保护你的资源。更多信息请参阅 [AWS 文档](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html)| `prod/petercat/static` |
| `LLM_TOKEN_SECRET_NAME` | 可选 | AWS 托管的 llm 签名私钥名称。如果配置了该项,petercat 将使用 RSA 算法托管用户的 LLM Token | `prod/petercat/llm` |
| `LLM_TOKEN_PUBLIC_NAME` | 可选 | AWS 托管的 llm 签名公钥名称。如果配置了该项,petercat 将使用 RSA 算法托管用户的 LLM Token | `prod/petercat/llm/pub` |
| `STATIC_KEYPAIR_ID` | 可选 | AWS CloudFront 的 Key Pair ID。如果配置了该项,将使用 CloudFront 签名 URL 来保护你的资源。更多信息请参阅 [AWS 文档](https://docs.aws.amazon.com/AmazonCloudFront/latest/DeveloperGuide/private-content-trusted-signers.html)| `APKxxxxxxxx` |
| `S3_TEMP_BUCKET_NAME` | 可选 | 用于托管 AWS 临时图片文件 S3 的 bucket | `xxx-temp`
| `SQS_QUEUE_URL`| 必选 | AWS SQS 消息队列 URL | `https://sqs.ap-northeast-1.amazonaws.com/xxx/petercat-task-queue`
| **SUPABASE 相关 env** |
Expand Down
2 changes: 1 addition & 1 deletion assistant/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@petercatai/assistant",
"version": "1.0.16",
"version": "1.0.22",
"description": "PeterCat Assistant Application",
"module": "dist/esm/index.js",
"types": "dist/esm/index.d.ts",
Expand Down
4 changes: 2 additions & 2 deletions assistant/src/Chat/template/LoginCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { Button } from 'antd';
import GitHubIcon from '../../icons/GitHubIcon';
import useUser from '../../hooks/useUser';

const LoginCard = ({ apiDomain, token }: { apiDomain: string; token: string; }) => {
const { user, isLoading, actions } = useUser({ apiDomain, fingerprint: token });
const LoginCard = ({ apiDomain, webDomain, token }: { apiDomain: string; webDomain?: string; token: string; }) => {
const { user, isLoading, actions } = useUser({ apiDomain, webDomain, fingerprint: token });

if (isLoading) {
return <Button disabled loading>Loading...</Button>
Expand Down
8 changes: 6 additions & 2 deletions assistant/src/Chat/template/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import GitInsightCard from './GitInsightCard';
import LoginCard from './LoginCard';

export const UITemplateRender = ({ templateId, apiDomain, token, cardData }: { templateId: string, apiDomain: string; token: string; cardData: any }) => {
export const UITemplateRender = ({ templateId, apiDomain, webDomain, token, cardData }: { templateId: string, apiDomain: string; webDomain?: string; token: string; cardData: any }) => {
if (templateId === 'GIT_INSIGHT') {
return (
<GitInsightCard
Expand All @@ -15,7 +15,11 @@ export const UITemplateRender = ({ templateId, apiDomain, token, cardData }: { t

if (templateId === 'LOGIN_INVITE') {
return (
<LoginCard apiDomain={apiDomain} token={token} />
<LoginCard
apiDomain={apiDomain}
webDomain={webDomain}
token={token}
/>
);
}
return null;
Expand Down
6 changes: 3 additions & 3 deletions assistant/src/GitInsight/components/GitInsightIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Lottie from 'lottie-react';
import React, { useMemo } from 'react';

const Fork = require('../../assets/fork.json');
const Commit = require('../../assets/commit.json');
const Star = require('../../assets/star.json');
import * as Commit from '../../assets/commit.json';
import * as Fork from '../../assets/fork.json';
import * as Star from '../../assets/star.json';

interface GitInsightIconProps {
type?: 'fork' | 'commit' | 'star';
Expand Down
5 changes: 3 additions & 2 deletions assistant/src/hooks/useUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import useSWR from 'swr';
import { popupCenter } from '../utils/popcenter';
import { useEffect } from 'react';

function useUser({ apiDomain, fingerprint }: { apiDomain: string; fingerprint: string }) {
function useUser({ apiDomain, webDomain = 'https://petercat.ai', fingerprint }: { apiDomain: string; fingerprint: string; webDomain?: string }) {
const { data: user, isLoading, mutate } = useSWR(
['user.info'],
async () => getUserInfo(apiDomain, { clientId: fingerprint }),
Expand All @@ -14,8 +14,9 @@ function useUser({ apiDomain, fingerprint }: { apiDomain: string; fingerprint: s


const doLogin = () => {
console.log('call do Login', webDomain);
popupCenter({
url: 'https://petercat.ai/user/login',
url: `${webDomain}/user/login`,
title: 'Login',
w: 600,
h: 400,
Expand Down
Loading

0 comments on commit ae2a11a

Please sign in to comment.