Skip to content
Open
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
5 changes: 5 additions & 0 deletions prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ model User {
subscriptionStart DateTime?
subscriptionEnd DateTime?
apiKey String? @default("null")
baseUrl String? @default("https://api.openai.com/v1")
llmApiKey String? @default("null")
llmModel String? @default("gpt-4o")
llmTemperature Float? @default(0.7)
llmTopP Float? @default(1.0)
collections Collection[]
learnSteps String @default("10m 1d")
relearnSteps String @default("10m")
Expand Down
34 changes: 30 additions & 4 deletions src/components/app/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,26 @@ import React, { useState, useEffect, useRef } from 'react';
import hljs from 'highlight.js';
import 'highlight.js/styles/atom-one-dark-reasonable.css';

const ChatWindow = ({ problem, editorContent, apiKey, onClose, buttonPosition }: {
const ChatWindow = ({
problem,
editorContent,
apiKey,
baseUrl,
llmApiKey,
llmModel,
llmTemperature,
llmTopP,
onClose,
buttonPosition
}: {
problem: any,
editorContent: string,
apiKey: any,
apiKey: any,
baseUrl?: string,
llmApiKey?: string,
llmModel?: string,
llmTemperature?: number,
llmTopP?: number,
onClose: () => void,
buttonPosition: { x: number, y: number } | null
}) => {
Expand All @@ -32,6 +48,11 @@ const ChatWindow = ({ problem, editorContent, apiKey, onClose, buttonPosition }:
userSolution: editorContent,
userMessage: "analyze", // Special flag to just analyze the code
apiKey: apiKey,
baseUrl: baseUrl,
llmApiKey: llmApiKey,
llmModel: llmModel,
llmTemperature: llmTemperature,
llmTopP: llmTopP,
mode: "analyze" // Tell the API we're just loading context
}),
});
Expand Down Expand Up @@ -59,7 +80,7 @@ const ChatWindow = ({ problem, editorContent, apiKey, onClose, buttonPosition }:
};

analyzeCode();
}, [problem, editorContent, apiKey]);
}, [problem, editorContent, apiKey, baseUrl, llmApiKey, llmModel, llmTemperature, llmTopP]);

useEffect(() => {
hljs.highlightAll();
Expand Down Expand Up @@ -101,6 +122,11 @@ const ChatWindow = ({ problem, editorContent, apiKey, onClose, buttonPosition }:
userSolution: editorContent,
userMessage: initialMessage || input,
apiKey: apiKey,
baseUrl: baseUrl,
llmApiKey: llmApiKey,
llmModel: llmModel,
llmTemperature: llmTemperature,
llmTopP: llmTopP,
mode: "chat" // Specify we're in chat mode now
}),
});
Expand Down Expand Up @@ -454,4 +480,4 @@ const ChatWindow = ({ problem, editorContent, apiKey, onClose, buttonPosition }:
);
};

export default ChatWindow;
export default ChatWindow;
Loading