fix params

This commit is contained in:
josc146 2023-07-28 22:13:19 +08:00
parent d2928e54f7
commit 9d89b6f4db
3 changed files with 7 additions and 7 deletions

View File

@ -25,7 +25,7 @@ class ChatCompletionBody(ModelConfigBody):
messages: List[Message]
model: str = "rwkv"
stream: bool = False
stop: str | List[str] = None
stop: Union[str, List[str]] = None
class Config:
schema_extra = {
@ -47,7 +47,7 @@ class CompletionBody(ModelConfigBody):
prompt: Union[str, List[str]]
model: str = "rwkv"
stream: bool = False
stop: str | List[str] = None
stop: Union[str, List[str]] = None
class Config:
schema_extra = {

View File

@ -3,7 +3,7 @@ import os
import pathlib
import copy
import re
from typing import Dict, Iterable, List, Tuple
from typing import Dict, Iterable, List, Tuple, Union
from utils.log import quick_log
from fastapi import HTTPException
from pydantic import BaseModel, Field
@ -213,7 +213,7 @@ class AbstractRWKV(ABC):
return state[0].tolist(), token_len
def generate(
self, prompt: str, stop: str | List[str] = None
self, prompt: str, stop: Union[str, List[str]] = None
) -> Iterable[Tuple[str, str, int, int]]:
quick_log(None, None, "Generation Prompt:\n" + prompt)
cache = None

View File

@ -72,7 +72,7 @@ const CompositionPanel: FC = observer(() => {
const setSoundFont = async () => {
let soundUrl: string;
if (params.useLocalSoundFont)
if (commonStore.compositionParams.useLocalSoundFont)
soundUrl = 'assets/sound-font';
else
soundUrl = !commonStore.settings.giteeUpdatesSource ?
@ -117,7 +117,7 @@ const CompositionPanel: FC = observer(() => {
'Content-Type': 'application/json'
},
body: JSON.stringify({
'text': params.prompt.replaceAll(/<pad>|<start>|<end>/g, '').replaceAll(' ', '').trim()
'text': commonStore.compositionParams.prompt.replaceAll(/<pad>|<start>|<end>/g, '').replaceAll(' ', ' ').trim()
})
}).then(r => {
r.arrayBuffer().then(midi => {
@ -168,7 +168,7 @@ const CompositionPanel: FC = observer(() => {
scrollToBottom();
if (e.data.trim() === '[DONE]') {
commonStore.setCompositionGenerating(false);
generateNs(params.autoPlay);
generateNs(commonStore.compositionParams.autoPlay);
return;
}
let data;