Skip to content

Commit dbec0bf

Browse files
committed
rename all the different calls to the store!
1 parent 3b0d2d7 commit dbec0bf

32 files changed

+167
-136
lines changed

src/components/taskyon/ApiSelect.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,16 +31,16 @@
3131
</template>
3232

3333
<script setup lang="ts">
34-
import { useTaskyonStore } from 'stores/taskyonState';
3534
import {
3635
matElectricalServices,
3736
matSettings,
3837
} from '@quasar/extras/material-icons';
38+
import { useAppStateStore } from 'src/stores/appState';
3939
4040
const model = defineModel<string | null>();
4141
4242
defineProps<{
4343
moreSettings?: boolean;
4444
}>();
45-
const state = useTaskyonStore();
45+
const state = useAppStateStore();
4646
</script>

src/components/taskyon/ChatSidebar.vue

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
>
4444
{{
4545
selected
46-
? `> ${state.currentTask?.name}`
46+
? `> ${tystate.currentTask?.name}`
4747
: nameMap[conversationId] ||
4848
`chat.${conversationId.slice(0, 3)}`
4949
}}
@@ -130,15 +130,17 @@ import {
130130
mdiForumPlus,
131131
} from '@quasar/extras/mdi-v6';
132132
import TaskChainMenu from './TaskChainMenu.vue';
133+
import { useAppStateStore } from 'src/stores/appState';
133134
134-
const state = useTaskyonStore();
135+
const state = useAppStateStore();
136+
const tystate = useTaskyonStore();
135137
136138
const conversationIDs = ref<string[]>([]);
137139
const nameMap = reactive<Record<string, string>>({});
138140
139141
async function updateName(id: string) {
140142
if (!(id in nameMap)) {
141-
const tm = await state.getTaskManager();
143+
const tm = await tystate.getTaskManager();
142144
const name = (await tm.getTask(id))?.name;
143145
if (name) {
144146
nameMap[id] = name;
@@ -161,7 +163,7 @@ watch(
161163
);
162164
163165
async function loadYamlConversation(files: File[]) {
164-
const tm = await state.getTaskManager();
166+
const tm = await tystate.getTaskManager();
165167
let last_loaded_id = undefined;
166168
for (const file of files) {
167169
last_loaded_id = await tm.loadYamlConversation(file);

src/components/taskyon/ConversationWidget.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const $q = useQuasar();
5959
6060
const props = defineProps<{
6161
selectedThread: TaskNode[];
62-
currentTask?: TaskNode;
62+
currentTask?: TaskNode | undefined;
6363
taskWorkerWaiting: boolean;
6464
taskWorkerMessage?: string;
6565
}>();

src/components/taskyon/CreateNewTask.vue

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,10 +62,10 @@
6262
<div class="row">
6363
<info-dialog
6464
v-if="
65-
currentModel && state.modelLookUp[currentModel]?.description
65+
currentModel && tystate.modelLookUp[currentModel]?.description
6666
"
6767
size="xs"
68-
:info-text="state.modelLookUp[currentModel]?.description"
68+
:info-text="tystate.modelLookUp[currentModel]?.description || ''"
6969
/>
7070
<q-btn flat dense size="sm" no-caps>
7171
<div class="ellipsis">
@@ -111,7 +111,7 @@
111111
<q-space></q-space>
112112
<div v-if="currentModel" class="gt-xs">
113113
{{
114-
`t/c: ${estimatedTokens}/${state.modelLookUp[currentModel]?.context_length}`
114+
`t/c: ${estimatedTokens}/${tystate.modelLookUp[currentModel]?.context_length}`
115115
}}
116116
<q-tooltip :delay="1000" class="q-gutter-sm">
117117
<div>
@@ -367,6 +367,7 @@ import { getApiConfig } from 'src/modules/taskyon/taskWorker';
367367
import { addPrompts } from 'src/modules/taskyon/promptCreation';
368368
import type { ChatCompletionMessageParam } from 'openai/resources/index.mjs';
369369
import { useNlpWorker } from 'src/modules/taskyon/webWorkerApi';
370+
import { useAppStateStore } from 'src/stores/appState';
370371
371372
const CodeEditor = defineAsyncComponent(
372373
() =>
@@ -392,7 +393,8 @@ function updateContent(value: string | null | undefined) {
392393
};
393394
}
394395
395-
const state = useTaskyonStore();
396+
const state = useAppStateStore();
397+
const tystate = useTaskyonStore();
396398
const { expandedTaskCreation } = toRefs(state);
397399
const { expertMode } = toRefs(state.appConfiguration);
398400
const { selectedApi } = toRefs(state.llmSettings);
@@ -404,7 +406,7 @@ const fileAttachments = ref<File[]>([]); // holds all attached files as a "taskl
404406
405407
async function getAllTools() {
406408
const foundTools = await (
407-
await state.getTaskManager()
409+
await tystate.getTaskManager()
408410
).updateToolDefinitions(true);
409411
return foundTools;
410412
}
@@ -455,7 +457,7 @@ const handleBotNameUpdate = ({
455457
if (api) {
456458
api.selectedModel = newName;
457459
}
458-
state.addModelToHistory(newName);
460+
tystate.addModelToHistory(newName);
459461
};
460462
461463
const selectedTaskType = computed(() => {
@@ -554,7 +556,7 @@ watchDebounced(
554556
let accumulatedEstimated = 0;
555557
let messages: ChatCompletionMessageParam[] = [];
556558
if (state.llmSettings.selectedTaskId) {
557-
const tm = await state.getTaskManager();
559+
const tm = await tystate.getTaskManager();
558560
// we only need the last 2 or 3 tasks in order to check for
559561
const chain = await tm.getTaskIdChain(
560562
state.llmSettings.selectedTaskId,
@@ -610,7 +612,7 @@ async function addFiles2Taskyon(newFiles: File[]) {
610612
611613
// Collect UUIDs from added files
612614
const uuids = [];
613-
const tm = await state.getTaskManager();
615+
const tm = await tystate.getTaskManager();
614616
for (const [fileIdx, file] of newFiles.entries()) {
615617
const uuid = await tm.addFile({
616618
opfs: opfsMapping[fileIdx],
@@ -630,7 +632,7 @@ async function createFileTask(files: File[]) {
630632
const fileUuids = await addFiles2Taskyon(files);
631633
632634
if (fileUuids.length) {
633-
const task: Parameters<typeof state.addTask2Tree>[0] = {
635+
const task: Parameters<typeof tystate.addTask2Tree>[0] = {
634636
role: 'system',
635637
configuration: currentModel.value
636638
? {
@@ -650,12 +652,12 @@ async function createFileTask(files: File[]) {
650652
async function addNewTask(execute = true) {
651653
// make sure we reset our execution context interrupt We do this right before adding another
652654
// task, because we want to make sure that
653-
state.taskWorkerController.reset();
655+
tystate.taskWorkerController.reset();
654656
const fileTaskObj = await createFileTask(fileAttachments.value);
655657
let fileTaskId = undefined;
656658
if (fileTaskObj) {
657659
console.log('add files to chat:', fileTaskObj);
658-
fileTaskId = await state.addTask2Tree(
660+
fileTaskId = await tystate.addTask2Tree(
659661
fileTaskObj,
660662
state.llmSettings.selectedTaskId, // parent
661663
false, // we do not want to execute the file object, we want to use the users prompt...
@@ -668,7 +670,7 @@ async function addNewTask(execute = true) {
668670
// otherwise, it won't get executed but simply saved into the tree
669671
console.log('adding new task, execute?', execute);
670672
const newTask = { ...currentnewTask.value };
671-
const newTaskId = await state.addTask2Tree(
673+
const newTaskId = await tystate.addTask2Tree(
672674
newTask,
673675
fileTaskId || state.llmSettings.selectedTaskId, //parent
674676
execute, // execute right away...

src/components/taskyon/CreateTaskButton.vue

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,19 @@
33
</template>
44

55
<script setup lang="ts">
6+
import { useAppStateStore } from 'src/stores/appState';
67
import { useTaskyonStore } from 'src/stores/taskyonState';
78
8-
const state = useTaskyonStore();
9+
const tystate = useTaskyonStore();
10+
const state = useAppStateStore();
911
1012
const props = defineProps<{
1113
markdown?: string;
1214
scrollToBottom?: boolean;
1315
}>();
1416
1517
const onAddTasks = async () => {
16-
const newTaskId = await state.addMdTasks(props.markdown);
18+
const newTaskId = await tystate.addMdTasks(props.markdown);
1719
state.llmSettings.selectedTaskId = newTaskId;
1820
state.lockBottomScroll = props.scrollToBottom;
1921
};

src/components/taskyon/ExpertEnable.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,6 @@
1212
</template>
1313

1414
<script setup lang="ts">
15-
import { useTaskyonStore } from 'src/stores/taskyonState';
16-
const state = useTaskyonStore();
15+
import { useAppStateStore } from 'src/stores/appState';
16+
const state = useAppStateStore();
1717
</script>

src/components/taskyon/GetStarted.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@
3636
</template>
3737

3838
<script setup lang="ts">
39-
import { useTaskyonStore } from 'stores/taskyonState';
4039
import LLMProviders from './LLMProviders.vue';
4140
import CreateTaskButton from './CreateTaskButton.vue';
4241
import { computed } from 'vue';
42+
import { useAppStateStore } from 'src/stores/appState';
4343
44-
const state = useTaskyonStore();
44+
const state = useAppStateStore();
4545
4646
const starters = computed(() => {
4747
return [

src/components/taskyon/LLMProviders.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,6 @@ insert into the settings below."
172172
</template>
173173

174174
<script setup lang="ts">
175-
import { useTaskyonStore } from 'stores/taskyonState';
176175
import OpenRouterPKCE from './OpenRouterPKCE.vue';
177176
import JsonInput from '../JsonInput.vue';
178177
import TyMarkdown from '../tyMarkdown.vue';
@@ -181,8 +180,9 @@ import { matEdit } from '@quasar/extras/material-icons';
181180
import ApiSelect from './ApiSelect.vue';
182181
import InfoDialog from '../InfoDialog.vue';
183182
import tykeyobj from 'src/assets/taskyon_free_key.json';
183+
import { useAppStateStore } from 'src/stores/appState';
184184
185-
const state = useTaskyonStore();
185+
const state = useAppStateStore();
186186
187187
const expertModeOn = defineModel<boolean>('expertModeOn', { default: false });
188188

src/components/taskyon/ModelSelection.vue

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ import ApiSelect from './ApiSelect.vue';
8080
import { mdiKeyLink } from '@quasar/extras/mdi-v6';
8181
import { levenshteinDistance } from 'src/modules/string_utils';
8282
import ToggleButton from '../ToggleButton.vue';
83+
import { useAppStateStore } from 'src/stores/appState';
8384
8485
defineProps({
8586
botName: {
@@ -103,7 +104,8 @@ const showVisionModels = ref(false);
103104
104105
const emit = defineEmits(['updateBotName']);
105106
106-
const state = useTaskyonStore();
107+
const tystate = useTaskyonStore();
108+
const state = useAppStateStore();
107109
108110
const selectModelInput = ref();
109111
@@ -112,7 +114,7 @@ const llmModelsSelection = computed(() => {
112114
// if we have a taskyon key defined only display the models allowed for that key...
113115
if (state.tyPublicKey?.model && state.tyPublicKey.model.length > 0) {
114116
if (state.tyPublicKey.model.includes('*')) {
115-
return state.llmModels;
117+
return tystate.llmModels;
116118
} else {
117119
const models = state.tyPublicKey.model;
118120
return models.map((m) => {
@@ -122,22 +124,22 @@ const llmModelsSelection = computed(() => {
122124
}
123125
}
124126
}
125-
return state.llmModels;
127+
return tystate.llmModels;
126128
});
127129
128130
const modelOptions = computed(() => {
129131
// openai has no pricing information attached, so we sort it in different ways...
130132
console.log('calculate model options!');
131133
if (selectedApi.value === 'openai') {
132-
const options = [...state.llmModels]
134+
const options = [...tystate.llmModels]
133135
.sort((m1, m2) => m1.id.localeCompare(m2.id))
134136
.map((m) => ({
135137
label: `${m.id}`,
136138
value: m.id,
137139
}));
138140
return options;
139141
} else {
140-
let llmModels: typeof state.llmModels = llmModelsSelection.value;
142+
let llmModels: typeof tystate.llmModels = llmModelsSelection.value;
141143
if (showVisionModels.value) {
142144
llmModels = llmModels.filter(
143145
(m) => m.architecture?.modality === 'text+image->text',

src/components/taskyon/OpenRouterPKCE.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,18 @@ import { useTaskyonStore } from 'src/stores/taskyonState';
3232
import { useRoute } from 'vue-router';
3333
import InfoDialog from 'components/InfoDialog.vue';
3434
import { matKey } from '@quasar/extras/material-icons';
35+
import { useAppStateStore } from 'src/stores/appState';
3536
36-
const state = useTaskyonStore();
37+
const tystate = useTaskyonStore();
38+
const state = useAppStateStore();
3739
const route = useRoute();
3840
3941
const callbackUrl = window.location.origin; // This will get the base URL of your application
4042
4143
const authURL = computed(() => {
4244
console.log('get current URL');
4345
return `https://openrouter.ai/auth?callback_url=${encodeURIComponent(
44-
callbackUrl
46+
callbackUrl,
4547
)}`;
4648
});
4749
@@ -54,7 +56,7 @@ async function checkForApiKey() {
5456
const code = route.query['code'] as string | undefined;
5557
if (code) {
5658
console.log('found code in URL:', code);
57-
await state.getOpenRouterPKCEKey(code);
59+
await tystate.getOpenRouterPKCEKey(code);
5860
}
5961
}
6062

0 commit comments

Comments
 (0)