mirror of
https://github.com/vegu-ai/talemate.git
synced 2025-12-28 16:06:38 +01:00
Prep 0.12.0 (#26)
* no " or * just treat as spoken words * chromadb perist to db * collect name should contain embedding so switching between chromadb configurations doesn't brick your scenes * fix save-as long term memory transfer * add chroma * director agent refactor * tweak director command, prompt reset, ux display * tweak director message ux * allow clearing of prompt log * remove auto adding of quotes if neither quote or * are present * command to reset long term memory for the scene * improve summarization template as it would cause some llms to add extra details * rebuilding history will now also rebuild long term memory * direct scene template * fix scene time reset * dialogue template tweaks * better dialog format fixing * some dialogue template adjustments * adjust default values of director agent * keep track of scene saved/unsaved status and confirm loading a different scene if current scene is unsaved * prompt fixes * remove the collection on recommitting the seen to memory, as the embeddings may have changed * change to the official python api for the openai client and make it async * prompt tweaks * world state prompt parsing fixes * improve handling of json responses * 0 seconds ago changed to moments ago * move memory context closer to scene * token counts for openai client * narrator agent option: narrate passage of time * gitignore * remove memory id * refactor world state with persistence to chromadb (wip) * remove world state update instructions * dont display blank emotion in world state * openai gpt-4 turbo support * conversation agent extra instructions * track prompt response times * Yi and UtopiaXL * long term memory retrieval improvements during conversations * narrate scene tweaks * conversation ltm augment tweaks * hide subconfig if parent config isnt enabled * ai assisted memory recall during conversation default to off * openai json_object coersion only on model that supports it openai client emit prompt processing time * 0.12.0 * remove prompt number from prompt debug list * add prompt number back in but shift it to the upper row * narrate time passage hard content limit restriction for now as gpt-4 would just write a whole chapter. * relock
This commit is contained in:
@@ -91,7 +91,6 @@ export default {
|
||||
openModal() {
|
||||
this.state.formTitle = 'Add AI Agent';
|
||||
this.state.dialog = true;
|
||||
console.log("got here")
|
||||
},
|
||||
saveAgent(agent) {
|
||||
const index = this.state.agents.findIndex(c => c.name === agent.name);
|
||||
@@ -120,7 +119,6 @@ export default {
|
||||
handleMessage(data) {
|
||||
// Handle agent_status message type
|
||||
if (data.type === 'agent_status') {
|
||||
console.log("agents: got agent_status message", data)
|
||||
// Find the client with the given name
|
||||
const agent = this.state.agents.find(agent => agent.name === data.name);
|
||||
if (agent) {
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
hide-details
|
||||
v-model="client.max_token_length"
|
||||
:min="1024"
|
||||
:max="16384"
|
||||
:max="128000"
|
||||
:step="512"
|
||||
@update:modelValue="saveClient(client)"
|
||||
@click.stop
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
|
||||
|
||||
</v-card-title>
|
||||
<v-card-text>
|
||||
<v-card-text class="scrollable-content">
|
||||
<v-select v-model="agent.client" :items="agent.data.client" label="Client"></v-select>
|
||||
|
||||
<v-alert type="warning" variant="tonal" density="compact" v-if="agent.data.experimental">
|
||||
@@ -32,10 +32,12 @@
|
||||
<v-card-text>
|
||||
{{ agent.data.actions[key].description }}
|
||||
<div v-for="(action_config, config_key) in agent.data.actions[key].config" :key="config_key">
|
||||
<div v-if="action.enabled">
|
||||
<!-- render config widgets based on action_config.type (int, str, bool, float) -->
|
||||
<v-text-field v-if="action_config.type === 'str'" v-model="action.config[config_key].value" :label="action_config.label" :hint="action_config.description" density="compact"></v-text-field>
|
||||
<v-text-field v-if="action_config.type === 'text'" v-model="action.config[config_key].value" :label="action_config.label" :hint="action_config.description" density="compact"></v-text-field>
|
||||
<v-slider v-if="action_config.type === 'number' && action_config.step !== null" v-model="action.config[config_key].value" :label="action_config.label" :hint="action_config.description" :min="action_config.min" :max="action_config.max" :step="action_config.step" density="compact" thumb-label></v-slider>
|
||||
<v-checkbox v-if="action_config.type === 'bool'" v-model="action.config[config_key].value" :label="action_config.label" :hint="action_config.description" density="compact"></v-checkbox>
|
||||
</div>
|
||||
</div>
|
||||
</v-card-text>
|
||||
</v-card>
|
||||
@@ -97,4 +99,12 @@ export default {
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</script>
|
||||
|
||||
<style>
|
||||
.scrollable-content {
|
||||
overflow-y: auto;
|
||||
max-height: 70vh;
|
||||
padding-right: 16px;
|
||||
}
|
||||
</style>
|
||||
@@ -18,7 +18,7 @@
|
||||
<v-row>
|
||||
<v-col cols="12">
|
||||
<v-text-field v-model="client.apiUrl" v-if="client.type === 'textgenwebui'" label="API URL"></v-text-field>
|
||||
<v-select v-model="client.model" v-if="client.type === 'openai'" :items="['gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k']" label="Model"></v-select>
|
||||
<v-select v-model="client.model" v-if="client.type === 'openai'" :items="['gpt-4-1106-preview', 'gpt-4', 'gpt-3.5-turbo', 'gpt-3.5-turbo-16k']" label="Model"></v-select>
|
||||
</v-col>
|
||||
</v-row>
|
||||
<v-row>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<template>
|
||||
<v-list-subheader class="text-uppercase"><v-icon>mdi-post-outline</v-icon> Prompts
|
||||
<v-chip size="x-small" color="primary">{{ max_prompts }}</v-chip>
|
||||
<v-icon color="primary" class="ml-2" @click="clearPrompts">mdi-close</v-icon>
|
||||
</v-list-subheader>
|
||||
|
||||
<v-list-item density="compact">
|
||||
@@ -9,15 +10,19 @@
|
||||
|
||||
<v-list-item v-for="(prompt, index) in prompts" :key="index" @click="openPromptView(prompt)">
|
||||
<v-list-item-title class="text-caption">
|
||||
{{ prompt.kind }}
|
||||
|
||||
<v-row>
|
||||
<v-col cols="2" class="text-info">#{{ prompt.num }}</v-col>
|
||||
<v-col cols="10" class="text-right">{{ prompt.kind }}</v-col>
|
||||
</v-row>
|
||||
|
||||
</v-list-item-title>
|
||||
<v-list-item-subtitle>
|
||||
<v-chip size="x-small"><v-icon size="14"
|
||||
class="mr-1">mdi-pound</v-icon>{{ prompt.num }}</v-chip>
|
||||
<v-chip size="x-small" color="primary">{{ prompt.prompt_tokens }}<v-icon size="14"
|
||||
<v-chip size="x-small" class="mr-1" color="primary">{{ prompt.prompt_tokens }}<v-icon size="14"
|
||||
class="ml-1">mdi-arrow-down-bold</v-icon></v-chip>
|
||||
<v-chip size="x-small" color="secondary">{{ prompt.response_tokens }}<v-icon size="14"
|
||||
<v-chip size="x-small" class="mr-1" color="secondary">{{ prompt.response_tokens }}<v-icon size="14"
|
||||
class="ml-1">mdi-arrow-up-bold</v-icon></v-chip>
|
||||
<v-chip size="x-small">{{ prompt.time }}s<v-icon size="14" class="ml-1">mdi-clock</v-icon></v-chip>
|
||||
</v-list-item-subtitle>
|
||||
<v-divider class="mt-1"></v-divider>
|
||||
</v-list-item>
|
||||
@@ -33,7 +38,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
prompts: [],
|
||||
total: 0,
|
||||
total: 1,
|
||||
max_prompts: 50,
|
||||
}
|
||||
},
|
||||
@@ -47,6 +52,10 @@ export default {
|
||||
],
|
||||
|
||||
methods: {
|
||||
clearPrompts() {
|
||||
this.prompts = [];
|
||||
this.total = 0;
|
||||
},
|
||||
handleMessage(data) {
|
||||
|
||||
if(data.type === "system"&& data.id === "scene.loaded") {
|
||||
@@ -63,6 +72,7 @@ export default {
|
||||
kind: data.data.kind,
|
||||
response_tokens: data.data.response_tokens,
|
||||
prompt_tokens: data.data.prompt_tokens,
|
||||
time: parseInt(data.data.time),
|
||||
num: this.total++,
|
||||
})
|
||||
|
||||
|
||||
@@ -1,13 +1,15 @@
|
||||
<template>
|
||||
<div class="director-container" v-if="show && minimized" >
|
||||
<v-chip closable @click:close="deleteMessage()" color="deep-purple-lighten-3">
|
||||
<v-chip closable color="deep-orange" class="clickable" @click:close="deleteMessage()">
|
||||
<v-icon class="mr-2">mdi-bullhorn-outline</v-icon>
|
||||
<span @click="toggle()">{{ character }}</span>
|
||||
</v-chip>
|
||||
</div>
|
||||
<v-alert v-else-if="show" class="director-message" variant="text" :closable="message_id !== null" type="info" icon="mdi-bullhorn-outline"
|
||||
<v-alert v-else-if="show" color="deep-orange" class="director-message clickable" variant="text" type="info" icon="mdi-bullhorn-outline"
|
||||
elevation="0" density="compact" @click:close="deleteMessage()" >
|
||||
<div class="director-text" @click="toggle()">{{ text }}</div>
|
||||
<span class="director-instructs" @click="toggle()">{{ directorInstructs }}</span>
|
||||
<span class="director-character ml-1 text-decoration-underline" @click="toggle()">{{ directorCharacter }}</span>
|
||||
<span class="director-text ml-1" @click="toggle()">{{ directorText }}</span>
|
||||
</v-alert>
|
||||
</template>
|
||||
|
||||
@@ -21,6 +23,17 @@ export default {
|
||||
},
|
||||
props: ['text', 'message_id', 'character'],
|
||||
inject: ['requestDeleteMessage'],
|
||||
computed: {
|
||||
directorInstructs() {
|
||||
return "Director instructs"
|
||||
},
|
||||
directorCharacter() {
|
||||
return this.text.split(':')[0].split("Director instructs ")[1];
|
||||
},
|
||||
directorText() {
|
||||
return this.text.split(':')[1].split('"')[1];
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
toggle() {
|
||||
this.minimized = !this.minimized;
|
||||
@@ -41,6 +54,10 @@ export default {
|
||||
margin-right: 2px;
|
||||
}
|
||||
|
||||
.clickable {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.highlight:before {
|
||||
--content: "*";
|
||||
}
|
||||
@@ -50,16 +67,33 @@ export default {
|
||||
}
|
||||
|
||||
.director-text {
|
||||
color: #9FA8DA;
|
||||
}
|
||||
|
||||
.director-message {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
color: #9FA8DA;
|
||||
}
|
||||
|
||||
.director-container {
|
||||
|
||||
}
|
||||
|
||||
.director-instructs {
|
||||
/* Add your CSS styles for "Director instructs" here */
|
||||
color: #BF360C;
|
||||
}
|
||||
|
||||
.director-character {
|
||||
/* Add your CSS styles for the character name here */
|
||||
}
|
||||
|
||||
.director-text {
|
||||
/* Add your CSS styles for the actual instruction here */
|
||||
color: #EF6C00;
|
||||
}
|
||||
.director-text::after {
|
||||
content: '"';
|
||||
}
|
||||
.director-text::before {
|
||||
content: '"';
|
||||
}
|
||||
</style>
|
||||
@@ -58,6 +58,7 @@ export default {
|
||||
scenes: [],
|
||||
sceneSearchInput: null,
|
||||
sceneSearchLoading: false,
|
||||
sceneSaved: null,
|
||||
expanded: true,
|
||||
}
|
||||
},
|
||||
@@ -83,6 +84,13 @@ export default {
|
||||
this.getWebsocket().send(JSON.stringify({ type: 'load_scene', file_path: "environment:creative" }));
|
||||
},
|
||||
loadScene() {
|
||||
|
||||
if(this.sceneSaved === false) {
|
||||
if(!confirm("The current scene is not saved. Are you sure you want to load a new scene?")) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
if (this.inputMethod === 'file' && this.sceneFile.length > 0) { // Check if the input method is "file" and there is at least one file
|
||||
// Convert the uploaded file to base64
|
||||
@@ -119,6 +127,12 @@ export default {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle scene status
|
||||
if (data.type == "scene_status") {
|
||||
this.sceneSaved = data.data.saved;
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
},
|
||||
created() {
|
||||
|
||||
@@ -89,7 +89,8 @@
|
||||
<v-app-bar-nav-icon @click="toggleNavigation('game')"><v-icon>mdi-script</v-icon></v-app-bar-nav-icon>
|
||||
<v-toolbar-title v-if="scene.name !== undefined">
|
||||
{{ scene.name || 'Untitled Scenario' }}
|
||||
<v-chip size="x-small" v-if="scene.environment === 'creative'" class="ml-1"><v-icon text="Creative" size="14"
|
||||
<span v-if="scene.saved === false" class="text-red">*</span>
|
||||
<v-chip size="x-small" v-if="scene.environment === 'creative'" class="ml-2"><v-icon text="Creative" size="14"
|
||||
class="mr-1">mdi-palette-outline</v-icon>Creative Mode</v-chip>
|
||||
<v-chip size="x-small" v-else-if="scene.environment === 'scene'" class="ml-1"><v-icon text="Play" size="14"
|
||||
class="mr-1">mdi-gamepad-square</v-icon>Game Mode</v-chip>
|
||||
@@ -244,8 +245,10 @@ export default {
|
||||
}
|
||||
|
||||
this.connecting = true;
|
||||
let currentUrl = new URL(window.location.href);
|
||||
console.log(currentUrl);
|
||||
|
||||
this.websocket = new WebSocket('ws://localhost:5050/ws');
|
||||
this.websocket = new WebSocket(`ws://${currentUrl.hostname}:5050/ws`);
|
||||
console.log("Websocket connecting ...")
|
||||
this.websocket.onmessage = this.handleMessage;
|
||||
this.websocket.onopen = () => {
|
||||
@@ -300,6 +303,7 @@ export default {
|
||||
name: data.name,
|
||||
environment: data.data.environment,
|
||||
scene_time: data.data.scene_time,
|
||||
saved: data.data.saved,
|
||||
}
|
||||
this.sceneActive = true;
|
||||
return;
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<v-expansion-panel rounded="0" density="compact">
|
||||
<v-expansion-panel-title class="text-subtitle-2" diable-icon-rotate>
|
||||
{{ name }}
|
||||
<v-chip label size="x-small" variant="outlined" class="ml-1">{{ character.emotion }}</v-chip>
|
||||
<v-chip v-if="character.emotion !== null && character.emotion !== ''" label size="x-small" variant="outlined" class="ml-1">{{ character.emotion }}</v-chip>
|
||||
<template v-slot:actions>
|
||||
<v-icon icon="mdi-account"></v-icon>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user