Skip to content

Commit

Permalink
Merge pull request #81 from nkc-ug/develop
Browse files Browse the repository at this point in the history
Release:2023/8/28
  • Loading branch information
Yuma-Satake authored Aug 27, 2023
2 parents 9c6bab4 + 795e3df commit 12e02e2
Show file tree
Hide file tree
Showing 50 changed files with 1,736 additions and 720 deletions.
4 changes: 3 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
root: true,
env: { browser: true, es2020: true },
extends: [
'eslint:recommended',
Expand All @@ -10,5 +11,6 @@ module.exports = {
plugins: ['react-refresh'],
rules: {
'react-refresh/only-export-components': 'warn',
'react-hooks/exhaustive-deps': 'off',
},
}
};
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: ci

on:
push:
branches: ['main', 'develop']
pull_request:
branches: ['main', 'develop']

jobs:
eslint:
name: Run eslint scanning
runs-on: ubuntu-latest
steps:
- name: Checkout code #コードを持ってくる
uses: actions/checkout@v3

- name: Install ESLint #ESlintをインストールする
run: |
npm install [email protected]
npm install @microsoft/[email protected]
- name: Run ESLint #ESLintを実行する
run: npx eslint ./src --ext .js,.jsx,.ts,.tsx --format @microsoft/eslint-formatter-sarif
--output-file eslint-results.sarif
continue-on-error: true

- name: Upload analysis results to GitHub #githubに解析結果をアップロード
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: eslint-results.sarif
wait-for-processing: true

rome:
name: Run rome scanning
runs-on: ubuntu-latest
steps:
- name: Checkout code #コードを持ってくる
uses: actions/checkout@v3

- name: Install Rome #romeをインストールする
run: |
npm install [email protected]
- name: Run Rome #romeを実行
run: npx rome check ./src
38 changes: 37 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,37 @@
# yagi5108
# GijukuCAMP_MonthlyHackathonVol.5_TeamNKC-ヤギ係

【技育 CAMP】マンスリーハッカソン vol.5 チーム"NKC-ヤギ係"制作物

# 制作物名

言の葉を食べるヤギ(ことのはをたべるやぎ)

# ドキュメント

- [ディレクトリ構成](./doc/composition.md)

# 技術スタック

## フロントエンド

- React
- Vite
- MUI

## バックエンド

- Firebaes

## ツール

- Github
- GithubActions ( Eslint / Rome )
- Figma

# 開発メンバー

- [Yuma-Satake](https://github.com/Yuma-Satake)
- [MinamizonoEno](https://github.com/MinamizonoEno)
- [Mount-Book](https://github.com/Mount-Book)
- [suzukihaya](https://github.com/suzukihaya)
- [uchiyamaairi](https://github.com/uchiyamaairi)
5 changes: 5 additions & 0 deletions doc/battle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
バトルする
勝つ
ツイートできるようにする
負ける
励ましの言葉をヤギにかける
78 changes: 78 additions & 0 deletions doc/composition.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# ディレクトリ構成

## ツリー表示

```
.
├── .github
│ └── workflows
│ ├── ci.yml
│ └── firebase-hosting-merge.yml
├── doc
│ ├── api.md
│ └── composition.md
├── functions
│ ├── lib
│ │ ├── index.js
│ │ └── index.js.map
│ ├── src
│ │ └── index.ts
│ ├── .gitignore
│ ├── package-lock.json
│ ├── package.json
│ ├── README.md
│ └── tsconfig.json
├── public
│ └── favicon.ico
├── src
│ ├── assets
│ ├── Audio
│ ├── components
│ │ ├── Bgm.tsx
│ │ ├── Branch.tsx
│ │ ├── Eat.tsx
│ │ ├── EvolutionPopup.tsx
│ │ ├── EvolutionWalk.tsx
│ │ ├── FlowerPopup.tsx
│ │ ├── Form.tsx
│ │ ├── getEmotionApi.ts
│ │ ├── NavBar.tsx
│ │ ├── NormalWalk.tsx
│ │ ├── Pulse.tsx
│ │ └── Tutorial.tsx
│ ├── hooks
│ │ └── useDiscloser.ts
│ ├── pages
│ │ └── AppView.tsx
│ ├── routes
│ │ └── Routers.tsx
│ ├── theme
│ │ ├── palette.ts
│ │ ├── theme.ts
│ │ └── typography.ts
│ ├── types
│ │ ├── EatLimit.ts
│ │ ├── EmotionDataType.ts
│ │ └── import-image.d.ts
│ ├── App.tsx
│ ├── main.tsx
│ └── vite-env.d.ts
├── .env.template
├── .eslintrc.cjs
├── .firebaserc
├── .gitignore
├── .prettierrc
├── firebase.json
├── index.html
├── package-lock.json
├── package.json
├── README.md
├── tsconfig.json
├── tsconfig.node.json
└── vite.config.ts
```

## ディレクトリの説明

- `src/components`: React コンポーネントを格納するディレクトリ
- `src/pages`: 各ページのコンポーネントを格納するディレクトリ
7 changes: 7 additions & 0 deletions eslint-results.sarif
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"runs": [
{
"results": []
}
]
}
44 changes: 44 additions & 0 deletions functions/lib/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion functions/lib/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

50 changes: 50 additions & 0 deletions functions/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,3 +112,53 @@ ${reqText}というワードがどのような場面で利用されるかを"Joy
return;
}
});

exports.gptwrapper = onRequest({ cors: [/firebase\.com$/, 'flutter.com'] }, async (req, res) => {
/**
* 本番環境ではコメントアウトする
*/
res.setHeader('Access-Control-Allow-Origin', '*');

//reqText
const reqText = req.query.text;
if (!reqText) {
res.status(400).send('NoText');
return;
}

//context
const requestContext = reqText as string;

try {
//config
if (!apiKey) {
res.status(500).send('NoApiKey');
return;
}
const config = new Configuration({
apiKey: apiKey,
});

//params
const params: CreateChatCompletionRequest = {
model: 'gpt-3.5-turbo',
messages: [{ role: 'user', content: requestContext }],
};

//OpenAI
const aiInstance = new OpenAIApi(config);
const openAiRes = await aiInstance.createChatCompletion(params);
const aiResText = openAiRes.data.choices[0].message?.content;

if (!aiResText) {
res.status(500).send('GPTError');
return;
}

res.status(200).send(openAiRes.data);
return;
} catch (e) {
res.status(500).send(e);
return;
}
});
Loading

0 comments on commit 12e02e2

Please sign in to comment.