Skip to content

Commit

Permalink
feat: specify model by query parameter (mckaywrigley#1724)
Browse files Browse the repository at this point in the history
  • Loading branch information
tomoyuki28jp authored Jun 2, 2024
1 parent f3e8554 commit bcbcc04
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions app/[locale]/[workspaceid]/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { getWorkspaceById } from "@/db/workspaces"
import { convertBlobToBase64 } from "@/lib/blob-to-b64"
import { supabase } from "@/lib/supabase/browser-client"
import { LLMID } from "@/types"
import { useParams, useRouter } from "next/navigation"
import { useParams, useRouter, useSearchParams } from "next/navigation"
import { ReactNode, useContext, useEffect, useState } from "react"
import Loading from "../loading"

Expand All @@ -28,6 +28,7 @@ export default function WorkspaceLayout({ children }: WorkspaceLayoutProps) {
const router = useRouter()

const params = useParams()
const searchParams = useSearchParams()
const workspaceId = params.workspaceid as string

const {
Expand Down Expand Up @@ -156,7 +157,9 @@ export default function WorkspaceLayout({ children }: WorkspaceLayoutProps) {
setModels(modelData.models)

setChatSettings({
model: (workspace?.default_model || "gpt-4-1106-preview") as LLMID,
model: (searchParams.get("model") ||
workspace?.default_model ||
"gpt-4-1106-preview") as LLMID,
prompt:
workspace?.default_prompt ||
"You are a friendly, helpful AI assistant.",
Expand Down

0 comments on commit bcbcc04

Please sign in to comment.