Skip to content

Commit

Permalink
use environment variable to avoid hard-coding
Browse files Browse the repository at this point in the history
  • Loading branch information
wongpiwat committed Oct 1, 2024
1 parent 94d08ab commit bbd88fb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 2 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
NEXT_PUBLIC_AI_API_ENDPOINT=example
NEXT_PUBLIC_AI_SECRET_KEY=example
7 changes: 2 additions & 5 deletions src/services/ai.service.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import axios from "axios";

// const API_ENDPOINT = "http://localhost:3000";
const API_ENDPOINT =
"https://generativelanguage.googleapis.com/v1beta/models/gemini-1.5-flash-latest:generateContent";

const SECRET_KEY = "AIzaSyCY2TWacfM4DbyMQNKLuSrdyH9e_p3K44c";
const API_ENDPOINT = process.env.NEXT_PUBLIC_AI_API_ENDPOINT;
const SECRET_KEY = process.env.NEXT_PUBLIC_AI_SECRET_KEY;

export const send = async (text: string) => {
const options = {
Expand Down

0 comments on commit bbd88fb

Please sign in to comment.