Skip to content

Commit 402d501

Browse files
committed
chat gpt-5 add
1 parent 60454fd commit 402d501

10 files changed

Lines changed: 730 additions & 50 deletions

File tree

Controller/Adminhtml/ProductChat/Process.php

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,14 @@ public function execute()
104104
$systemContent = '1.You are a helpful product assistant for this online store selling gunsafes.
105105
2.Provide concise and accurate information about products.
106106
3.If not enought information from customer ask about more details
107-
4.Provide image links for products
107+
4.Provide image links for products and url to the product page
108108
5.Respond with 5 products if you have relevant information
109+
5.1 if user ask showing more product show more products but not more than 10
109110
6.Ask user when he want to buy
111+
6.1 use MD formate for response inks in the ([url]) format
112+
6.2 image comes last in the product description
113+
6.3 product name first starts with ###
114+
6.4 add your thinking after the image about this safe as a sales person and expert in safes tell right away if it is cheap and not secure enough
110115
7.Instruction to buy by phone call **911**';
111116

112117
$systemContent .= $this->openAiService->getRAGData();
@@ -133,10 +138,8 @@ public function execute()
133138
// Add the current user query
134139
$messages[] = ['role' => 'user', 'content' => $query];
135140

136-
//dd($messages);
137-
// Process the request through OpenAiService with GPT-4o mini model
138-
$response = $this->openAiService->getChatCompletion($messages, 'gpt-4o-mini', $apiKey);
139-
141+
// Process the request through OpenAiService with GPT-5 mini model
142+
$response = $this->openAiService->getChatCompletion($messages, 'gpt-5-nano', $apiKey);
140143
// Extract the content from the response array
141144
$messageContent = is_array($response) && isset($response['content']) ? $response['content'] : $response;
142145

@@ -222,6 +225,9 @@ function ($matches) {
222225
// Bold text between ** **
223226
$formatted = preg_replace('/\*\*([^*]+)\*\*/', '<strong>$1</strong>', $formatted);
224227

228+
// Make "TEXT:" patterns bold (e.g., "Configuration:", "Status:", etc.)
229+
$formatted = preg_replace('/\b([A-Z][A-Za-z\s]*):/', '<strong>$1:</strong>', $formatted);
230+
225231
// Handle numbered lists
226232
$formatted = preg_replace('/(^|\n)(\d+\.)\s/', '$1<strong>$2</strong> ', $formatted);
227233

Controller/Chat/Query.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ public function getAiResponse($query, $storeContext, $conversationHistory, $conv
343343

344344
$response = $this->openAiService->sendChatRequest(
345345
$messages,
346-
'gpt-3.5-turbo',
346+
'gpt-5-nano',
347347
$apiKey
348348
);
349349

0 commit comments

Comments
 (0)