Skip to content

Commit

Permalink
Add gemini 2 pro (#1107)
Browse files Browse the repository at this point in the history
  • Loading branch information
sceuick authored Feb 11, 2025
1 parent 3f8eab2 commit d69f79b
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 25 deletions.
6 changes: 6 additions & 0 deletions common/adapters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -282,6 +282,12 @@ export const GOOGLE_MODELS = {
GEMINI_15_FLASH_8B: { id: 'gemini-1.5-flash-8b', label: 'Gemini 1.5 Flash 8B' },
GEMINI_EXP_1114: { id: 'gemini-exp-1114', label: 'Gemini Exp 1114' },
GEMINI_20_FLASH: { id: 'gemini-2.0-flash-exp', label: 'Gemini 2.0 Flash' },
GEMINI_20_FLASH_EXP: { id: 'gemini-2.0-flash-exp', label: 'Gemini 2.0 Flash Exp' },
GEMINI_20_FLASH_THINKING: {
id: 'gemini-2.0-flash-thinking-exp-01-21',
label: 'Gemini 2.0 Flash Thinking',
},
GEMINI_20_PRO_0205: { id: 'gemini-2.0-pro-exp-02-05', label: 'Gemini 2.0 02/05' },
}

export const GOOGLE_LIMITS: Record<string, number> = {
Expand Down
4 changes: 2 additions & 2 deletions srv/adapter/agnaistic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ export const handleAgnaistic: ModelAdapter = async function* (opts) {
const srv = await getServerConfiguration()

/**
* Lock per user per model
* Lock per user
*/
const lockId = `${opts.user._id}-${opts.subscription.preset.name}`
const lockId = `${opts.user._id}`
if (!opts.guidance && +srv.lockSeconds > 0) {
await obtainLock(lockId, srv.lockSeconds)
}
Expand Down
1 change: 1 addition & 0 deletions srv/adapter/payloads.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ function getBasePayload(opts: AdapterProps, stops: string[] = []) {
}

const body: any = {
request_id: opts.requestId,
prompt,
context_limit: gen.maxContextLength,
max_new_tokens: gen.maxTokens,
Expand Down
31 changes: 17 additions & 14 deletions web/pages/Character/DownloadModal.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
import {
Component,
Match,
Switch,
createEffect,
createMemo,
createSignal,
on,
onMount,
} from 'solid-js'
import { Component, Match, Switch, createEffect, createMemo, createSignal, on } from 'solid-js'
import { AppSchema } from '/common/types/schema'
import Select from '/web/shared/Select'
import Modal from '/web/shared/Modal'
Expand All @@ -32,8 +23,18 @@ export const DownloadModal: Component<{
}> = (props) => {
let ref: any
const [char, setChar] = createSignal<AppSchema.Character | undefined>(props.char)
onMount(async () => {
if (props.char) return

createEffect(async () => {
if (!props.char && !props.charId) {
setChar(undefined)
return
}

if (props.char) {
setChar(props.char)
return
}

const res = await charsApi.getCharacterDetail(props.charId)
if (res.result) {
setChar(res.result)
Expand Down Expand Up @@ -80,8 +81,10 @@ export const DownloadModal: Component<{
)

const objectUrl = createMemo(() => {
if (!char()) return

const url = URL.createObjectURL(
new Blob([charToJson(props.char || char()!, format())], { type: 'text/json' })
new Blob([charToJson(char()!, format())], { type: 'text/json' })
)
return url
})
Expand All @@ -106,7 +109,7 @@ export const DownloadModal: Component<{
</Match>

<Match when={fileType() === 'png'}>
<Button onClick={() => downloadCharCard(props.char || props.charId, format())}>
<Button disabled={!char()} onClick={() => downloadCharCard(char()!, format())}>
<Save /> Download (PNG)
</Button>
</Match>
Expand Down
10 changes: 1 addition & 9 deletions web/shared/ServiceWarning.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,7 @@ const ServiceWarning: Component<{ preset?: Partial<AppSchema.GenSettings> }> = (
</span>
</Match>

<Match when={props.preset?.service === 'horde' && !user?.hordeName}>
<TitleCard type="orange">
Register at{' '}
<a class="link" href="https://aihorde.net/register" target="_blank">
AIHorde
</a>{' '}
for a better Horde experience.
</TitleCard>
</Match>
<Match when>{null}</Match>
</Switch>
)
}
Expand Down

0 comments on commit d69f79b

Please sign in to comment.