Skip to content

Commit

Permalink
feat: vercel configuration & github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianmusial committed Dec 29, 2023
1 parent b61dfe9 commit 1feb1bf
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 6 deletions.
22 changes: 22 additions & 0 deletions .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
@@ -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 }}
12 changes: 8 additions & 4 deletions src/chat/agents/pokemon/pokemon.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,15 @@ export class PokemonService {
private readonly configService: ConfigService,
) {}

async getPokemon(name: string): Promise<string> {
async getPokemon(name: string): Promise<object> {
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'],
})),
),
);
}
}
4 changes: 2 additions & 2 deletions src/chat/chat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {},
Expand Down
21 changes: 21 additions & 0 deletions vercel.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
]
}

0 comments on commit 1feb1bf

Please sign in to comment.