Add model support
This commit is contained in:
@@ -23,6 +23,7 @@
|
||||
import { alertConfirm } from "src/ts/alert";
|
||||
import OobaSettings from "./OobaSettings.svelte";
|
||||
import Arcodion from "src/lib/UI/Arcodion.svelte";
|
||||
import { startsWith } from "lodash";
|
||||
|
||||
let tokens = {
|
||||
mainPrompt: 0,
|
||||
@@ -198,6 +199,10 @@
|
||||
<Check bind:check={$DataBase.reverseProxyOobaMode} name={`${language.reverseProxyOobaMode}`}/>
|
||||
</div>
|
||||
{/if}
|
||||
{#if $DataBase.aiModel.startsWith('risullm')}
|
||||
<span class="text-textcolor mt-4">Risu {language.apiKey}</span>
|
||||
<TextInput marginBottom={false} size={"sm"} bind:value={$DataBase.proxyKey} />
|
||||
{/if}
|
||||
{#if $DataBase.aiModel === 'openrouter' || $DataBase.subModel === 'openrouter'}
|
||||
<span class="text-textcolor mt-4">Openrouter Key</span>
|
||||
<TextInput marginBottom={false} size={"sm"} bind:value={$DataBase.openrouterKey} />
|
||||
|
||||
@@ -129,13 +129,13 @@
|
||||
{/each}
|
||||
{/await}
|
||||
</Arcodion>
|
||||
<button class="hover:bg-selected px-6 py-2 text-lg" on:click={() => {changeModel('oaicomp')}}>Custom (OpenAI-compatible)</button>
|
||||
{#if showUnrec}
|
||||
<Arcodion name="WebLLM Local">
|
||||
<button class="hover:bg-selected px-6 py-2 text-lg" on:click={() => {changeModel('hf:::Xenova/opt-350m')}}>opt-350m</button>
|
||||
<button class="hover:bg-selected px-6 py-2 text-lg" on:click={() => {changeModel('hf:::Xenova/tiny-random-mistral')}}>tiny-random-mistral</button>
|
||||
<button class="hover:bg-selected px-6 py-2 text-lg" on:click={() => {changeModel('hf:::Xenova/gpt2-large-conversational')}}>gpt2-large-conversational</button>
|
||||
</Arcodion>
|
||||
<button class="hover:bg-selected px-6 py-2 text-lg" on:click={() => {changeModel('risullm-proto')}}>RisuAI LLM (Prototype)</button>
|
||||
{/if}
|
||||
{#if $DataBase.plugins.length > 0}
|
||||
<button on:click={() => {changeModel('custom')}} class="hover:bg-selected px-6 py-2 text-lg" >Plugin</button>
|
||||
|
||||
@@ -1439,6 +1439,48 @@ export async function requestChatDataMain(arg:requestDataArgument, model:'model'
|
||||
'result': result
|
||||
}
|
||||
}
|
||||
case 'risullm-proto':{
|
||||
const res = await globalFetch('https://sv.risuai.xyz/risullm', {
|
||||
body: {
|
||||
messages: formated.map((v) => {
|
||||
if(v.role === 'system'){
|
||||
return {
|
||||
role: "user",
|
||||
content: "System: " + v.content
|
||||
}
|
||||
}
|
||||
if(v.role === 'function'){
|
||||
return {
|
||||
role: "user",
|
||||
content: "Function: " + v.content
|
||||
|
||||
}
|
||||
}
|
||||
return {
|
||||
role: v.role,
|
||||
content: v.content
|
||||
}
|
||||
})
|
||||
},
|
||||
headers: {
|
||||
"X-Api-Key": db.proxyKey
|
||||
}
|
||||
})
|
||||
|
||||
const resp:string = res?.data?.response
|
||||
|
||||
if(!resp){
|
||||
return {
|
||||
type: 'fail',
|
||||
result: JSON.stringify(res.data)
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
type: 'success',
|
||||
result: resp.replace(/\\n/g, '\n')
|
||||
}
|
||||
}
|
||||
default:{
|
||||
if(raiModel.startsWith('claude-3')){
|
||||
let replacerURL = (aiModel === 'reverse_proxy') ? (db.forceReplaceUrl) : ('https://api.anthropic.com/v1/messages')
|
||||
|
||||
Reference in New Issue
Block a user