Skip to content

Commit

Permalink
fix: conversion problems listed in #222
Browse files Browse the repository at this point in the history
  • Loading branch information
lugia19 authored and pionxzh committed Mar 13, 2024
1 parent 9377061 commit 56e6cef
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
9 changes: 6 additions & 3 deletions src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -454,11 +454,14 @@ function extractConversationResult(conversationMapping: Record<string, Conversat
break // Node not found
}

if (node.message?.author.role === 'system') {
break // Stop at system message
if (node.parent === undefined) {
break // Stop at root message.
}

if (node.message?.author.role !== 'system') { // Skip system messages
result.unshift(node)
}

result.unshift(node)
currentNodeId = node.parent
}

Expand Down
4 changes: 2 additions & 2 deletions src/utils/conversion.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ function convertMessageToTavern(node: ConversationNode): TavernMessage | null {
return {
name: authorRole === 'assistant' ? 'Assistant' : 'You',
is_user: authorRole === 'user',
// This seems to be always true
is_name: true,
// This is the opposite of is_user! Not always true.
is_name: authorRole === 'assistant',
send_date: createTime,
mes: text,
swipes: [text],
Expand Down

0 comments on commit 56e6cef

Please sign in to comment.