Skip to content

Commit d848711

Browse files
committed
feat: allow to run multiple task in paralel
1 parent 8bea527 commit d848711

5 files changed

Lines changed: 21 additions & 19 deletions

File tree

custom/ChatSurface.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,6 @@
8888
<div class="flex items-center justify-center">
8989
<Button
9090
@click="agentStore.createPreSession(); agentStore.setSessionHistoryOpen(false); agentStore.focusTextInput();"
91-
:disabled="agentStore.isResponseInProgress"
9291
class="!py-1 !px-2 rounded-3xl text-gray-800 dark:text-gray-200 max-w-64 mr-2"
9392
>
9493
<IconPlusOutline class="w-5 h-5" />

custom/SessionsHistory.vue

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
<div class="w-full flex items-center justify-center">
1010
</div>
1111
<div class="w-full border-b border-gray-200 dark:border-gray-700"/>
12-
<div class="absolute w-full h-full flex flex-col items-center justify-center bg-gray-100/50 dark:bg-gray-700/50 z-10" v-if="agentStore.isResponseInProgress">
13-
<Spinner class="w-8 h-8" v-if="agentStore.isResponseInProgress" />
14-
<p class="mt-2 text-gray-800 dark:text-gray-200">{{ $t('Generation in progress...') }}</p>
15-
</div>
1612
<div v-for="group in groupedSessions" :key="group.dayKey" class="w-full py-2">
1713
<div class="px-4 pb-2 text-xs font-semibold uppercase tracking-[0.2em] text-gray-500 dark:text-gray-400">
1814
{{ group.label }}
@@ -24,10 +20,8 @@
2420
class=" flex items-center justify-between w-full px-4 py-2 cursor-pointer hover:bg-gray-100 dark:hover:bg-gray-700 transition-colors duration-200 ease-in-out text-gray-800 dark:text-gray-200"
2521
:class="{
2622
'bg-lightPrimary/20 hover:bg-lightPrimary/20 dark:bg-darkPrimary/20 dark:hover:bg-darkPrimary/20': agentStore.activeSessionId === session.sessionId,
27-
'cursor-default opacity-50 pointer-events-none': agentStore.isResponseInProgress,
2823
}"
2924
@click="agentStore.setActiveSession(session.sessionId); agentStore.setSessionHistoryOpen(false);"
30-
:disabled="agentStore.isResponseInProgress"
3125
>
3226
<p class="truncate">{{ session.title || session.sessionId }}</p>
3327
<div @click.stop="agentStore.deleteSession(session.sessionId)" class="w-7 h-7 p-1 hover:scale-110 hover:bg-gray-200 dark:hover:bg-gray-500 flex items-center justify-center rounded">

custom/composables/useAgentStore.ts

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ export const useAgentStore = defineStore('agent', () => {
6060
const activeModeName = ref<string | null>(null);
6161
const hasTypedMessageInPageSession = ref(false);
6262
const { width: windowWidth } = useWindowSize();
63+
64+
const chats = new Map<string, Chat<any>>();
65+
const currentChat = shallowRef<Chat<any>>();
66+
6367
let placeholderAnimationTimer: ReturnType<typeof setTimeout> | null = null;
6468

6569
function setLocalStorageItem(key: string, value: string) {
@@ -189,8 +193,6 @@ export const useAgentStore = defineStore('agent', () => {
189193
}
190194
}
191195
})
192-
const chats = new Map<string, Chat<any>>();
193-
const currentChat = shallowRef<Chat<any>>();
194196

195197
function setAvailableModes(modes: AgentMode[], defaultModeName?: string | null) {
196198
availableModes.value = modes;
@@ -549,14 +551,16 @@ export const useAgentStore = defineStore('agent', () => {
549551
}
550552
currentSession.value = sessions.value[sessionId];
551553
setCurrentChat(sessionId);
552-
currentChat.value.messages = currentSession.value?.messages.map((m: any) => ({
553-
role: m.role,
554-
parts:[{
555-
type: 'text',
556-
text: m.text,
557-
state: 'done',
558-
}]
559-
}));
554+
if (currentChat.value.messages.length === 0) {
555+
currentChat.value.messages = currentSession.value?.messages.map((m: any) => ({
556+
role: m.role,
557+
parts:[{
558+
type: 'text',
559+
text: m.text,
560+
state: 'done',
561+
}]
562+
}));
563+
}
560564
}
561565

562566
async function fetchSessionsList() {

custom/conversation_area/ProcessingTimeline.vue

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@
7474
7575
onMounted(() => {
7676
thinkingStartTime.value = Date.now();
77+
if (isResponseInProgress.value) {
78+
isExpanded.value = true;
79+
} else {
80+
isExpanded.value = false;
81+
}
7782
})
7883
7984
onUnmounted(() => {

custom/conversation_area/TextRenderer.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@
1717
:incremark-options="incremarkOptions"
1818
/>
1919
<p v-else class="text-red-500 py-2">
20-
{{ $t('Error occurred') }}
20+
{{ $t('No content to render') }}
2121
</p>
2222
</div>
2323
</template>
2424

25-
<script setup lang="ts">const isExpanded = ref(true);
25+
<script setup lang="ts">
2626
2727
import { computed, defineAsyncComponent, onMounted, ref, watch } from 'vue';
2828
import { useRouter } from 'vue-router';

0 commit comments

Comments
 (0)