Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add base url #67

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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);
}
// const OPENAI_API_BASE_URL = process.env.OPENAI_API_BASE_URL;
// if (!env.NEXT_PUBLIC_FF_MOCK_MODE_ENABLED || !OPENAI_API_BASE_URL) {
// 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:18 ~ createModel ~ options:",
options,
baseOptions
);

return new OpenAI(options, baseOptions);
};

export const startGoalPrompt = new PromptTemplate({
Expand Down