mirror of
https://github.com/willchen96/mike.git
synced 2026-06-18 21:15:13 +02:00
feat: add OpenAI model support and harden OSS security defaults
This commit is contained in:
parent
adc2cf2370
commit
bef75b082d
24 changed files with 1301 additions and 364 deletions
|
|
@ -37,6 +37,7 @@ import {
|
|||
isModelAvailable,
|
||||
type ModelProvider,
|
||||
} from "@/app/lib/modelAvailability";
|
||||
import type { ApiKeyState } from "@/app/lib/mikeApi";
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Types
|
||||
|
|
@ -454,7 +455,7 @@ function TRChatInput({
|
|||
onCancel: () => void;
|
||||
model: string;
|
||||
onModelChange: (id: string) => void;
|
||||
apiKeys: { claudeApiKey: string | null; geminiApiKey: string | null };
|
||||
apiKeys?: ApiKeyState;
|
||||
onHeightChange: (height: number) => void;
|
||||
}) {
|
||||
const [value, setValue] = useState("");
|
||||
|
|
@ -642,10 +643,7 @@ export function TRChatPanel({
|
|||
onChatIdChange,
|
||||
}: Props) {
|
||||
const { profile, updateModelPreference } = useUserProfile();
|
||||
const apiKeys = {
|
||||
claudeApiKey: profile?.claudeApiKey ?? null,
|
||||
geminiApiKey: profile?.geminiApiKey ?? null,
|
||||
};
|
||||
const apiKeys = profile?.apiKeys;
|
||||
const currentModel = profile?.tabularModel ?? "gemini-3-flash-preview";
|
||||
const [apiKeyModalProvider, setApiKeyModalProvider] =
|
||||
useState<ModelProvider | null>(null);
|
||||
|
|
@ -993,7 +991,7 @@ export function TRChatPanel({
|
|||
|
||||
async function handleSubmit(trimmed: string) {
|
||||
if (!trimmed || isLoading) return;
|
||||
if (!isModelAvailable(currentModel, apiKeys)) {
|
||||
if (apiKeys && !isModelAvailable(currentModel, apiKeys)) {
|
||||
setApiKeyModalProvider(getModelProvider(currentModel));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,10 +87,7 @@ export function TRView({ reviewId, projectId }: Props) {
|
|||
const tableRef = useRef<TRTableHandle>(null);
|
||||
const router = useRouter();
|
||||
const { profile } = useUserProfile();
|
||||
const apiKeys = {
|
||||
claudeApiKey: profile?.claudeApiKey ?? null,
|
||||
geminiApiKey: profile?.geminiApiKey ?? null,
|
||||
};
|
||||
const apiKeys = profile?.apiKeys;
|
||||
const tabularModel = profile?.tabularModel ?? "gemini-3-flash-preview";
|
||||
|
||||
useEffect(() => {
|
||||
|
|
@ -243,7 +240,7 @@ export function TRView({ reviewId, projectId }: Props) {
|
|||
// If columns changed since last save, update the review first
|
||||
if (columns.length === 0) return;
|
||||
|
||||
if (!isModelAvailable(tabularModel, apiKeys)) {
|
||||
if (apiKeys && !isModelAvailable(tabularModel, apiKeys)) {
|
||||
setApiKeyModalProvider(getModelProvider(tabularModel));
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue