diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml new file mode 100644 index 0000000..3da0d11 --- /dev/null +++ b/.github/workflows/deploy.yaml @@ -0,0 +1,22 @@ +name: Vercel Production Deployment +env: + VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} + VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} +on: + push: + branches: + - main + - feat/assistant +jobs: + Deploy-Production: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Install Vercel CLI + run: npm install --global vercel@latest + - name: Pull Vercel Environment Information + run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} + - name: Build Project Artifacts + run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} + - name: Deploy Project Artifacts to Vercel + run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} \ No newline at end of file diff --git a/src/chat/agents/pokemon/pokemon.service.ts b/src/chat/agents/pokemon/pokemon.service.ts index dfe1ae9..e92ff42 100644 --- a/src/chat/agents/pokemon/pokemon.service.ts +++ b/src/chat/agents/pokemon/pokemon.service.ts @@ -12,11 +12,15 @@ export class PokemonService { private readonly configService: ConfigService, ) {} - async getPokemon(name: string): Promise { + async getPokemon(name: string): Promise { return firstValueFrom( - this.httpService - .get(`${this.apiUrl}/pokemon/${name.toLowerCase()}`) - .pipe(map(res => res.data)), + this.httpService.get(`${this.apiUrl}/pokemon/${name.toLowerCase()}`).pipe( + map(res => res.data), + map(res => ({ + name: res?.['name'], + stats: res?.['stats'], + })), + ), ); } } diff --git a/src/chat/chat.config.ts b/src/chat/chat.config.ts index ff31258..0ae23b8 100644 --- a/src/chat/chat.config.ts +++ b/src/chat/chat.config.ts @@ -3,8 +3,8 @@ import { AssistantCreateParams } from 'openai/resources/beta'; import { AssistantConfig } from '../assistant/assistant.model'; export const assistantParams: AssistantCreateParams = { - name: 'AI Template', - instructions: `You are a personal assistant.`, + name: 'Pokemon Assistant', + instructions: `You can ask questions about Pokemon. For example, "What is Pikachu's type?" or "What is Pikachu's base stats?", or "Which pokemon has a bigger chance of winning in a battle between Pikachu and Charmander?".`, tools: [{ type: 'retrieval' }], model: 'gpt-4-1106-preview', metadata: {}, diff --git a/vercel.json b/vercel.json new file mode 100644 index 0000000..5d6f064 --- /dev/null +++ b/vercel.json @@ -0,0 +1,21 @@ +{ + "version": 2, + "builds": [ + { + "src": "src/main.ts", + "use": "@vercel/node" + } + ], + "routes": [ + { + "src": "/(.*)", + "dest": "src/main.ts", + "methods": [ + "GET", + "POST", + "PUT", + "DELETE" + ] + } + ] +} \ No newline at end of file