Add chat_metadata object to Kobold Lite import header
| @@ -216,7 +216,7 @@ function importKoboldLiteChat(_userName, _characterName, data) { | |||
| 216 | function processKoboldMessage(msg) { | 216 | function processKoboldMessage(msg) { |
| 217 | const isUser = msg.includes(inputToken); | 217 | const isUser = msg.includes(inputToken); |
| 218 | return { | 218 | return { |
| 219 | name: isUser ? header.user_name : header.character_name, | 219 | name: isUser ? userName : characterName, |
| 220 | is_user: isUser, | 220 | is_user: isUser, |
| 221 | mes: msg.replaceAll(inputToken, '').replaceAll(outputToken, '').trim(), | 221 | mes: msg.replaceAll(inputToken, '').replaceAll(outputToken, '').trim(), |
| 222 | send_date: new Date().toISOString(), | 222 | send_date: new Date().toISOString(), |
| @@ -225,9 +225,12 @@ function importKoboldLiteChat(_userName, _characterName, data) { | |||
| 225 | } | 225 | } |
| 226 | 226 | ||
| 227 | // Create the header | 227 | // Create the header |
| 228 | const userName = String(data.savedsettings.chatname); | ||
| 229 | const characterName = String(data.savedsettings.chatopponent).split('||$||')[0]; | ||
| 228 | const header = { | 230 | const header = { |
| 229 | user_name: String(data.savedsettings.chatname), | 231 | chat_metadata: {}, |
| 230 | character_name: String(data.savedsettings.chatopponent).split('||$||')[0], | 232 | user_name: 'unused', |
| 233 | character_name: 'unused', | ||
| 231 | }; | 234 | }; |
| 232 | // Format messages | 235 | // Format messages |
| 233 | const formattedMessages = data.actions.map(processKoboldMessage); | 236 | const formattedMessages = data.actions.map(processKoboldMessage); |