PluginProbe
VikBooking Hotel Booking Engine & PMS / 1.8.16
VikBooking Hotel Booking Engine & PMS v1.8.16
1.8.16 1.8.15 1.8.14 1.8.13 1.8.12 1.8.11 1.8.10 1.8.9 1.8.6 1.8.7 1.8.8 trunk 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6 1.6.7 1.6.8 1.6.9 1.7.0 1.7.1 1.7.2 All 37 releases
← All changes | admin/controllers/ai.php +33 -0 1.8.7 → 1.8.16 View file →
@@ -142,5 +142,38 @@
142 142
143 143 // output the result tags
144 144 VBOHttpDocument::getInstance($app)->json(['tags' => $tags]);
145 145 }
146 +
147 + /**
148 + * Task used to summarize the provided conversation for the administrator.
149 + *
150 + * @return void
151 + *
152 + * @since 1.18.8 (J) - 1.8.8 (WP)
153 + */
154 + public function summarize()
155 + {
156 + $app = JFactory::getApplication();
157 +
158 + $messages = $app->input->get('messages', [], 'array');
159 +
160 + try {
161 + if (!JSession::checkToken()) {
162 + // missing CSRF-proof token
163 + throw new Exception(JText::translate('JINVALID_TOKEN'), 403);
164 + }
165 +
166 + // validate AI service capabilities
167 + $this->auditServiceCapabilities();
168 +
169 + $summary = (new VCMAiModelService)->summarizeThread($messages);
170 + } catch (Exception $error) {
171 + // something went wrong
172 + VCMHttpDocument::getInstance($app)->close($error->getCode() ?: 500, $error->getMessage());
173 + }
174 +
175 + VCMHttpDocument::getInstance($app)->json([
176 + 'result' => $summary,
177 + ]);
178 + }
146 179 }