diff --git a/app/Instruct.tsx b/app/Instruct.tsx
index e3fa137..b8a8dda 100644
--- a/app/Instruct.tsx
+++ b/app/Instruct.tsx
@@ -3,10 +3,9 @@ import CheckboxTitle from '@components/CheckboxTitle'
import SliderItem from '@components/SliderItem'
import TextBox from '@components/TextBox'
import TextBoxModal from '@components/TextBoxModal'
-import { InstructListItem } from 'app/constants/Instructs'
import { FontAwesome } from '@expo/vector-icons'
import { Global, Instructs, saveStringExternal, Logger, Style } from '@globals'
-import Slider from '@react-native-community/slider'
+import { InstructListItem } from 'app/constants/Instructs'
import { Stack } from 'expo-router'
import { useState, useEffect } from 'react'
import { useAutosave } from 'react-autosave'
@@ -45,7 +44,6 @@ const Instruct = () => {
const targetID = id === -1 ? instructID : id
const currentitem = list.filter((item) => item.id === targetID)
if (currentitem.length === 0) {
- // item no longer exists
setSelectedItem(list[0])
loadInstruct(list[0].id)
} else {
@@ -121,8 +119,6 @@ const Instruct = () => {
await loadInstruct(newid)
loadInstructList(newid)
})
-
- //Instructs.saveFile(text, { ...currentInstruct, name: text })
}}
/>
@@ -316,6 +312,22 @@ const Instruct = () => {
/>
*/}
+
+
+ {/**/}
+
max_length) {
break
}
// apply strings
- let message_shard = `${message.is_user ? currentInstruct.input_prefix : currentInstruct.output_prefix}`
+ let message_shard = message.is_user
+ ? currentInstruct.input_prefix
+ : is_last
+ ? currentInstruct.last_output_prefix
+ : currentInstruct.output_prefix
if (currentInstruct.timestamp) message_shard += timestamp_string
diff --git a/app/constants/Instructs.ts b/app/constants/Instructs.ts
index 8801d6f..116fad1 100644
--- a/app/constants/Instructs.ts
+++ b/app/constants/Instructs.ts
@@ -20,6 +20,7 @@ const defaultInstructs: InstructType[] = [
input_prefix: '### Instruction: ',
input_suffix: '\n',
output_prefix: '### Response: ',
+ last_output_prefix: '### Response: ',
output_suffix: '\n',
stop_sequence: '### Instruction',
user_alignment_message: '',
@@ -40,6 +41,7 @@ const defaultInstructs: InstructType[] = [
input_prefix: '<|start_header_id|>user<|end_header_id|>\n\n',
input_suffix: '<|eot_id|>',
output_prefix: '<|start_header_id|>assistant<|end_header_id|>\n\n',
+ last_output_prefix: '<|start_header_id|>assistant<|end_header_id|>\n\n',
output_suffix: '<|eot_id|>',
stop_sequence: '<|eot_id|>',
user_alignment_message: '',
@@ -60,6 +62,7 @@ const defaultInstructs: InstructType[] = [
input_prefix: '<|im_start|>user\n',
input_suffix: '<|im_end|>\n',
output_prefix: '<|im_start|>assistant\n',
+ last_output_prefix: '<|im_start|>assistant\n',
output_suffix: '<|im_end|>\n',
stop_sequence: '<|im_end|>',
user_alignment_message: '',
@@ -80,6 +83,7 @@ const defaultInstructs: InstructType[] = [
input_prefix: '<|user|>\n',
input_suffix: '<|endoftext|>\n',
output_prefix: '<|assistant|>\n',
+ last_output_prefix: '<|assistant|>\n',
output_suffix: '<|endoftext|>\n',
stop_sequence: '<|endoftext|>\n',
user_alignment_message: '',
@@ -100,6 +104,7 @@ const defaultInstructs: InstructType[] = [
input_prefix: '<|user|>\n',
input_suffix: '<|end|>\n',
output_prefix: '<|assistant|>\n',
+ last_output_prefix: '<|assistant|>\n',
output_suffix: '<|end|>\n',
stop_sequence: '<|end|>\n',
user_alignment_message: '',
@@ -120,6 +125,7 @@ const defaultInstructs: InstructType[] = [
input_prefix: 'user\n',
input_suffix: '\n',
output_prefix: 'model',
+ last_output_prefix: 'model',
output_suffix: '\n',
stop_sequence: '',
user_alignment_message: '',
@@ -158,6 +164,7 @@ type InstructTokenCache = {
input_prefix_length: number
input_suffix_length: number
output_prefix_length: number
+ last_output_prefix_length: number
output_suffix_length: number
user_alignment_message_length: number
}
@@ -170,6 +177,7 @@ export namespace Instructs {
input_prefix: '### Instruction: ',
input_suffix: '\n',
output_prefix: '### Response: ',
+ last_output_prefix: '### Response: ',
output_suffix: '\n',
stop_sequence: '### Instruction',
user_alignment_message: '',
@@ -212,6 +220,7 @@ export namespace Instructs {
input_prefix_length: 0,
input_suffix_length: 0,
output_prefix_length: 0,
+ last_output_prefix_length: 0,
output_suffix_length: 0,
user_alignment_message_length: 0,
}
@@ -229,9 +238,11 @@ export namespace Instructs {
input_prefix_length: getTokenCount(instruct.input_prefix),
input_suffix_length: getTokenCount(instruct.input_suffix),
output_prefix_length: getTokenCount(instruct.output_prefix),
+ last_output_prefix_length: getTokenCount(instruct.last_output_prefix),
output_suffix_length: getTokenCount(instruct.output_suffix),
user_alignment_message_length: getTokenCount(instruct.system_prompt),
}
+ console.log('cache created')
set((state) => ({ ...state, tokenCache: newCache }))
return newCache
},
@@ -254,14 +265,30 @@ export namespace Instructs {
name: 'instruct-storage',
storage: createJSONStorage(() => mmkvStorage),
partialize: (state) => ({ data: state.data }),
- version: 1,
- migrate: (persistedState: any, version) => {
+ version: 2,
+ migrate: async (persistedState: any, version) => {
if (!version) {
persistedState.timestamp = false
persistedState.examples = true
persistedState.format_type = 0
Logger.log('[INSTRUCT] Migrated to v1')
}
+ if (version === 1) {
+ const entries = await database.query.instructs.findMany({
+ columns: {
+ id: true,
+ output_prefix: true,
+ },
+ })
+ entries.forEach(async (item) => {
+ if (item?.id === persistedState?.id)
+ persistedState.last_output_prefix = item.output_prefix
+ await database
+ .update(instructs)
+ .set({ last_output_prefix: item.output_prefix })
+ .where(eq(instructs.id, item.id))
+ })
+ }
return persistedState
},
@@ -344,4 +371,6 @@ export type InstructType = {
timestamp: boolean
examples: boolean
format_type: number
+
+ last_output_prefix: string
}
diff --git a/app/constants/Utils.ts b/app/constants/Utils.ts
index 0973129..4339848 100644
--- a/app/constants/Utils.ts
+++ b/app/constants/Utils.ts
@@ -1,4 +1,7 @@
+import { API } from './API'
import { Characters } from './Characters'
+import { Global } from './GlobalValues'
+import { mmkv } from './MMKV'
export const humanizedISO8601DateTime = (date = '') => {
const baseDate = typeof date === 'number' ? new Date(date) : new Date()
@@ -50,3 +53,23 @@ export const replaceMacros = (text: string) => {
for (const rule of rules) newtext = newtext.replaceAll(rule.macro, rule.value)
return newtext
}
+
+const getMMKVObjectModel = (mmkvKey: string, field: string) => {
+ const data = mmkv.getString(mmkvKey)
+ if (!data) return 'undefined'
+ const model = JSON.parse(data)[field]
+ return model
+}
+
+export const getCurrentModel = () => {
+ const api = mmkv.getString(Global.APIType)
+ switch (api) {
+ case API.CHATCOMPLETIONS: {
+ return getMMKVObjectModel(Global.ChatCompletionsModel, 'id')
+ }
+ case API.CLAUDE: {
+ return getMMKVObjectModel(Global.ClaudeModel, 'name')
+ }
+ // TODO: Finish this - need data for KAI api
+ }
+}
diff --git a/db/migrations/0003_violet_firelord.sql b/db/migrations/0003_violet_firelord.sql
new file mode 100644
index 0000000..dec1ab5
--- /dev/null
+++ b/db/migrations/0003_violet_firelord.sql
@@ -0,0 +1 @@
+ALTER TABLE `instructs` ADD `last_output_prefix` text DEFAULT '' NOT NULL;
\ No newline at end of file
diff --git a/db/migrations/meta/0003_snapshot.json b/db/migrations/meta/0003_snapshot.json
new file mode 100644
index 0000000..f12a61c
--- /dev/null
+++ b/db/migrations/meta/0003_snapshot.json
@@ -0,0 +1,811 @@
+{
+ "version": "6",
+ "dialect": "sqlite",
+ "id": "d3f7ff2e-0268-4a87-b893-23ef1429e822",
+ "prevId": "bd5f0c89-3dfa-4031-a195-527c4010ea23",
+ "tables": {
+ "character_greetings": {
+ "name": "character_greetings",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "character_id": {
+ "name": "character_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "greeting": {
+ "name": "greeting",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "character_greetings_character_id_characters_id_fk": {
+ "name": "character_greetings_character_id_characters_id_fk",
+ "tableFrom": "character_greetings",
+ "tableTo": "characters",
+ "columnsFrom": [
+ "character_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "character_lorebooks": {
+ "name": "character_lorebooks",
+ "columns": {
+ "character_id": {
+ "name": "character_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "lorebook_id": {
+ "name": "lorebook_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "character_lorebooks_character_id_characters_id_fk": {
+ "name": "character_lorebooks_character_id_characters_id_fk",
+ "tableFrom": "character_lorebooks",
+ "tableTo": "characters",
+ "columnsFrom": [
+ "character_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "character_lorebooks_lorebook_id_lorebooks_id_fk": {
+ "name": "character_lorebooks_lorebook_id_lorebooks_id_fk",
+ "tableFrom": "character_lorebooks",
+ "tableTo": "lorebooks",
+ "columnsFrom": [
+ "lorebook_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "character_lorebooks_character_id_lorebook_id_pk": {
+ "columns": [
+ "character_id",
+ "lorebook_id"
+ ],
+ "name": "character_lorebooks_character_id_lorebook_id_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "character_tags": {
+ "name": "character_tags",
+ "columns": {
+ "character_id": {
+ "name": "character_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tag_id": {
+ "name": "tag_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "character_tags_character_id_characters_id_fk": {
+ "name": "character_tags_character_id_characters_id_fk",
+ "tableFrom": "character_tags",
+ "tableTo": "characters",
+ "columnsFrom": [
+ "character_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ },
+ "character_tags_tag_id_tags_id_fk": {
+ "name": "character_tags_tag_id_tags_id_fk",
+ "tableFrom": "character_tags",
+ "tableTo": "tags",
+ "columnsFrom": [
+ "tag_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {
+ "character_tags_character_id_tag_id_pk": {
+ "columns": [
+ "character_id",
+ "tag_id"
+ ],
+ "name": "character_tags_character_id_tag_id_pk"
+ }
+ },
+ "uniqueConstraints": {}
+ },
+ "characters": {
+ "name": "characters",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "type": {
+ "name": "type",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "'User'"
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "first_mes": {
+ "name": "first_mes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "mes_example": {
+ "name": "mes_example",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "creator_notes": {
+ "name": "creator_notes",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "system_prompt": {
+ "name": "system_prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "scenario": {
+ "name": "scenario",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "personality": {
+ "name": "personality",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "post_history_instructions": {
+ "name": "post_history_instructions",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "image_id": {
+ "name": "image_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "creator": {
+ "name": "creator",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "character_version": {
+ "name": "character_version",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "last_modified": {
+ "name": "last_modified",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "chat_entries": {
+ "name": "chat_entries",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "chat_id": {
+ "name": "chat_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "is_user": {
+ "name": "is_user",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "order": {
+ "name": "order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "swipe_id": {
+ "name": "swipe_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "chat_entries_chat_id_chats_id_fk": {
+ "name": "chat_entries_chat_id_chats_id_fk",
+ "tableFrom": "chat_entries",
+ "tableTo": "chats",
+ "columnsFrom": [
+ "chat_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "chat_swipes": {
+ "name": "chat_swipes",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "entry_id": {
+ "name": "entry_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "swipe": {
+ "name": "swipe",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ },
+ "send_date": {
+ "name": "send_date",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "gen_started": {
+ "name": "gen_started",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "gen_finished": {
+ "name": "gen_finished",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "chat_swipes_entry_id_chat_entries_id_fk": {
+ "name": "chat_swipes_entry_id_chat_entries_id_fk",
+ "tableFrom": "chat_swipes",
+ "tableTo": "chat_entries",
+ "columnsFrom": [
+ "entry_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "chats": {
+ "name": "chats",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "create_date": {
+ "name": "create_date",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "character_id": {
+ "name": "character_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "last_modified": {
+ "name": "last_modified",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "chats_character_id_characters_id_fk": {
+ "name": "chats_character_id_characters_id_fk",
+ "tableFrom": "chats",
+ "tableTo": "characters",
+ "columnsFrom": [
+ "character_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "instructs": {
+ "name": "instructs",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "system_prompt": {
+ "name": "system_prompt",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "system_prefix": {
+ "name": "system_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "system_suffix": {
+ "name": "system_suffix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "inpput_prefix": {
+ "name": "inpput_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "input_suffix": {
+ "name": "input_suffix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "output_suffix": {
+ "name": "output_suffix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "output_prefix": {
+ "name": "output_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "stop_sequence": {
+ "name": "stop_sequence",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "activation_regex": {
+ "name": "activation_regex",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "user_alignment_message": {
+ "name": "user_alignment_message",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "wrap": {
+ "name": "wrap",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "macro": {
+ "name": "macro",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "names": {
+ "name": "names",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "names_force_groups": {
+ "name": "names_force_groups",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "timestamp": {
+ "name": "timestamp",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": false
+ },
+ "examples": {
+ "name": "examples",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": true
+ },
+ "format_type": {
+ "name": "format_type",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": 0
+ },
+ "last_output_prefix": {
+ "name": "last_output_prefix",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false,
+ "default": "''"
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "lorebook_entries": {
+ "name": "lorebook_entries",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": true
+ },
+ "lorebook_id": {
+ "name": "lorebook_id",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "keys": {
+ "name": "keys",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "content": {
+ "name": "content",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "enable": {
+ "name": "enable",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": true
+ },
+ "insertion_order": {
+ "name": "insertion_order",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 100
+ },
+ "case_sensitive": {
+ "name": "case_sensitive",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": true
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "priority": {
+ "name": "priority",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": 100
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {
+ "lorebook_entries_lorebook_id_lorebooks_id_fk": {
+ "name": "lorebook_entries_lorebook_id_lorebooks_id_fk",
+ "tableFrom": "lorebook_entries",
+ "tableTo": "lorebooks",
+ "columnsFrom": [
+ "lorebook_id"
+ ],
+ "columnsTo": [
+ "id"
+ ],
+ "onDelete": "cascade",
+ "onUpdate": "no action"
+ }
+ },
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "lorebooks": {
+ "name": "lorebooks",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "name": {
+ "name": "name",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "description": {
+ "name": "description",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "scan_depth": {
+ "name": "scan_depth",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "token_budget": {
+ "name": "token_budget",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false
+ },
+ "recursive_scanning": {
+ "name": "recursive_scanning",
+ "type": "integer",
+ "primaryKey": false,
+ "notNull": false,
+ "autoincrement": false,
+ "default": false
+ }
+ },
+ "indexes": {},
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ },
+ "tags": {
+ "name": "tags",
+ "columns": {
+ "id": {
+ "name": "id",
+ "type": "integer",
+ "primaryKey": true,
+ "notNull": true,
+ "autoincrement": false
+ },
+ "tag": {
+ "name": "tag",
+ "type": "text",
+ "primaryKey": false,
+ "notNull": true,
+ "autoincrement": false
+ }
+ },
+ "indexes": {
+ "tags_tag_unique": {
+ "name": "tags_tag_unique",
+ "columns": [
+ "tag"
+ ],
+ "isUnique": true
+ }
+ },
+ "foreignKeys": {},
+ "compositePrimaryKeys": {},
+ "uniqueConstraints": {}
+ }
+ },
+ "enums": {},
+ "_meta": {
+ "schemas": {},
+ "tables": {},
+ "columns": {}
+ },
+ "internal": {
+ "indexes": {}
+ }
+}
\ No newline at end of file
diff --git a/db/migrations/meta/_journal.json b/db/migrations/meta/_journal.json
index e9a6a03..03aceb4 100644
--- a/db/migrations/meta/_journal.json
+++ b/db/migrations/meta/_journal.json
@@ -22,6 +22,13 @@
"when": 1726593007556,
"tag": "0002_majestic_brother_voodoo",
"breakpoints": true
+ },
+ {
+ "idx": 3,
+ "version": "6",
+ "when": 1726978324478,
+ "tag": "0003_violet_firelord",
+ "breakpoints": true
}
]
}
\ No newline at end of file
diff --git a/db/migrations/migrations.js b/db/migrations/migrations.js
index ec3edf6..8f6014d 100644
--- a/db/migrations/migrations.js
+++ b/db/migrations/migrations.js
@@ -4,13 +4,15 @@ import journal from './meta/_journal.json';
import m0000 from './0000_sudden_blockbuster.sql';
import m0001 from './0001_yellow_squirrel_girl.sql';
import m0002 from './0002_majestic_brother_voodoo.sql';
+import m0003 from './0003_violet_firelord.sql';
export default {
journal,
migrations: {
m0000,
m0001,
-m0002
+m0002,
+m0003
}
}
\ No newline at end of file
diff --git a/db/schema.ts b/db/schema.ts
index eaea1af..fd4caf2 100644
--- a/db/schema.ts
+++ b/db/schema.ts
@@ -182,6 +182,9 @@ export const instructs = sqliteTable('instructs', {
timestamp: integer('timestamp', { mode: 'boolean' }).notNull().default(false),
examples: integer('examples', { mode: 'boolean' }).notNull().default(true),
format_type: integer('format_type').notNull().default(0),
+
+ // additions 22/9/2024, v4
+ last_output_prefix: text('last_output_prefix').notNull().default(''),
})
// LOREBOOKS