|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>Plugin_AI_Ollama.OllamaInterface.OllamaWidget</title> |
|
4 <meta charset="UTF-8"> |
|
5 <link rel="stylesheet" href="styles.css"> |
|
6 </head> |
|
7 <body> |
|
8 <a NAME="top" ID="top"></a> |
|
9 <h1>Plugin_AI_Ollama.OllamaInterface.OllamaWidget</h1> |
|
10 <p> |
|
11 Module implementing the main ollama interface widget. |
|
12 </p> |
|
13 |
|
14 <h3>Global Attributes</h3> |
|
15 <table> |
|
16 <tr><td>None</td></tr> |
|
17 </table> |
|
18 |
|
19 <h3>Classes</h3> |
|
20 <table> |
|
21 <tr> |
|
22 <td><a href="#OllamaWidget">OllamaWidget</a></td> |
|
23 <td>Class implementing the main ollama interface widget.</td> |
|
24 </tr> |
|
25 </table> |
|
26 |
|
27 <h3>Functions</h3> |
|
28 <table> |
|
29 <tr><td>None</td></tr> |
|
30 </table> |
|
31 |
|
32 <hr /> |
|
33 <hr /> |
|
34 <a NAME="OllamaWidget" ID="OllamaWidget"></a> |
|
35 <h2>OllamaWidget</h2> |
|
36 <p> |
|
37 Class implementing the main ollama interface widget. |
|
38 </p> |
|
39 |
|
40 <h3>Derived from</h3> |
|
41 QWidget, Ui_OllamaWidget |
|
42 <h3>Class Attributes</h3> |
|
43 <table> |
|
44 <tr><td>OllamaHistoryFile</td></tr> |
|
45 </table> |
|
46 |
|
47 <h3>Class Methods</h3> |
|
48 <table> |
|
49 <tr><td>None</td></tr> |
|
50 </table> |
|
51 |
|
52 <h3>Methods</h3> |
|
53 <table> |
|
54 <tr> |
|
55 <td><a href="#OllamaWidget.__init__">OllamaWidget</a></td> |
|
56 <td>Constructor</td> |
|
57 </tr> |
|
58 <tr> |
|
59 <td><a href="#OllamaWidget.__aboutToShowOllamaMenu">__aboutToShowOllamaMenu</a></td> |
|
60 <td>Private slot to set the action enabled status.</td> |
|
61 </tr> |
|
62 <tr> |
|
63 <td><a href="#OllamaWidget.__checkHistoryModels">__checkHistoryModels</a></td> |
|
64 <td>Private slot to set the chat history entry states according to available models.</td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td><a href="#OllamaWidget.__connectClient">__connectClient</a></td> |
|
68 <td>Private method to connect the client signals.</td> |
|
69 </tr> |
|
70 <tr> |
|
71 <td><a href="#OllamaWidget.__createHistoryWidget">__createHistoryWidget</a></td> |
|
72 <td>Private method to create a chat history widget and insert it into the respective layout.</td> |
|
73 </tr> |
|
74 <tr> |
|
75 <td><a href="#OllamaWidget.__deleteHistory">__deleteHistory</a></td> |
|
76 <td>Private slot to delete the history with the given ID.</td> |
|
77 </tr> |
|
78 <tr> |
|
79 <td><a href="#OllamaWidget.__findChatWidget">__findChatWidget</a></td> |
|
80 <td>Private method to find a chat widget given a chat history ID.</td> |
|
81 </tr> |
|
82 <tr> |
|
83 <td><a href="#OllamaWidget.__findHistoryWidget">__findHistoryWidget</a></td> |
|
84 <td>Private method to find the widget of a given chat history ID.</td> |
|
85 </tr> |
|
86 <tr> |
|
87 <td><a href="#OllamaWidget.__finishSetup">__finishSetup</a></td> |
|
88 <td>Private slot to finish the UI setup.</td> |
|
89 </tr> |
|
90 <tr> |
|
91 <td><a href="#OllamaWidget.__getHistoryIds">__getHistoryIds</a></td> |
|
92 <td>Private method to get a list of all history IDs.</td> |
|
93 </tr> |
|
94 <tr> |
|
95 <td><a href="#OllamaWidget.__handleClientError">__handleClientError</a></td> |
|
96 <td>Private slot to handle an error message sent by the server.</td> |
|
97 </tr> |
|
98 <tr> |
|
99 <td><a href="#OllamaWidget.__handleClientFinished">__handleClientFinished</a></td> |
|
100 <td>Private slot to handle the end of a client server interaction.</td> |
|
101 </tr> |
|
102 <tr> |
|
103 <td><a href="#OllamaWidget.__handlePullError">__handlePullError</a></td> |
|
104 <td>Private slot to handle an error during a pull operation.</td> |
|
105 </tr> |
|
106 <tr> |
|
107 <td><a href="#OllamaWidget.__handlePullStatus">__handlePullStatus</a></td> |
|
108 <td>Private slot to handle a pull status update.</td> |
|
109 </tr> |
|
110 <tr> |
|
111 <td><a href="#OllamaWidget.__handleServerMessage">__handleServerMessage</a></td> |
|
112 <td>Private slot handling an 'ollama' server chat response.</td> |
|
113 </tr> |
|
114 <tr> |
|
115 <td><a href="#OllamaWidget.__handleServerStateChanged">__handleServerStateChanged</a></td> |
|
116 <td>Private slot handling a change in the 'ollama' server responsiveness.</td> |
|
117 </tr> |
|
118 <tr> |
|
119 <td><a href="#OllamaWidget.__historyFilePath">__historyFilePath</a></td> |
|
120 <td>Private method to get the path name of the chat history file.</td> |
|
121 </tr> |
|
122 <tr> |
|
123 <td><a href="#OllamaWidget.__initOllamaMenu">__initOllamaMenu</a></td> |
|
124 <td>Private method to create the super menu and attach it to the super menu button.</td> |
|
125 </tr> |
|
126 <tr> |
|
127 <td><a href="#OllamaWidget.__loadChatHistoriesFile">__loadChatHistoriesFile</a></td> |
|
128 <td>Private method to load chat history entries from a given file.</td> |
|
129 </tr> |
|
130 <tr> |
|
131 <td><a href="#OllamaWidget.__loadHistory">__loadHistory</a></td> |
|
132 <td>Private method to load a previously saved history file.</td> |
|
133 </tr> |
|
134 <tr> |
|
135 <td><a href="#OllamaWidget.__localServerProcessFinished">__localServerProcessFinished</a></td> |
|
136 <td>Private slot handling the finishing of the local 'ollama' server process.</td> |
|
137 </tr> |
|
138 <tr> |
|
139 <td><a href="#OllamaWidget.__menuClearAllHistories">__menuClearAllHistories</a></td> |
|
140 <td>Private slot to clear all chat history entries.</td> |
|
141 </tr> |
|
142 <tr> |
|
143 <td><a href="#OllamaWidget.__menuExportHistories">__menuExportHistories</a></td> |
|
144 <td>Private slot to export chat history entries to a file.</td> |
|
145 </tr> |
|
146 <tr> |
|
147 <td><a href="#OllamaWidget.__menuImportHistories">__menuImportHistories</a></td> |
|
148 <td>Private slot to import chat history entries from a file.</td> |
|
149 </tr> |
|
150 <tr> |
|
151 <td><a href="#OllamaWidget.__newChatWithHistory">__newChatWithHistory</a></td> |
|
152 <td>Private slot to start a new chat using a previously saved history.</td> |
|
153 </tr> |
|
154 <tr> |
|
155 <td><a href="#OllamaWidget.__ollamaConfigure">__ollamaConfigure</a></td> |
|
156 <td>Private slot to show the ollama configuration page.</td> |
|
157 </tr> |
|
158 <tr> |
|
159 <td><a href="#OllamaWidget.__populateModelSelector">__populateModelSelector</a></td> |
|
160 <td>Private slot to receive the list of available model names and populate the model selector with them.</td> |
|
161 </tr> |
|
162 <tr> |
|
163 <td><a href="#OllamaWidget.__pullModel">__pullModel</a></td> |
|
164 <td>Private slot to download a model from the 'ollama' model library.</td> |
|
165 </tr> |
|
166 <tr> |
|
167 <td><a href="#OllamaWidget.__removeChatWidget">__removeChatWidget</a></td> |
|
168 <td>Private method to remove a chat widget given its chat history ID.</td> |
|
169 </tr> |
|
170 <tr> |
|
171 <td><a href="#OllamaWidget.__removeModel">__removeModel</a></td> |
|
172 <td>Private slot to remove a model from the 'ollama' server.</td> |
|
173 </tr> |
|
174 <tr> |
|
175 <td><a href="#OllamaWidget.__saveChatHistoryFile">__saveChatHistoryFile</a></td> |
|
176 <td>Private method to save the chat history entries to a file.</td> |
|
177 </tr> |
|
178 <tr> |
|
179 <td><a href="#OllamaWidget.__saveHistory">__saveHistory</a></td> |
|
180 <td>Private method to save the current chat history to the history file.</td> |
|
181 </tr> |
|
182 <tr> |
|
183 <td><a href="#OllamaWidget.__scrollHistoryToBottom">__scrollHistoryToBottom</a></td> |
|
184 <td>Private slot to scroll the history widget to the bottom.</td> |
|
185 </tr> |
|
186 <tr> |
|
187 <td><a href="#OllamaWidget.__sendMessage">__sendMessage</a></td> |
|
188 <td>Private method to send the given message of the current chat to the 'ollama' server.</td> |
|
189 </tr> |
|
190 <tr> |
|
191 <td><a href="#OllamaWidget.__serverDialogClosed">__serverDialogClosed</a></td> |
|
192 <td>Private slot handling the closing of the local server dialog.</td> |
|
193 </tr> |
|
194 <tr> |
|
195 <td><a href="#OllamaWidget.__serverStarted">__serverStarted</a></td> |
|
196 <td>Private slot to handle the start of a local server.</td> |
|
197 </tr> |
|
198 <tr> |
|
199 <td><a href="#OllamaWidget.__serverStopped">__serverStopped</a></td> |
|
200 <td>Private slot to handle the stopping of a local server.</td> |
|
201 </tr> |
|
202 <tr> |
|
203 <td><a href="#OllamaWidget.__setEnabledState">__setEnabledState</a></td> |
|
204 <td>Private method to set the enabled state of the main widget.</td> |
|
205 </tr> |
|
206 <tr> |
|
207 <td><a href="#OllamaWidget.__setHeaderLabel">__setHeaderLabel</a></td> |
|
208 <td>Private slot to receive the 'ollama' server version and set the header.</td> |
|
209 </tr> |
|
210 <tr> |
|
211 <td><a href="#OllamaWidget.__showModelLibrary">__showModelLibrary</a></td> |
|
212 <td>Private slot to open the 'ollama' model librayr web site.</td> |
|
213 </tr> |
|
214 <tr> |
|
215 <td><a href="#OllamaWidget.__showModels">__showModels</a></td> |
|
216 <td>Private slot to ask the 'ollama' server for a list of available models with some details.</td> |
|
217 </tr> |
|
218 <tr> |
|
219 <td><a href="#OllamaWidget.__showRunningModels">__showRunningModels</a></td> |
|
220 <td>Private slot to show a dialog with data of the running models.</td> |
|
221 </tr> |
|
222 <tr> |
|
223 <td><a href="#OllamaWidget.__startLocalServer">__startLocalServer</a></td> |
|
224 <td>Private slot to start a local 'ollama' server instance in the background.</td> |
|
225 </tr> |
|
226 <tr> |
|
227 <td><a href="#OllamaWidget.__startLocalServerMonitoring">__startLocalServerMonitoring</a></td> |
|
228 <td>Private slot to open a dialog for running a local 'ollama' server instance and monitor its output.</td> |
|
229 </tr> |
|
230 <tr> |
|
231 <td><a href="#OllamaWidget.__stopLocalServer">__stopLocalServer</a></td> |
|
232 <td>Private slot to stop a running local 'ollama' server instance.</td> |
|
233 </tr> |
|
234 <tr> |
|
235 <td><a href="#OllamaWidget.__updateMessageEditState">__updateMessageEditState</a></td> |
|
236 <td>Private slot to set the enabled state of the message line edit and the send button.</td> |
|
237 </tr> |
|
238 <tr> |
|
239 <td><a href="#OllamaWidget.clearHistory">clearHistory</a></td> |
|
240 <td>Public method to clear the history entries and close all chats.</td> |
|
241 </tr> |
|
242 <tr> |
|
243 <td><a href="#OllamaWidget.on_messageEdit_textChanged">on_messageEdit_textChanged</a></td> |
|
244 <td>Private slot to handle a change of the entered message.</td> |
|
245 </tr> |
|
246 <tr> |
|
247 <td><a href="#OllamaWidget.on_modelComboBox_currentTextChanged">on_modelComboBox_currentTextChanged</a></td> |
|
248 <td>Private slot handling the selection of a model.</td> |
|
249 </tr> |
|
250 <tr> |
|
251 <td><a href="#OllamaWidget.on_newChatButton_clicked">on_newChatButton_clicked</a></td> |
|
252 <td>Private slot to start a new chat with the 'ollama' server.</td> |
|
253 </tr> |
|
254 <tr> |
|
255 <td><a href="#OllamaWidget.on_reloadModelsButton_clicked">on_reloadModelsButton_clicked</a></td> |
|
256 <td>Private slot to reload the list of available models.</td> |
|
257 </tr> |
|
258 <tr> |
|
259 <td><a href="#OllamaWidget.prepareServerRuntimeEnvironment">prepareServerRuntimeEnvironment</a></td> |
|
260 <td>Public method to prepare a QProcessEnvironment object.</td> |
|
261 </tr> |
|
262 </table> |
|
263 |
|
264 <h3>Static Methods</h3> |
|
265 <table> |
|
266 <tr><td>None</td></tr> |
|
267 </table> |
|
268 |
|
269 |
|
270 <a NAME="OllamaWidget.__init__" ID="OllamaWidget.__init__"></a> |
|
271 <h4>OllamaWidget (Constructor)</h4> |
|
272 <b>OllamaWidget</b>(<i>plugin, fromEric=True, parent=None</i>) |
|
273 <p> |
|
274 Constructor |
|
275 </p> |
|
276 |
|
277 <dl> |
|
278 |
|
279 <dt><i>plugin</i> (PluginOllamaInterface)</dt> |
|
280 <dd> |
|
281 reference to the plug-in object |
|
282 </dd> |
|
283 <dt><i>fromEric</i> (bool (optional))</dt> |
|
284 <dd> |
|
285 flag indicating the eric-ide mode (defaults to True) |
|
286 (True = eric-ide mode, False = application mode) |
|
287 </dd> |
|
288 <dt><i>parent</i> (QWidget (optional))</dt> |
|
289 <dd> |
|
290 reference to the parent widget (defaults to None) |
|
291 </dd> |
|
292 </dl> |
|
293 <a NAME="OllamaWidget.__aboutToShowOllamaMenu" ID="OllamaWidget.__aboutToShowOllamaMenu"></a> |
|
294 <h4>OllamaWidget.__aboutToShowOllamaMenu</h4> |
|
295 <b>__aboutToShowOllamaMenu</b>(<i></i>) |
|
296 <p> |
|
297 Private slot to set the action enabled status. |
|
298 </p> |
|
299 |
|
300 <a NAME="OllamaWidget.__checkHistoryModels" ID="OllamaWidget.__checkHistoryModels"></a> |
|
301 <h4>OllamaWidget.__checkHistoryModels</h4> |
|
302 <b>__checkHistoryModels</b>(<i>modelNames</i>) |
|
303 <p> |
|
304 Private slot to set the chat history entry states according to available |
|
305 models. |
|
306 </p> |
|
307 |
|
308 <dl> |
|
309 |
|
310 <dt><i>modelNames</i> (list[str])</dt> |
|
311 <dd> |
|
312 list of model names |
|
313 </dd> |
|
314 </dl> |
|
315 <a NAME="OllamaWidget.__connectClient" ID="OllamaWidget.__connectClient"></a> |
|
316 <h4>OllamaWidget.__connectClient</h4> |
|
317 <b>__connectClient</b>(<i></i>) |
|
318 <p> |
|
319 Private method to connect the client signals. |
|
320 </p> |
|
321 |
|
322 <a NAME="OllamaWidget.__createHistoryWidget" ID="OllamaWidget.__createHistoryWidget"></a> |
|
323 <h4>OllamaWidget.__createHistoryWidget</h4> |
|
324 <b>__createHistoryWidget</b>(<i>title, model, jsonStr=None</i>) |
|
325 <p> |
|
326 Private method to create a chat history widget and insert it into the |
|
327 respective layout. |
|
328 </p> |
|
329 |
|
330 <dl> |
|
331 |
|
332 <dt><i>title</i> (str)</dt> |
|
333 <dd> |
|
334 title of the chat |
|
335 </dd> |
|
336 <dt><i>model</i> (str)</dt> |
|
337 <dd> |
|
338 name of the model |
|
339 </dd> |
|
340 <dt><i>jsonStr</i> (str (optional))</dt> |
|
341 <dd> |
|
342 string containing JSON serialize chat history data (defaults |
|
343 to None) |
|
344 </dd> |
|
345 </dl> |
|
346 <dl> |
|
347 <dt>Return:</dt> |
|
348 <dd> |
|
349 reference to the created history widget |
|
350 </dd> |
|
351 </dl> |
|
352 <dl> |
|
353 <dt>Return Type:</dt> |
|
354 <dd> |
|
355 OllamaHistoryWidget |
|
356 </dd> |
|
357 </dl> |
|
358 <a NAME="OllamaWidget.__deleteHistory" ID="OllamaWidget.__deleteHistory"></a> |
|
359 <h4>OllamaWidget.__deleteHistory</h4> |
|
360 <b>__deleteHistory</b>(<i>hid</i>) |
|
361 <p> |
|
362 Private slot to delete the history with the given ID. |
|
363 </p> |
|
364 |
|
365 <dl> |
|
366 |
|
367 <dt><i>hid</i> (str)</dt> |
|
368 <dd> |
|
369 ID of the history to be deleted |
|
370 </dd> |
|
371 </dl> |
|
372 <a NAME="OllamaWidget.__findChatWidget" ID="OllamaWidget.__findChatWidget"></a> |
|
373 <h4>OllamaWidget.__findChatWidget</h4> |
|
374 <b>__findChatWidget</b>(<i>hid</i>) |
|
375 <p> |
|
376 Private method to find a chat widget given a chat history ID. |
|
377 </p> |
|
378 |
|
379 <dl> |
|
380 |
|
381 <dt><i>hid</i> (str)</dt> |
|
382 <dd> |
|
383 chat history ID |
|
384 </dd> |
|
385 </dl> |
|
386 <dl> |
|
387 <dt>Return:</dt> |
|
388 <dd> |
|
389 reference to the chat widget related to the given ID |
|
390 </dd> |
|
391 </dl> |
|
392 <dl> |
|
393 <dt>Return Type:</dt> |
|
394 <dd> |
|
395 OllamaChatWidget |
|
396 </dd> |
|
397 </dl> |
|
398 <a NAME="OllamaWidget.__findHistoryWidget" ID="OllamaWidget.__findHistoryWidget"></a> |
|
399 <h4>OllamaWidget.__findHistoryWidget</h4> |
|
400 <b>__findHistoryWidget</b>(<i>hid</i>) |
|
401 <p> |
|
402 Private method to find the widget of a given chat history ID. |
|
403 </p> |
|
404 |
|
405 <dl> |
|
406 |
|
407 <dt><i>hid</i> (str)</dt> |
|
408 <dd> |
|
409 ID of the chat history |
|
410 </dd> |
|
411 </dl> |
|
412 <dl> |
|
413 <dt>Return:</dt> |
|
414 <dd> |
|
415 reference to the chat history widget |
|
416 </dd> |
|
417 </dl> |
|
418 <dl> |
|
419 <dt>Return Type:</dt> |
|
420 <dd> |
|
421 OllamaHistoryWidget |
|
422 </dd> |
|
423 </dl> |
|
424 <a NAME="OllamaWidget.__finishSetup" ID="OllamaWidget.__finishSetup"></a> |
|
425 <h4>OllamaWidget.__finishSetup</h4> |
|
426 <b>__finishSetup</b>(<i></i>) |
|
427 <p> |
|
428 Private slot to finish the UI setup. |
|
429 </p> |
|
430 |
|
431 <a NAME="OllamaWidget.__getHistoryIds" ID="OllamaWidget.__getHistoryIds"></a> |
|
432 <h4>OllamaWidget.__getHistoryIds</h4> |
|
433 <b>__getHistoryIds</b>(<i></i>) |
|
434 <p> |
|
435 Private method to get a list of all history IDs. |
|
436 </p> |
|
437 |
|
438 <dl> |
|
439 <dt>Return:</dt> |
|
440 <dd> |
|
441 list of history IDs |
|
442 </dd> |
|
443 </dl> |
|
444 <dl> |
|
445 <dt>Return Type:</dt> |
|
446 <dd> |
|
447 list[str] |
|
448 </dd> |
|
449 </dl> |
|
450 <a NAME="OllamaWidget.__handleClientError" ID="OllamaWidget.__handleClientError"></a> |
|
451 <h4>OllamaWidget.__handleClientError</h4> |
|
452 <b>__handleClientError</b>(<i>errMsg</i>) |
|
453 <p> |
|
454 Private slot to handle an error message sent by the server. |
|
455 </p> |
|
456 |
|
457 <dl> |
|
458 |
|
459 <dt><i>errMsg</i> (str)</dt> |
|
460 <dd> |
|
461 error message |
|
462 </dd> |
|
463 </dl> |
|
464 <a NAME="OllamaWidget.__handleClientFinished" ID="OllamaWidget.__handleClientFinished"></a> |
|
465 <h4>OllamaWidget.__handleClientFinished</h4> |
|
466 <b>__handleClientFinished</b>(<i></i>) |
|
467 <p> |
|
468 Private slot to handle the end of a client server interaction. |
|
469 </p> |
|
470 |
|
471 <a NAME="OllamaWidget.__handlePullError" ID="OllamaWidget.__handlePullError"></a> |
|
472 <h4>OllamaWidget.__handlePullError</h4> |
|
473 <b>__handlePullError</b>(<i>errMsg</i>) |
|
474 <p> |
|
475 Private slot to handle an error during a pull operation. |
|
476 </p> |
|
477 |
|
478 <dl> |
|
479 |
|
480 <dt><i>errMsg</i> (str)</dt> |
|
481 <dd> |
|
482 error message |
|
483 </dd> |
|
484 </dl> |
|
485 <a NAME="OllamaWidget.__handlePullStatus" ID="OllamaWidget.__handlePullStatus"></a> |
|
486 <h4>OllamaWidget.__handlePullStatus</h4> |
|
487 <b>__handlePullStatus</b>(<i>status, idStr, total, completed</i>) |
|
488 <p> |
|
489 Private slot to handle a pull status update. |
|
490 </p> |
|
491 |
|
492 <dl> |
|
493 |
|
494 <dt><i>status</i> (str)</dt> |
|
495 <dd> |
|
496 status message reported by the 'ollama' server |
|
497 </dd> |
|
498 <dt><i>idStr</i> (str)</dt> |
|
499 <dd> |
|
500 ID of the file being pulled or empty |
|
501 </dd> |
|
502 <dt><i>total</i> (int)</dt> |
|
503 <dd> |
|
504 size of the file being pulled or 0 in case of an empty ID |
|
505 </dd> |
|
506 <dt><i>completed</i> (int)</dt> |
|
507 <dd> |
|
508 downloaded bytes or 0 in case of an empty ID |
|
509 </dd> |
|
510 </dl> |
|
511 <a NAME="OllamaWidget.__handleServerMessage" ID="OllamaWidget.__handleServerMessage"></a> |
|
512 <h4>OllamaWidget.__handleServerMessage</h4> |
|
513 <b>__handleServerMessage</b>(<i>content, role, done</i>) |
|
514 <p> |
|
515 Private slot handling an 'ollama' server chat response. |
|
516 </p> |
|
517 |
|
518 <dl> |
|
519 |
|
520 <dt><i>content</i> (str)</dt> |
|
521 <dd> |
|
522 message sent by the server |
|
523 </dd> |
|
524 <dt><i>role</i> (str)</dt> |
|
525 <dd> |
|
526 role name |
|
527 </dd> |
|
528 <dt><i>done</i> (bool)</dt> |
|
529 <dd> |
|
530 flag indicating the last chat response |
|
531 </dd> |
|
532 </dl> |
|
533 <a NAME="OllamaWidget.__handleServerStateChanged" ID="OllamaWidget.__handleServerStateChanged"></a> |
|
534 <h4>OllamaWidget.__handleServerStateChanged</h4> |
|
535 <b>__handleServerStateChanged</b>(<i>ok, msg</i>) |
|
536 <p> |
|
537 Private slot handling a change in the 'ollama' server responsiveness. |
|
538 </p> |
|
539 |
|
540 <dl> |
|
541 |
|
542 <dt><i>ok</i> (bool)</dt> |
|
543 <dd> |
|
544 flag indicating a responsive 'ollama' server |
|
545 </dd> |
|
546 <dt><i>msg</i> (str)</dt> |
|
547 <dd> |
|
548 status message |
|
549 </dd> |
|
550 </dl> |
|
551 <a NAME="OllamaWidget.__historyFilePath" ID="OllamaWidget.__historyFilePath"></a> |
|
552 <h4>OllamaWidget.__historyFilePath</h4> |
|
553 <b>__historyFilePath</b>(<i></i>) |
|
554 <p> |
|
555 Private method to get the path name of the chat history file. |
|
556 </p> |
|
557 |
|
558 <dl> |
|
559 <dt>Return:</dt> |
|
560 <dd> |
|
561 file path of the chat history file |
|
562 </dd> |
|
563 </dl> |
|
564 <dl> |
|
565 <dt>Return Type:</dt> |
|
566 <dd> |
|
567 str |
|
568 </dd> |
|
569 </dl> |
|
570 <a NAME="OllamaWidget.__initOllamaMenu" ID="OllamaWidget.__initOllamaMenu"></a> |
|
571 <h4>OllamaWidget.__initOllamaMenu</h4> |
|
572 <b>__initOllamaMenu</b>(<i></i>) |
|
573 <p> |
|
574 Private method to create the super menu and attach it to the super |
|
575 menu button. |
|
576 </p> |
|
577 |
|
578 <a NAME="OllamaWidget.__loadChatHistoriesFile" ID="OllamaWidget.__loadChatHistoriesFile"></a> |
|
579 <h4>OllamaWidget.__loadChatHistoriesFile</h4> |
|
580 <b>__loadChatHistoriesFile</b>(<i>filePath, reportDuplicates=False</i>) |
|
581 <p> |
|
582 Private method to load chat history entries from a given file. |
|
583 </p> |
|
584 |
|
585 <dl> |
|
586 |
|
587 <dt><i>filePath</i> (str)</dt> |
|
588 <dd> |
|
589 path of the chat history file |
|
590 </dd> |
|
591 <dt><i>reportDuplicates</i> (bool (optional))</dt> |
|
592 <dd> |
|
593 flag indicating to report skipped chat history entries |
|
594 (defaults to False) |
|
595 </dd> |
|
596 </dl> |
|
597 <dl> |
|
598 <dt>Return:</dt> |
|
599 <dd> |
|
600 flag indicating success |
|
601 </dd> |
|
602 </dl> |
|
603 <dl> |
|
604 <dt>Return Type:</dt> |
|
605 <dd> |
|
606 str |
|
607 </dd> |
|
608 </dl> |
|
609 <a NAME="OllamaWidget.__loadHistory" ID="OllamaWidget.__loadHistory"></a> |
|
610 <h4>OllamaWidget.__loadHistory</h4> |
|
611 <b>__loadHistory</b>(<i></i>) |
|
612 <p> |
|
613 Private method to load a previously saved history file. |
|
614 </p> |
|
615 |
|
616 <a NAME="OllamaWidget.__localServerProcessFinished" ID="OllamaWidget.__localServerProcessFinished"></a> |
|
617 <h4>OllamaWidget.__localServerProcessFinished</h4> |
|
618 <b>__localServerProcessFinished</b>(<i></i>) |
|
619 <p> |
|
620 Private slot handling the finishing of the local 'ollama' server process. |
|
621 </p> |
|
622 |
|
623 <a NAME="OllamaWidget.__menuClearAllHistories" ID="OllamaWidget.__menuClearAllHistories"></a> |
|
624 <h4>OllamaWidget.__menuClearAllHistories</h4> |
|
625 <b>__menuClearAllHistories</b>(<i></i>) |
|
626 <p> |
|
627 Private slot to clear all chat history entries. |
|
628 </p> |
|
629 |
|
630 <a NAME="OllamaWidget.__menuExportHistories" ID="OllamaWidget.__menuExportHistories"></a> |
|
631 <h4>OllamaWidget.__menuExportHistories</h4> |
|
632 <b>__menuExportHistories</b>(<i></i>) |
|
633 <p> |
|
634 Private slot to export chat history entries to a file. |
|
635 </p> |
|
636 |
|
637 <a NAME="OllamaWidget.__menuImportHistories" ID="OllamaWidget.__menuImportHistories"></a> |
|
638 <h4>OllamaWidget.__menuImportHistories</h4> |
|
639 <b>__menuImportHistories</b>(<i></i>) |
|
640 <p> |
|
641 Private slot to import chat history entries from a file. |
|
642 </p> |
|
643 |
|
644 <a NAME="OllamaWidget.__newChatWithHistory" ID="OllamaWidget.__newChatWithHistory"></a> |
|
645 <h4>OllamaWidget.__newChatWithHistory</h4> |
|
646 <b>__newChatWithHistory</b>(<i>hid</i>) |
|
647 <p> |
|
648 Private slot to start a new chat using a previously saved history. |
|
649 </p> |
|
650 |
|
651 <dl> |
|
652 |
|
653 <dt><i>hid</i> (str)</dt> |
|
654 <dd> |
|
655 ID of the history to be used |
|
656 </dd> |
|
657 </dl> |
|
658 <a NAME="OllamaWidget.__ollamaConfigure" ID="OllamaWidget.__ollamaConfigure"></a> |
|
659 <h4>OllamaWidget.__ollamaConfigure</h4> |
|
660 <b>__ollamaConfigure</b>(<i></i>) |
|
661 <p> |
|
662 Private slot to show the ollama configuration page. |
|
663 </p> |
|
664 |
|
665 <a NAME="OllamaWidget.__populateModelSelector" ID="OllamaWidget.__populateModelSelector"></a> |
|
666 <h4>OllamaWidget.__populateModelSelector</h4> |
|
667 <b>__populateModelSelector</b>(<i>modelNames</i>) |
|
668 <p> |
|
669 Private slot to receive the list of available model names and populate |
|
670 the model selector with them. |
|
671 </p> |
|
672 |
|
673 <dl> |
|
674 |
|
675 <dt><i>modelNames</i> (list[str])</dt> |
|
676 <dd> |
|
677 list of model names |
|
678 </dd> |
|
679 </dl> |
|
680 <a NAME="OllamaWidget.__pullModel" ID="OllamaWidget.__pullModel"></a> |
|
681 <h4>OllamaWidget.__pullModel</h4> |
|
682 <b>__pullModel</b>(<i></i>) |
|
683 <p> |
|
684 Private slot to download a model from the 'ollama' model library. |
|
685 </p> |
|
686 |
|
687 <a NAME="OllamaWidget.__removeChatWidget" ID="OllamaWidget.__removeChatWidget"></a> |
|
688 <h4>OllamaWidget.__removeChatWidget</h4> |
|
689 <b>__removeChatWidget</b>(<i>hid</i>) |
|
690 <p> |
|
691 Private method to remove a chat widget given its chat history ID. |
|
692 </p> |
|
693 |
|
694 <dl> |
|
695 |
|
696 <dt><i>hid</i> (str)</dt> |
|
697 <dd> |
|
698 chat history ID |
|
699 </dd> |
|
700 </dl> |
|
701 <a NAME="OllamaWidget.__removeModel" ID="OllamaWidget.__removeModel"></a> |
|
702 <h4>OllamaWidget.__removeModel</h4> |
|
703 <b>__removeModel</b>(<i></i>) |
|
704 <p> |
|
705 Private slot to remove a model from the 'ollama' server. |
|
706 </p> |
|
707 |
|
708 <a NAME="OllamaWidget.__saveChatHistoryFile" ID="OllamaWidget.__saveChatHistoryFile"></a> |
|
709 <h4>OllamaWidget.__saveChatHistoryFile</h4> |
|
710 <b>__saveChatHistoryFile</b>(<i>filePath, entries</i>) |
|
711 <p> |
|
712 Private method to save the chat history entries to a file. |
|
713 </p> |
|
714 |
|
715 <dl> |
|
716 |
|
717 <dt><i>filePath</i> (str)</dt> |
|
718 <dd> |
|
719 file name to save to |
|
720 </dd> |
|
721 <dt><i>entries</i> (dict[str, str])</dt> |
|
722 <dd> |
|
723 dictionary containing the chat history entries as a |
|
724 JSON serialized string indexed by their ID |
|
725 </dd> |
|
726 </dl> |
|
727 <a NAME="OllamaWidget.__saveHistory" ID="OllamaWidget.__saveHistory"></a> |
|
728 <h4>OllamaWidget.__saveHistory</h4> |
|
729 <b>__saveHistory</b>(<i></i>) |
|
730 <p> |
|
731 Private method to save the current chat history to the history file. |
|
732 </p> |
|
733 |
|
734 <a NAME="OllamaWidget.__scrollHistoryToBottom" ID="OllamaWidget.__scrollHistoryToBottom"></a> |
|
735 <h4>OllamaWidget.__scrollHistoryToBottom</h4> |
|
736 <b>__scrollHistoryToBottom</b>(<i></i>) |
|
737 <p> |
|
738 Private slot to scroll the history widget to the bottom. |
|
739 </p> |
|
740 |
|
741 <a NAME="OllamaWidget.__sendMessage" ID="OllamaWidget.__sendMessage"></a> |
|
742 <h4>OllamaWidget.__sendMessage</h4> |
|
743 <b>__sendMessage</b>(<i></i>) |
|
744 <p> |
|
745 Private method to send the given message of the current chat to the |
|
746 'ollama' server. |
|
747 </p> |
|
748 <p> |
|
749 This sends the message with context (i.e. the history of the current chat). |
|
750 </p> |
|
751 |
|
752 <a NAME="OllamaWidget.__serverDialogClosed" ID="OllamaWidget.__serverDialogClosed"></a> |
|
753 <h4>OllamaWidget.__serverDialogClosed</h4> |
|
754 <b>__serverDialogClosed</b>(<i></i>) |
|
755 <p> |
|
756 Private slot handling the closing of the local server dialog. |
|
757 </p> |
|
758 |
|
759 <a NAME="OllamaWidget.__serverStarted" ID="OllamaWidget.__serverStarted"></a> |
|
760 <h4>OllamaWidget.__serverStarted</h4> |
|
761 <b>__serverStarted</b>(<i></i>) |
|
762 <p> |
|
763 Private slot to handle the start of a local server. |
|
764 </p> |
|
765 |
|
766 <a NAME="OllamaWidget.__serverStopped" ID="OllamaWidget.__serverStopped"></a> |
|
767 <h4>OllamaWidget.__serverStopped</h4> |
|
768 <b>__serverStopped</b>(<i></i>) |
|
769 <p> |
|
770 Private slot to handle the stopping of a local server. |
|
771 </p> |
|
772 |
|
773 <a NAME="OllamaWidget.__setEnabledState" ID="OllamaWidget.__setEnabledState"></a> |
|
774 <h4>OllamaWidget.__setEnabledState</h4> |
|
775 <b>__setEnabledState</b>(<i>enable</i>) |
|
776 <p> |
|
777 Private method to set the enabled state of the main widget. |
|
778 </p> |
|
779 |
|
780 <dl> |
|
781 |
|
782 <dt><i>enable</i> (bool)</dt> |
|
783 <dd> |
|
784 enabled state |
|
785 </dd> |
|
786 </dl> |
|
787 <a NAME="OllamaWidget.__setHeaderLabel" ID="OllamaWidget.__setHeaderLabel"></a> |
|
788 <h4>OllamaWidget.__setHeaderLabel</h4> |
|
789 <b>__setHeaderLabel</b>(<i>version</i>) |
|
790 <p> |
|
791 Private slot to receive the 'ollama' server version and set the header. |
|
792 </p> |
|
793 |
|
794 <dl> |
|
795 |
|
796 <dt><i>version</i> (str)</dt> |
|
797 <dd> |
|
798 'ollama' server version' |
|
799 </dd> |
|
800 </dl> |
|
801 <a NAME="OllamaWidget.__showModelLibrary" ID="OllamaWidget.__showModelLibrary"></a> |
|
802 <h4>OllamaWidget.__showModelLibrary</h4> |
|
803 <b>__showModelLibrary</b>(<i></i>) |
|
804 <p> |
|
805 Private slot to open the 'ollama' model librayr web site. |
|
806 </p> |
|
807 |
|
808 <a NAME="OllamaWidget.__showModels" ID="OllamaWidget.__showModels"></a> |
|
809 <h4>OllamaWidget.__showModels</h4> |
|
810 <b>__showModels</b>(<i></i>) |
|
811 <p> |
|
812 Private slot to ask the 'ollama' server for a list of available models with |
|
813 some details. |
|
814 </p> |
|
815 |
|
816 <a NAME="OllamaWidget.__showRunningModels" ID="OllamaWidget.__showRunningModels"></a> |
|
817 <h4>OllamaWidget.__showRunningModels</h4> |
|
818 <b>__showRunningModels</b>(<i></i>) |
|
819 <p> |
|
820 Private slot to show a dialog with data of the running models. |
|
821 </p> |
|
822 |
|
823 <a NAME="OllamaWidget.__startLocalServer" ID="OllamaWidget.__startLocalServer"></a> |
|
824 <h4>OllamaWidget.__startLocalServer</h4> |
|
825 <b>__startLocalServer</b>(<i></i>) |
|
826 <p> |
|
827 Private slot to start a local 'ollama' server instance in the background. |
|
828 </p> |
|
829 |
|
830 <a NAME="OllamaWidget.__startLocalServerMonitoring" ID="OllamaWidget.__startLocalServerMonitoring"></a> |
|
831 <h4>OllamaWidget.__startLocalServerMonitoring</h4> |
|
832 <b>__startLocalServerMonitoring</b>(<i></i>) |
|
833 <p> |
|
834 Private slot to open a dialog for running a local 'ollama' server instance |
|
835 and monitor its output. |
|
836 </p> |
|
837 |
|
838 <a NAME="OllamaWidget.__stopLocalServer" ID="OllamaWidget.__stopLocalServer"></a> |
|
839 <h4>OllamaWidget.__stopLocalServer</h4> |
|
840 <b>__stopLocalServer</b>(<i></i>) |
|
841 <p> |
|
842 Private slot to stop a running local 'ollama' server instance. |
|
843 </p> |
|
844 |
|
845 <a NAME="OllamaWidget.__updateMessageEditState" ID="OllamaWidget.__updateMessageEditState"></a> |
|
846 <h4>OllamaWidget.__updateMessageEditState</h4> |
|
847 <b>__updateMessageEditState</b>(<i></i>) |
|
848 <p> |
|
849 Private slot to set the enabled state of the message line edit and the send |
|
850 button. |
|
851 </p> |
|
852 |
|
853 <a NAME="OllamaWidget.clearHistory" ID="OllamaWidget.clearHistory"></a> |
|
854 <h4>OllamaWidget.clearHistory</h4> |
|
855 <b>clearHistory</b>(<i></i>) |
|
856 <p> |
|
857 Public method to clear the history entries and close all chats. |
|
858 </p> |
|
859 |
|
860 <a NAME="OllamaWidget.on_messageEdit_textChanged" ID="OllamaWidget.on_messageEdit_textChanged"></a> |
|
861 <h4>OllamaWidget.on_messageEdit_textChanged</h4> |
|
862 <b>on_messageEdit_textChanged</b>(<i></i>) |
|
863 <p> |
|
864 Private slot to handle a change of the entered message. |
|
865 </p> |
|
866 |
|
867 <a NAME="OllamaWidget.on_modelComboBox_currentTextChanged" ID="OllamaWidget.on_modelComboBox_currentTextChanged"></a> |
|
868 <h4>OllamaWidget.on_modelComboBox_currentTextChanged</h4> |
|
869 <b>on_modelComboBox_currentTextChanged</b>(<i>model</i>) |
|
870 <p> |
|
871 Private slot handling the selection of a model. |
|
872 </p> |
|
873 |
|
874 <dl> |
|
875 |
|
876 <dt><i>model</i> (str)</dt> |
|
877 <dd> |
|
878 name of the selected model |
|
879 </dd> |
|
880 </dl> |
|
881 <a NAME="OllamaWidget.on_newChatButton_clicked" ID="OllamaWidget.on_newChatButton_clicked"></a> |
|
882 <h4>OllamaWidget.on_newChatButton_clicked</h4> |
|
883 <b>on_newChatButton_clicked</b>(<i></i>) |
|
884 <p> |
|
885 Private slot to start a new chat with the 'ollama' server. |
|
886 </p> |
|
887 |
|
888 <a NAME="OllamaWidget.on_reloadModelsButton_clicked" ID="OllamaWidget.on_reloadModelsButton_clicked"></a> |
|
889 <h4>OllamaWidget.on_reloadModelsButton_clicked</h4> |
|
890 <b>on_reloadModelsButton_clicked</b>(<i></i>) |
|
891 <p> |
|
892 Private slot to reload the list of available models. |
|
893 </p> |
|
894 |
|
895 <a NAME="OllamaWidget.prepareServerRuntimeEnvironment" ID="OllamaWidget.prepareServerRuntimeEnvironment"></a> |
|
896 <h4>OllamaWidget.prepareServerRuntimeEnvironment</h4> |
|
897 <b>prepareServerRuntimeEnvironment</b>(<i></i>) |
|
898 <p> |
|
899 Public method to prepare a QProcessEnvironment object. |
|
900 </p> |
|
901 |
|
902 <dl> |
|
903 <dt>Return:</dt> |
|
904 <dd> |
|
905 prepared environment object to be used with QProcess |
|
906 </dd> |
|
907 </dl> |
|
908 <dl> |
|
909 <dt>Return Type:</dt> |
|
910 <dd> |
|
911 QProcessEnvironment |
|
912 </dd> |
|
913 </dl> |
|
914 <div align="right"><a href="#top">Up</a></div> |
|
915 <hr /> |
|
916 </body></html> |