Skip to content

Commit fca0f4e

Browse files
remove selfmod from tool calling
1 parent 2741d37 commit fca0f4e

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
lines changed

app/api/auth/route.ts

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
import { codeChallengeMethod, openRouterBaseUrl } from '@/lib/utils'
1+
import {
2+
codeChallengeMethod,
3+
openRouterAPIBaseUrl,
4+
openRouterWebUrl
5+
} from '@/lib/utils'
26
import { NextRequest, NextResponse } from 'next/server'
37

48
export async function POST(req: NextRequest) {
@@ -13,7 +17,8 @@ export async function POST(req: NextRequest) {
1317
}
1418

1519
try {
16-
const response = await fetch(`${openRouterBaseUrl}/api/v1/auth/keys`, {
20+
// TODO switch to api url
21+
const response = await fetch(`${openRouterWebUrl}/api/v1/auth/keys`, {
1722
method: 'POST',
1823
headers: {
1924
'Content-Type': 'application/json'

app/openrouter-auth-provider.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import { useQueryState } from 'nuqs'
1111
import { toast } from 'sonner'
1212
import { useLocalStorage } from '@uidotdev/usehooks'
1313
import { getCodeChallenge, getCodeVerifier } from '@/lib/auth'
14-
import { codeChallengeMethod, getSiteURL, openRouterBaseUrl } from '@/lib/utils'
14+
import { codeChallengeMethod, getSiteURL, openRouterWebUrl } from '@/lib/utils'
1515

1616
interface OpenRouterAuthContextType {
1717
openRouterKey: string | null
@@ -27,7 +27,7 @@ const OpenRouterAuthContext = createContext<
2727
OpenRouterAuthContextType | undefined
2828
>(undefined)
2929

30-
const oauthBaseUrl = `${openRouterBaseUrl}/auth`
30+
const oauthBaseUrl = `${openRouterWebUrl}/auth`
3131

3232
export function OpenRouterAuthProvider({
3333
children

components/model-select.tsx

+7-9
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,13 @@ export function ModelSelectContent() {
7676
</SelectItem>
7777
]
7878
}
79-
return (
80-
models
81-
// .filter(model => featuredToolCallingModels.includes(model.id))
82-
.map(model => (
83-
<SelectItem key={model.id} value={model.id}>
84-
{model.name}
85-
</SelectItem>
86-
))
87-
)
79+
return models
80+
.filter(model => !model.id.includes(':'))
81+
.map(model => (
82+
<SelectItem key={model.id} value={model.id}>
83+
{model.name}
84+
</SelectItem>
85+
))
8886
}, [models, isLoading, error])
8987

9088
return (

lib/chat/actions.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ import {
2929
runAsyncFnWithoutBlocking,
3030
sleep,
3131
nanoid,
32-
openRouterBaseUrl,
32+
openRouterAPIBaseUrl,
3333
mistralNanoid
3434
} from '@/lib/utils'
3535
import { saveChat } from '@/app/actions'
@@ -205,7 +205,7 @@ async function submitUserMessage(
205205
let textNode: undefined | React.ReactNode
206206

207207
const openrouter = createOpenRouter({
208-
baseURL: openRouterBaseUrl + '/api/alpha/',
208+
baseURL: openRouterAPIBaseUrl + '/api/v1/',
209209
apiKey: openRouterKey ?? process.env.OPENROUTER_API_KEY
210210
// send extra body parameters to openrouter if needed: https://openrouter.ai/docs
211211
// extraBody: {

lib/hooks/use-models.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import useSWR from 'swr'
2-
import { openRouterBaseUrl } from '../utils'
2+
import { openRouterAPIBaseUrl } from '../utils'
33

44
interface Model {
55
id: string
@@ -20,7 +20,7 @@ const fetcher = async (url: string): Promise<ModelsResponse> => {
2020

2121
export function useModels() {
2222
const { data, error, isLoading } = useSWR<ModelsResponse>(
23-
`${openRouterBaseUrl}/api/v1/models?supported_parameters=tools`,
23+
`${openRouterAPIBaseUrl}/api/v1/models?supported_parameters=tools`,
2424
fetcher,
2525
{
2626
revalidateOnFocus: false,

lib/utils.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import { clsx, type ClassValue } from 'clsx'
22
import { customAlphabet } from 'nanoid'
33
import { twMerge } from 'tailwind-merge'
44

5-
export const openRouterBaseUrl =
5+
export const openRouterAPIBaseUrl =
66
process.env.NEXT_PUBLIC_OPENROUTER_BASE_URL || 'https://openrouter.ai'
7+
export const openRouterWebUrl =
8+
process.env.NEXT_PUBLIC_OPENROUTER_WEB_URL || 'https://openrouter.ai'
79
export const codeChallengeMethod = 'S256'
810

911
export function removeTrailingSlash(str: string) {

0 commit comments

Comments
 (0)