Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 30 additions & 3 deletions admin/src/views/ChatView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,7 @@ const switchBranchMutation = useMutation({
const newBranchMutation = useMutation({
mutationFn: (sessionId: string) => chatApi.newBranchFromScratch(sessionId),
onSuccess: async () => {
showBranchTree.value = true
await refetchSession()
await refetchBranches()
},
Expand All @@ -458,6 +459,12 @@ function startNewBranch() {
newBranchMutation.mutate(currentSessionId.value)
}

function startNewBranchAndShowTree() {
if (!currentSessionId.value) return
showBranchTree.value = true
newBranchMutation.mutate(currentSessionId.value)
}

const deleteMessageMutation = useMutation({
mutationFn: ({ sessionId, messageId }: { sessionId: string; messageId: string }) =>
chatApi.deleteMessage(sessionId, messageId),
Expand Down Expand Up @@ -2162,7 +2169,7 @@ watch(sessions, (newSessions) => {
<div
v-if="cc.isActive.value"
:class="[
'p-4',
'p-4 shrink-0',
fullscreenStore.isFullscreen ? 'zen-glass' : 'bg-card',
inputPosition === 'bottom' ? 'border-t border-border order-last' + (fullscreenStore.isFullscreen ? '' : ' pb-24') : 'border-b border-border'
]"
Expand Down Expand Up @@ -2203,14 +2210,24 @@ watch(sessions, (newSessions) => {
>
<Send class="w-5 h-5" />
</button>
<!-- New branch button (yellow) -->
<button
v-if="currentSessionId"
:disabled="newBranchMutation.isPending.value"
class="p-3 rounded-lg bg-amber-500 hover:bg-amber-600 text-white transition-colors disabled:opacity-50"
:title="t('chatView.newBranch')"
@click="startNewBranchAndShowTree"
>
<Plus class="w-5 h-5" />
</button>
</div>
</div>

<!-- Input Area: Normal chat mode -->
<div
v-else-if="currentSession && !isReadOnly"
:class="[
'p-4',
'p-4 shrink-0',
fullscreenStore.isFullscreen ? 'zen-glass' : 'bg-card',
inputPosition === 'bottom' ? 'border-t border-border order-last' + (fullscreenStore.isFullscreen ? '' : ' pb-24') : 'border-b border-border'
]"
Expand Down Expand Up @@ -2272,6 +2289,16 @@ watch(sessions, (newSessions) => {
>
<ArrowDownToLine class="w-5 h-5" />
</button>
<!-- New branch button (yellow) -->
<button
v-if="currentSessionId"
:disabled="newBranchMutation.isPending.value"
class="p-3 rounded-lg bg-amber-500 hover:bg-amber-600 text-white transition-colors disabled:opacity-50"
:title="t('chatView.newBranch')"
@click="startNewBranchAndShowTree"
>
<Plus class="w-5 h-5" />
</button>
</div>
<!-- Recording indicator -->
<div v-if="isRecording" class="mt-2 flex items-center gap-2 text-sm text-red-500">
Expand All @@ -2281,7 +2308,7 @@ watch(sessions, (newSessions) => {
</div>

<!-- Messages + Branch Tree row -->
<div class="flex-1 flex overflow-hidden relative">
<div class="flex-1 flex overflow-hidden relative min-h-0">
<!-- Messages -->
<div
ref="messagesContainer"
Expand Down
Loading