Skip to content

Commit 02994df

Browse files
authored
Merge pull request #297 from nextcloud/fix/chat-title
Fix: chat user instruction handling
2 parents e335c49 + 7e8bae0 commit 02994df

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

lib/Controller/ChattyLLMController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function newSession(int $timestamp, ?string $title = null): JSONResponse
132132
Application::APP_ID,
133133
'chat_user_instructions',
134134
Application::CHAT_USER_INSTRUCTIONS,
135-
);
135+
) ?: Application::CHAT_USER_INSTRUCTIONS;
136136
$userInstructions = str_replace('{user}', $user->getDisplayName(), $userInstructions);
137137

138138
try {
@@ -654,7 +654,7 @@ public function generateTitle(int $sessionId): JSONResponse {
654654
Application::APP_ID,
655655
'chat_user_instructions_title',
656656
Application::CHAT_USER_INSTRUCTIONS_TITLE,
657-
);
657+
) ?: Application::CHAT_USER_INSTRUCTIONS_TITLE;
658658
$userInstructions = str_replace('{user}', $user->getDisplayName(), $userInstructions);
659659

660660
$systemPrompt = '';
@@ -733,7 +733,7 @@ public function checkTitleGenerationTask(int $taskId, int $sessionId): JSONRespo
733733
Application::APP_ID,
734734
'chat_user_instructions_title',
735735
Application::CHAT_USER_INSTRUCTIONS_TITLE,
736-
);
736+
) ?: Application::CHAT_USER_INSTRUCTIONS_TITLE;
737737
$userInstructions = str_replace('{user}', $user->getDisplayName(), $userInstructions);
738738
$title = str_replace($userInstructions, '', $taskOutput);
739739
$title = str_replace('"', '', $title);

0 commit comments

Comments
 (0)