Skip to content

Commit

Permalink
feat: endpoint url
Browse files Browse the repository at this point in the history
  • Loading branch information
Dogtiti committed Apr 27, 2023
1 parent 0a40c0e commit 30ee1fb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 6 deletions.
2 changes: 1 addition & 1 deletion next-i18next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ module.exports = {
typeof window === "undefined"
? require("path").resolve("./public/locales")
: "/locales",
debug: process.env.NODE_ENV === "development",
// debug: process.env.NODE_ENV === "development",
reloadOnPrerender: process.env.NODE_ENV === "development",
ns: ["common", "help", "settings", "chat"],
};
7 changes: 4 additions & 3 deletions src/components/AutonomousAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,10 @@ class AutonomousAgent {

async getInitialTasks(): Promise<string[]> {
if (this.shouldRunClientSide()) {
if (!env.NEXT_PUBLIC_FF_MOCK_MODE_ENABLED) {
await testConnection(this.modelSettings);
}
//FIXME
// if (!env.NEXT_PUBLIC_FF_MOCK_MODE_ENABLED) {
// await testConnection(this.modelSettings);
// }
return await AgentService.startGoalAgent(this.modelSettings, this.goal);
}

Expand Down
2 changes: 2 additions & 0 deletions src/env/schema.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ export const serverSchema = z.object({
NEXTAUTH_SECRET: requiredAuthEnabledForProduction(),
NEXTAUTH_URL: validateNextUrl(),
OPENAI_API_KEY: z.string(),
OPENAI_API_BASE_URL: z.string().url().optional(),
GOOGLE_CLIENT_ID: requiredAuthEnabledForProduction(),
GOOGLE_CLIENT_SECRET: requiredAuthEnabledForProduction(),
GITHUB_CLIENT_ID: requiredAuthEnabledForProduction(),
Expand Down Expand Up @@ -73,6 +74,7 @@ export const serverEnv = {
NEXTAUTH_SECRET: process.env.NEXTAUTH_SECRET,
NEXTAUTH_URL: process.env.NEXTAUTH_URL ?? "http://localhost:3000",
OPENAI_API_KEY: process.env.OPENAI_API_KEY,
OPENAI_API_BASE_URL: process.env.OPENAI_API_BASE_URL,
GOOGLE_CLIENT_ID: process.env.GOOGLE_CLIENT_ID,
GOOGLE_CLIENT_SECRET: process.env.GOOGLE_CLIENT_SECRET,
GITHUB_CLIENT_ID: process.env.GITHUB_CLIENT_ID,
Expand Down
15 changes: 13 additions & 2 deletions src/utils/prompts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,23 @@ export const createModel = (settings: ModelSettings) => {
_settings = undefined;
}

return new OpenAI({
const options = {
openAIApiKey: _settings?.customApiKey || process.env.OPENAI_API_KEY,
temperature: _settings?.customTemperature || 0.9,
modelName: _settings?.customModelName || GPT_35_TURBO,
maxTokens: _settings?.maxTokens || 400,
});
};

const baseOptions = {
basePath: process.env.OPENAI_API_BASE_URL,
};
console.log(
"Dogtiti ~ file: prompts.ts:22 ~ createModel ~ options:",
options,
baseOptions
);

return new OpenAI(options, baseOptions);
};

export const startGoalPrompt = new PromptTemplate({
Expand Down

0 comments on commit 30ee1fb

Please sign in to comment.