Skip to content

Commit 9fdb2cd

Browse files
committed
✨ Update export configuration and ChatML export logic for improved clarity and functionality 🚀
- Change modal size to 'xl' for better visibility in export settings 🖥️ - Add helpful tooltips for system prompt and export options to enhance user experience 💡 - Ensure 'content' field is initialized in ChatML export to prevent potential issues with empty messages 🛠️
1 parent 89e8a57 commit 9fdb2cd

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

lhc_web/design/defaulttheme/tpl/lhchat/export_config.tpl.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?php
22
$modalHeaderClass = 'pt-1 pb-1 ps-2 pe-2';
33
$modalHeaderTitle = erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Export XLS/CSV');
4-
$modalSize = 'md';
4+
$modalSize = 'xl';
55
$modalBodyClass = 'p-1';
66
$appendPrintExportURL = '';
77
?>
@@ -64,20 +64,23 @@
6464
<textarea id="system_prompt" name="system_prompt" class="form-control form-control-sm" rows="7" placeholder="<?php echo htmlspecialchars(erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','This will be added as a system message for ChatML export only.'))?>"></textarea>
6565
</div>
6666

67+
<small class="text-muted"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Leave empty to export without a system prompt.')?></small>
68+
6769
<div class="form-group mt-2">
6870
<label for="last_n_messages"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Include first n messages')?></label>
6971
<input type="number" min="1" step="1" id="last_n_messages" name="last_n_messages" class="form-control form-control-sm" value="15">
7072
</div>
7173

7274
<div class="form-group mt-2">
7375
<label><input type="checkbox" name="exclude_operator_messages" value="1"> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Exclude operator messages')?></label>
76+
<small class="text-muted d-block"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Export stops at the first operator message. If the chat already contains bot replies, a transfer_to_operator tool call is added before stopping.')?></small>
7477
</div>
7578

7679
<div class="form-group mt-2">
7780
<label><input type="checkbox" name="only_with_tool_calls" value="1"> <?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Export only chats with tool calls')?></label>
81+
<small class="text-muted d-block"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Chats are skipped completely unless the exported conversation contains at least one tool call or tool result.')?></small>
7882
</div>
7983

80-
<small class="text-muted"><?php echo erTranslationClassLhTranslation::getInstance()->getTranslation('chat/lists/search_panel','Leave empty to export without a system prompt.')?></small>
8184
</div>
8285
</div>
8386

lhc_web/lib/vendor_lhc/LiveHelperChat/Helpers/Export/ChatML.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public static function fromChat($chat, $params = array())
5858
$toolCallId = 'file_search_' . (int)$chat->id . '_' . (int)$message->id;
5959
$currentTurn[] = array(
6060
'role' => 'assistant',
61+
'content' => '',
6162
'tool_calls' => array(
6263
array(
6364
'id' => $toolCallId,
@@ -111,6 +112,7 @@ public static function fromChat($chat, $params = array())
111112
$toolCallId = 'transfer_to_operator_' . (int)$chat->id . '_' . (int)$message->id;
112113
$currentTurn[] = array(
113114
'role' => 'assistant',
115+
'content' => '',
114116
'tool_calls' => array(
115117
array(
116118
'id' => $toolCallId,
@@ -158,6 +160,7 @@ public static function fromChat($chat, $params = array())
158160
$toolCallId = 'transfer_to_operator_' . (int)$chat->id . '_' . (int)$message->id;
159161
$currentTurn[] = array(
160162
'role' => 'assistant',
163+
'content' => '',
161164
'tool_calls' => array(
162165
array(
163166
'id' => $toolCallId,
@@ -305,6 +308,7 @@ private static function parseJsonMetaAsChatML($message, & $toolCallNames, & $has
305308

306309
$result[] = array(
307310
'role' => 'assistant',
311+
'content' => '',
308312
'tool_calls' => array(
309313
array(
310314
'id' => $callId,

0 commit comments

Comments
 (0)