Prep 0.18.1 (#72)

* prevent client ctx from being unset

* fix issue with LMStudio client ctx size not sticking

* 0.18.1
This commit is contained in:
veguAI
2024-01-31 09:46:51 +02:00
committed by GitHub
parent bdbf14c1ed
commit 4ba635497b
6 changed files with 19 additions and 11 deletions

View File

@@ -4,7 +4,7 @@ build-backend = "poetry.masonry.api"
[tool.poetry] [tool.poetry]
name = "talemate" name = "talemate"
version = "0.18.0" version = "0.18.1"
description = "AI-backed roleplay and narrative tools" description = "AI-backed roleplay and narrative tools"
authors = ["FinalWombat"] authors = ["FinalWombat"]
license = "GNU Affero General Public License v3.0" license = "GNU Affero General Public License v3.0"

View File

@@ -2,4 +2,4 @@ from .agents import Agent
from .client import TextGeneratorWebuiClient from .client import TextGeneratorWebuiClient
from .tale_mate import * from .tale_mate import *
VERSION = "0.18.0" VERSION = "0.18.1"

View File

@@ -118,7 +118,7 @@ class ClientBase:
if "api_url" in kwargs: if "api_url" in kwargs:
self.api_url = kwargs["api_url"] self.api_url = kwargs["api_url"]
if "max_token_length" in kwargs: if kwargs.get("max_token_length"):
self.max_token_length = kwargs["max_token_length"] self.max_token_length = kwargs["max_token_length"]
if "enabled" in kwargs: if "enabled" in kwargs:

View File

@@ -7,12 +7,11 @@ from talemate.client.registry import register
class Defaults(pydantic.BaseModel): class Defaults(pydantic.BaseModel):
api_url: str = "http://localhost:1234" api_url: str = "http://localhost:1234"
max_token_length: int = 4096
@register() @register()
class LMStudioClient(ClientBase): class LMStudioClient(ClientBase):
client_type = "lmstudio" client_type = "lmstudio"
conversation_retries = 5
class Meta(ClientBase.Meta): class Meta(ClientBase.Meta):
name_prefix: str = "LMStudio" name_prefix: str = "LMStudio"

View File

@@ -22,7 +22,7 @@ class Client(BaseModel):
model: Union[str, None] = None model: Union[str, None] = None
api_url: Union[str, None] = None api_url: Union[str, None] = None
api_key: Union[str, None] = None api_key: Union[str, None] = None
max_token_length: Union[int, None] = None max_token_length: int = 4096
class Config: class Config:
extra = "ignore" extra = "ignore"

View File

@@ -6,13 +6,14 @@
<span class="headline">{{ title() }}</span> <span class="headline">{{ title() }}</span>
</v-card-title> </v-card-title>
<v-card-text> <v-card-text>
<v-form ref="form" v-model="formIsValid">
<v-container> <v-container>
<v-row> <v-row>
<v-col cols="6"> <v-col cols="6">
<v-select v-model="client.type" :disabled="!typeEditable()" :items="clientChoices" label="Client Type" @update:model-value="resetToDefaults"></v-select> <v-select v-model="client.type" :disabled="!typeEditable()" :items="clientChoices" label="Client Type" @update:model-value="resetToDefaults"></v-select>
</v-col> </v-col>
<v-col cols="6"> <v-col cols="6">
<v-text-field v-model="client.name" label="Client Name"></v-text-field> <v-text-field v-model="client.name" label="Client Name" :rules="[rules.required]"></v-text-field>
</v-col> </v-col>
</v-row> </v-row>
<v-row v-if="clientMeta().experimental"> <v-row v-if="clientMeta().experimental">
@@ -24,7 +25,7 @@
<v-col cols="12"> <v-col cols="12">
<v-row> <v-row>
<v-col :cols="clientMeta().enable_api_auth ? 7 : 12"> <v-col :cols="clientMeta().enable_api_auth ? 7 : 12">
<v-text-field v-model="client.api_url" v-if="requiresAPIUrl(client)" label="API URL"></v-text-field> <v-text-field v-model="client.api_url" v-if="requiresAPIUrl(client)" :rules="[rules.required]" label="API URL"></v-text-field>
</v-col> </v-col>
<v-col cols="5"> <v-col cols="5">
<v-text-field type="password" v-model="client.api_key" v-if="requiresAPIUrl(client) && clientMeta().enable_api_auth" label="API Key"></v-text-field> <v-text-field type="password" v-model="client.api_key" v-if="requiresAPIUrl(client) && clientMeta().enable_api_auth" label="API Key"></v-text-field>
@@ -36,7 +37,7 @@
</v-row> </v-row>
<v-row> <v-row>
<v-col cols="4"> <v-col cols="4">
<v-text-field v-model="client.max_token_length" v-if="requiresAPIUrl(client)" type="number" label="Context Length"></v-text-field> <v-text-field v-model="client.max_token_length" v-if="requiresAPIUrl(client)" type="number" label="Context Length" :rules="[rules.required]"></v-text-field>
</v-col> </v-col>
<v-col cols="8" v-if="!typeEditable() && client.data && client.data.prompt_template_example !== null && client.model_name && clientMeta().requires_prompt_template"> <v-col cols="8" v-if="!typeEditable() && client.data && client.data.prompt_template_example !== null && client.model_name && clientMeta().requires_prompt_template">
<v-combobox ref="promptTemplateComboBox" label="Prompt Template" v-model="client.data.template_file" @update:model-value="setPromptTemplate" :items="promptTemplates"></v-combobox> <v-combobox ref="promptTemplateComboBox" label="Prompt Template" v-model="client.data.template_file" @update:model-value="setPromptTemplate" :items="promptTemplates"></v-combobox>
@@ -54,11 +55,12 @@
</v-col> </v-col>
</v-row> </v-row>
</v-container> </v-container>
</v-form>
</v-card-text> </v-card-text>
<v-card-actions> <v-card-actions>
<v-spacer></v-spacer> <v-spacer></v-spacer>
<v-btn color="primary" text @click="close" prepend-icon="mdi-cancel">Cancel</v-btn> <v-btn color="primary" text @click="close" prepend-icon="mdi-cancel">Cancel</v-btn>
<v-btn color="primary" text @click="save" prepend-icon="mdi-check-circle-outline">Save</v-btn> <v-btn color="primary" text @click="save" prepend-icon="mdi-check-circle-outline" :disabled="!formIsValid">Save</v-btn>
</v-card-actions> </v-card-actions>
</v-card> </v-card>
</v-dialog> </v-dialog>
@@ -77,12 +79,19 @@ export default {
], ],
data() { data() {
return { return {
formIsValid: false,
promptTemplates: [], promptTemplates: [],
clientTypes: [], clientTypes: [],
clientChoices: [], clientChoices: [],
localDialog: this.state.dialog, localDialog: this.state.dialog,
client: { ...this.state.currentClient }, client: { ...this.state.currentClient },
defaultValuesByCLientType: {} defaultValuesByCLientType: {},
rules: {
required: value => !!value || 'Field is required.',
},
rulesMaxTokenLength: [
v => !!v || 'Context length is required',
],
}; };
}, },
watch: { watch: {