diff -r 43b1396fe72f -r 0a5b9c233a6e OllamaInterface/Documentation/Source/Plugin_AI_Ollama.OllamaInterface.OllamaWidget.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OllamaInterface/Documentation/Source/Plugin_AI_Ollama.OllamaInterface.OllamaWidget.html Thu Aug 29 13:15:36 2024 +0200 @@ -0,0 +1,916 @@ +<!DOCTYPE html> +<html><head> +<title>Plugin_AI_Ollama.OllamaInterface.OllamaWidget</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>Plugin_AI_Ollama.OllamaInterface.OllamaWidget</h1> +<p> +Module implementing the main ollama interface widget. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#OllamaWidget">OllamaWidget</a></td> +<td>Class implementing the main ollama interface widget.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> + +<hr /> +<hr /> +<a NAME="OllamaWidget" ID="OllamaWidget"></a> +<h2>OllamaWidget</h2> +<p> + Class implementing the main ollama interface widget. +</p> + +<h3>Derived from</h3> +QWidget, Ui_OllamaWidget +<h3>Class Attributes</h3> +<table> +<tr><td>OllamaHistoryFile</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#OllamaWidget.__init__">OllamaWidget</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__aboutToShowOllamaMenu">__aboutToShowOllamaMenu</a></td> +<td>Private slot to set the action enabled status.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__checkHistoryModels">__checkHistoryModels</a></td> +<td>Private slot to set the chat history entry states according to available models.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__connectClient">__connectClient</a></td> +<td>Private method to connect the client signals.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__createHistoryWidget">__createHistoryWidget</a></td> +<td>Private method to create a chat history widget and insert it into the respective layout.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__deleteHistory">__deleteHistory</a></td> +<td>Private slot to delete the history with the given ID.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__findChatWidget">__findChatWidget</a></td> +<td>Private method to find a chat widget given a chat history ID.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__findHistoryWidget">__findHistoryWidget</a></td> +<td>Private method to find the widget of a given chat history ID.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__finishSetup">__finishSetup</a></td> +<td>Private slot to finish the UI setup.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__getHistoryIds">__getHistoryIds</a></td> +<td>Private method to get a list of all history IDs.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__handleClientError">__handleClientError</a></td> +<td>Private slot to handle an error message sent by the server.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__handleClientFinished">__handleClientFinished</a></td> +<td>Private slot to handle the end of a client server interaction.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__handlePullError">__handlePullError</a></td> +<td>Private slot to handle an error during a pull operation.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__handlePullStatus">__handlePullStatus</a></td> +<td>Private slot to handle a pull status update.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__handleServerMessage">__handleServerMessage</a></td> +<td>Private slot handling an 'ollama' server chat response.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__handleServerStateChanged">__handleServerStateChanged</a></td> +<td>Private slot handling a change in the 'ollama' server responsiveness.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__historyFilePath">__historyFilePath</a></td> +<td>Private method to get the path name of the chat history file.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__initOllamaMenu">__initOllamaMenu</a></td> +<td>Private method to create the super menu and attach it to the super menu button.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__loadChatHistoriesFile">__loadChatHistoriesFile</a></td> +<td>Private method to load chat history entries from a given file.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__loadHistory">__loadHistory</a></td> +<td>Private method to load a previously saved history file.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__localServerProcessFinished">__localServerProcessFinished</a></td> +<td>Private slot handling the finishing of the local 'ollama' server process.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__menuClearAllHistories">__menuClearAllHistories</a></td> +<td>Private slot to clear all chat history entries.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__menuExportHistories">__menuExportHistories</a></td> +<td>Private slot to export chat history entries to a file.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__menuImportHistories">__menuImportHistories</a></td> +<td>Private slot to import chat history entries from a file.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__newChatWithHistory">__newChatWithHistory</a></td> +<td>Private slot to start a new chat using a previously saved history.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__ollamaConfigure">__ollamaConfigure</a></td> +<td>Private slot to show the ollama configuration page.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__populateModelSelector">__populateModelSelector</a></td> +<td>Private slot to receive the list of available model names and populate the model selector with them.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__pullModel">__pullModel</a></td> +<td>Private slot to download a model from the 'ollama' model library.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__removeChatWidget">__removeChatWidget</a></td> +<td>Private method to remove a chat widget given its chat history ID.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__removeModel">__removeModel</a></td> +<td>Private slot to remove a model from the 'ollama' server.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__saveChatHistoryFile">__saveChatHistoryFile</a></td> +<td>Private method to save the chat history entries to a file.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__saveHistory">__saveHistory</a></td> +<td>Private method to save the current chat history to the history file.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__scrollHistoryToBottom">__scrollHistoryToBottom</a></td> +<td>Private slot to scroll the history widget to the bottom.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__sendMessage">__sendMessage</a></td> +<td>Private method to send the given message of the current chat to the 'ollama' server.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__serverDialogClosed">__serverDialogClosed</a></td> +<td>Private slot handling the closing of the local server dialog.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__serverStarted">__serverStarted</a></td> +<td>Private slot to handle the start of a local server.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__serverStopped">__serverStopped</a></td> +<td>Private slot to handle the stopping of a local server.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__setEnabledState">__setEnabledState</a></td> +<td>Private method to set the enabled state of the main widget.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__setHeaderLabel">__setHeaderLabel</a></td> +<td>Private slot to receive the 'ollama' server version and set the header.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__showModelLibrary">__showModelLibrary</a></td> +<td>Private slot to open the 'ollama' model librayr web site.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__showModels">__showModels</a></td> +<td>Private slot to ask the 'ollama' server for a list of available models with some details.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__showRunningModels">__showRunningModels</a></td> +<td>Private slot to show a dialog with data of the running models.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__startLocalServer">__startLocalServer</a></td> +<td>Private slot to start a local 'ollama' server instance in the background.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__startLocalServerMonitoring">__startLocalServerMonitoring</a></td> +<td>Private slot to open a dialog for running a local 'ollama' server instance and monitor its output.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__stopLocalServer">__stopLocalServer</a></td> +<td>Private slot to stop a running local 'ollama' server instance.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.__updateMessageEditState">__updateMessageEditState</a></td> +<td>Private slot to set the enabled state of the message line edit and the send button.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.clearHistory">clearHistory</a></td> +<td>Public method to clear the history entries and close all chats.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.on_messageEdit_textChanged">on_messageEdit_textChanged</a></td> +<td>Private slot to handle a change of the entered message.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.on_modelComboBox_currentTextChanged">on_modelComboBox_currentTextChanged</a></td> +<td>Private slot handling the selection of a model.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.on_newChatButton_clicked">on_newChatButton_clicked</a></td> +<td>Private slot to start a new chat with the 'ollama' server.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.on_reloadModelsButton_clicked">on_reloadModelsButton_clicked</a></td> +<td>Private slot to reload the list of available models.</td> +</tr> +<tr> +<td><a href="#OllamaWidget.prepareServerRuntimeEnvironment">prepareServerRuntimeEnvironment</a></td> +<td>Public method to prepare a QProcessEnvironment object.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="OllamaWidget.__init__" ID="OllamaWidget.__init__"></a> +<h4>OllamaWidget (Constructor)</h4> +<b>OllamaWidget</b>(<i>plugin, fromEric=True, parent=None</i>) +<p> + Constructor +</p> + +<dl> + +<dt><i>plugin</i> (PluginOllamaInterface)</dt> +<dd> +reference to the plug-in object +</dd> +<dt><i>fromEric</i> (bool (optional))</dt> +<dd> +flag indicating the eric-ide mode (defaults to True) + (True = eric-ide mode, False = application mode) +</dd> +<dt><i>parent</i> (QWidget (optional))</dt> +<dd> +reference to the parent widget (defaults to None) +</dd> +</dl> +<a NAME="OllamaWidget.__aboutToShowOllamaMenu" ID="OllamaWidget.__aboutToShowOllamaMenu"></a> +<h4>OllamaWidget.__aboutToShowOllamaMenu</h4> +<b>__aboutToShowOllamaMenu</b>(<i></i>) +<p> + Private slot to set the action enabled status. +</p> + +<a NAME="OllamaWidget.__checkHistoryModels" ID="OllamaWidget.__checkHistoryModels"></a> +<h4>OllamaWidget.__checkHistoryModels</h4> +<b>__checkHistoryModels</b>(<i>modelNames</i>) +<p> + Private slot to set the chat history entry states according to available + models. +</p> + +<dl> + +<dt><i>modelNames</i> (list[str])</dt> +<dd> +list of model names +</dd> +</dl> +<a NAME="OllamaWidget.__connectClient" ID="OllamaWidget.__connectClient"></a> +<h4>OllamaWidget.__connectClient</h4> +<b>__connectClient</b>(<i></i>) +<p> + Private method to connect the client signals. +</p> + +<a NAME="OllamaWidget.__createHistoryWidget" ID="OllamaWidget.__createHistoryWidget"></a> +<h4>OllamaWidget.__createHistoryWidget</h4> +<b>__createHistoryWidget</b>(<i>title, model, jsonStr=None</i>) +<p> + Private method to create a chat history widget and insert it into the + respective layout. +</p> + +<dl> + +<dt><i>title</i> (str)</dt> +<dd> +title of the chat +</dd> +<dt><i>model</i> (str)</dt> +<dd> +name of the model +</dd> +<dt><i>jsonStr</i> (str (optional))</dt> +<dd> +string containing JSON serialize chat history data (defaults + to None) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +reference to the created history widget +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +OllamaHistoryWidget +</dd> +</dl> +<a NAME="OllamaWidget.__deleteHistory" ID="OllamaWidget.__deleteHistory"></a> +<h4>OllamaWidget.__deleteHistory</h4> +<b>__deleteHistory</b>(<i>hid</i>) +<p> + Private slot to delete the history with the given ID. +</p> + +<dl> + +<dt><i>hid</i> (str)</dt> +<dd> +ID of the history to be deleted +</dd> +</dl> +<a NAME="OllamaWidget.__findChatWidget" ID="OllamaWidget.__findChatWidget"></a> +<h4>OllamaWidget.__findChatWidget</h4> +<b>__findChatWidget</b>(<i>hid</i>) +<p> + Private method to find a chat widget given a chat history ID. +</p> + +<dl> + +<dt><i>hid</i> (str)</dt> +<dd> +chat history ID +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +reference to the chat widget related to the given ID +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +OllamaChatWidget +</dd> +</dl> +<a NAME="OllamaWidget.__findHistoryWidget" ID="OllamaWidget.__findHistoryWidget"></a> +<h4>OllamaWidget.__findHistoryWidget</h4> +<b>__findHistoryWidget</b>(<i>hid</i>) +<p> + Private method to find the widget of a given chat history ID. +</p> + +<dl> + +<dt><i>hid</i> (str)</dt> +<dd> +ID of the chat history +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +reference to the chat history widget +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +OllamaHistoryWidget +</dd> +</dl> +<a NAME="OllamaWidget.__finishSetup" ID="OllamaWidget.__finishSetup"></a> +<h4>OllamaWidget.__finishSetup</h4> +<b>__finishSetup</b>(<i></i>) +<p> + Private slot to finish the UI setup. +</p> + +<a NAME="OllamaWidget.__getHistoryIds" ID="OllamaWidget.__getHistoryIds"></a> +<h4>OllamaWidget.__getHistoryIds</h4> +<b>__getHistoryIds</b>(<i></i>) +<p> + Private method to get a list of all history IDs. +</p> + +<dl> +<dt>Return:</dt> +<dd> +list of history IDs +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +list[str] +</dd> +</dl> +<a NAME="OllamaWidget.__handleClientError" ID="OllamaWidget.__handleClientError"></a> +<h4>OllamaWidget.__handleClientError</h4> +<b>__handleClientError</b>(<i>errMsg</i>) +<p> + Private slot to handle an error message sent by the server. +</p> + +<dl> + +<dt><i>errMsg</i> (str)</dt> +<dd> +error message +</dd> +</dl> +<a NAME="OllamaWidget.__handleClientFinished" ID="OllamaWidget.__handleClientFinished"></a> +<h4>OllamaWidget.__handleClientFinished</h4> +<b>__handleClientFinished</b>(<i></i>) +<p> + Private slot to handle the end of a client server interaction. +</p> + +<a NAME="OllamaWidget.__handlePullError" ID="OllamaWidget.__handlePullError"></a> +<h4>OllamaWidget.__handlePullError</h4> +<b>__handlePullError</b>(<i>errMsg</i>) +<p> + Private slot to handle an error during a pull operation. +</p> + +<dl> + +<dt><i>errMsg</i> (str)</dt> +<dd> +error message +</dd> +</dl> +<a NAME="OllamaWidget.__handlePullStatus" ID="OllamaWidget.__handlePullStatus"></a> +<h4>OllamaWidget.__handlePullStatus</h4> +<b>__handlePullStatus</b>(<i>status, idStr, total, completed</i>) +<p> + Private slot to handle a pull status update. +</p> + +<dl> + +<dt><i>status</i> (str)</dt> +<dd> +status message reported by the 'ollama' server +</dd> +<dt><i>idStr</i> (str)</dt> +<dd> +ID of the file being pulled or empty +</dd> +<dt><i>total</i> (int)</dt> +<dd> +size of the file being pulled or 0 in case of an empty ID +</dd> +<dt><i>completed</i> (int)</dt> +<dd> +downloaded bytes or 0 in case of an empty ID +</dd> +</dl> +<a NAME="OllamaWidget.__handleServerMessage" ID="OllamaWidget.__handleServerMessage"></a> +<h4>OllamaWidget.__handleServerMessage</h4> +<b>__handleServerMessage</b>(<i>content, role, done</i>) +<p> + Private slot handling an 'ollama' server chat response. +</p> + +<dl> + +<dt><i>content</i> (str)</dt> +<dd> +message sent by the server +</dd> +<dt><i>role</i> (str)</dt> +<dd> +role name +</dd> +<dt><i>done</i> (bool)</dt> +<dd> +flag indicating the last chat response +</dd> +</dl> +<a NAME="OllamaWidget.__handleServerStateChanged" ID="OllamaWidget.__handleServerStateChanged"></a> +<h4>OllamaWidget.__handleServerStateChanged</h4> +<b>__handleServerStateChanged</b>(<i>ok, msg</i>) +<p> + Private slot handling a change in the 'ollama' server responsiveness. +</p> + +<dl> + +<dt><i>ok</i> (bool)</dt> +<dd> +flag indicating a responsive 'ollama' server +</dd> +<dt><i>msg</i> (str)</dt> +<dd> +status message +</dd> +</dl> +<a NAME="OllamaWidget.__historyFilePath" ID="OllamaWidget.__historyFilePath"></a> +<h4>OllamaWidget.__historyFilePath</h4> +<b>__historyFilePath</b>(<i></i>) +<p> + Private method to get the path name of the chat history file. +</p> + +<dl> +<dt>Return:</dt> +<dd> +file path of the chat history file +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="OllamaWidget.__initOllamaMenu" ID="OllamaWidget.__initOllamaMenu"></a> +<h4>OllamaWidget.__initOllamaMenu</h4> +<b>__initOllamaMenu</b>(<i></i>) +<p> + Private method to create the super menu and attach it to the super + menu button. +</p> + +<a NAME="OllamaWidget.__loadChatHistoriesFile" ID="OllamaWidget.__loadChatHistoriesFile"></a> +<h4>OllamaWidget.__loadChatHistoriesFile</h4> +<b>__loadChatHistoriesFile</b>(<i>filePath, reportDuplicates=False</i>) +<p> + Private method to load chat history entries from a given file. +</p> + +<dl> + +<dt><i>filePath</i> (str)</dt> +<dd> +path of the chat history file +</dd> +<dt><i>reportDuplicates</i> (bool (optional))</dt> +<dd> +flag indicating to report skipped chat history entries + (defaults to False) +</dd> +</dl> +<dl> +<dt>Return:</dt> +<dd> +flag indicating success +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="OllamaWidget.__loadHistory" ID="OllamaWidget.__loadHistory"></a> +<h4>OllamaWidget.__loadHistory</h4> +<b>__loadHistory</b>(<i></i>) +<p> + Private method to load a previously saved history file. +</p> + +<a NAME="OllamaWidget.__localServerProcessFinished" ID="OllamaWidget.__localServerProcessFinished"></a> +<h4>OllamaWidget.__localServerProcessFinished</h4> +<b>__localServerProcessFinished</b>(<i></i>) +<p> + Private slot handling the finishing of the local 'ollama' server process. +</p> + +<a NAME="OllamaWidget.__menuClearAllHistories" ID="OllamaWidget.__menuClearAllHistories"></a> +<h4>OllamaWidget.__menuClearAllHistories</h4> +<b>__menuClearAllHistories</b>(<i></i>) +<p> + Private slot to clear all chat history entries. +</p> + +<a NAME="OllamaWidget.__menuExportHistories" ID="OllamaWidget.__menuExportHistories"></a> +<h4>OllamaWidget.__menuExportHistories</h4> +<b>__menuExportHistories</b>(<i></i>) +<p> + Private slot to export chat history entries to a file. +</p> + +<a NAME="OllamaWidget.__menuImportHistories" ID="OllamaWidget.__menuImportHistories"></a> +<h4>OllamaWidget.__menuImportHistories</h4> +<b>__menuImportHistories</b>(<i></i>) +<p> + Private slot to import chat history entries from a file. +</p> + +<a NAME="OllamaWidget.__newChatWithHistory" ID="OllamaWidget.__newChatWithHistory"></a> +<h4>OllamaWidget.__newChatWithHistory</h4> +<b>__newChatWithHistory</b>(<i>hid</i>) +<p> + Private slot to start a new chat using a previously saved history. +</p> + +<dl> + +<dt><i>hid</i> (str)</dt> +<dd> +ID of the history to be used +</dd> +</dl> +<a NAME="OllamaWidget.__ollamaConfigure" ID="OllamaWidget.__ollamaConfigure"></a> +<h4>OllamaWidget.__ollamaConfigure</h4> +<b>__ollamaConfigure</b>(<i></i>) +<p> + Private slot to show the ollama configuration page. +</p> + +<a NAME="OllamaWidget.__populateModelSelector" ID="OllamaWidget.__populateModelSelector"></a> +<h4>OllamaWidget.__populateModelSelector</h4> +<b>__populateModelSelector</b>(<i>modelNames</i>) +<p> + Private slot to receive the list of available model names and populate + the model selector with them. +</p> + +<dl> + +<dt><i>modelNames</i> (list[str])</dt> +<dd> +list of model names +</dd> +</dl> +<a NAME="OllamaWidget.__pullModel" ID="OllamaWidget.__pullModel"></a> +<h4>OllamaWidget.__pullModel</h4> +<b>__pullModel</b>(<i></i>) +<p> + Private slot to download a model from the 'ollama' model library. +</p> + +<a NAME="OllamaWidget.__removeChatWidget" ID="OllamaWidget.__removeChatWidget"></a> +<h4>OllamaWidget.__removeChatWidget</h4> +<b>__removeChatWidget</b>(<i>hid</i>) +<p> + Private method to remove a chat widget given its chat history ID. +</p> + +<dl> + +<dt><i>hid</i> (str)</dt> +<dd> +chat history ID +</dd> +</dl> +<a NAME="OllamaWidget.__removeModel" ID="OllamaWidget.__removeModel"></a> +<h4>OllamaWidget.__removeModel</h4> +<b>__removeModel</b>(<i></i>) +<p> + Private slot to remove a model from the 'ollama' server. +</p> + +<a NAME="OllamaWidget.__saveChatHistoryFile" ID="OllamaWidget.__saveChatHistoryFile"></a> +<h4>OllamaWidget.__saveChatHistoryFile</h4> +<b>__saveChatHistoryFile</b>(<i>filePath, entries</i>) +<p> + Private method to save the chat history entries to a file. +</p> + +<dl> + +<dt><i>filePath</i> (str)</dt> +<dd> +file name to save to +</dd> +<dt><i>entries</i> (dict[str, str])</dt> +<dd> +dictionary containing the chat history entries as a + JSON serialized string indexed by their ID +</dd> +</dl> +<a NAME="OllamaWidget.__saveHistory" ID="OllamaWidget.__saveHistory"></a> +<h4>OllamaWidget.__saveHistory</h4> +<b>__saveHistory</b>(<i></i>) +<p> + Private method to save the current chat history to the history file. +</p> + +<a NAME="OllamaWidget.__scrollHistoryToBottom" ID="OllamaWidget.__scrollHistoryToBottom"></a> +<h4>OllamaWidget.__scrollHistoryToBottom</h4> +<b>__scrollHistoryToBottom</b>(<i></i>) +<p> + Private slot to scroll the history widget to the bottom. +</p> + +<a NAME="OllamaWidget.__sendMessage" ID="OllamaWidget.__sendMessage"></a> +<h4>OllamaWidget.__sendMessage</h4> +<b>__sendMessage</b>(<i></i>) +<p> + Private method to send the given message of the current chat to the + 'ollama' server. +</p> +<p> + This sends the message with context (i.e. the history of the current chat). +</p> + +<a NAME="OllamaWidget.__serverDialogClosed" ID="OllamaWidget.__serverDialogClosed"></a> +<h4>OllamaWidget.__serverDialogClosed</h4> +<b>__serverDialogClosed</b>(<i></i>) +<p> + Private slot handling the closing of the local server dialog. +</p> + +<a NAME="OllamaWidget.__serverStarted" ID="OllamaWidget.__serverStarted"></a> +<h4>OllamaWidget.__serverStarted</h4> +<b>__serverStarted</b>(<i></i>) +<p> + Private slot to handle the start of a local server. +</p> + +<a NAME="OllamaWidget.__serverStopped" ID="OllamaWidget.__serverStopped"></a> +<h4>OllamaWidget.__serverStopped</h4> +<b>__serverStopped</b>(<i></i>) +<p> + Private slot to handle the stopping of a local server. +</p> + +<a NAME="OllamaWidget.__setEnabledState" ID="OllamaWidget.__setEnabledState"></a> +<h4>OllamaWidget.__setEnabledState</h4> +<b>__setEnabledState</b>(<i>enable</i>) +<p> + Private method to set the enabled state of the main widget. +</p> + +<dl> + +<dt><i>enable</i> (bool)</dt> +<dd> +enabled state +</dd> +</dl> +<a NAME="OllamaWidget.__setHeaderLabel" ID="OllamaWidget.__setHeaderLabel"></a> +<h4>OllamaWidget.__setHeaderLabel</h4> +<b>__setHeaderLabel</b>(<i>version</i>) +<p> + Private slot to receive the 'ollama' server version and set the header. +</p> + +<dl> + +<dt><i>version</i> (str)</dt> +<dd> +'ollama' server version' +</dd> +</dl> +<a NAME="OllamaWidget.__showModelLibrary" ID="OllamaWidget.__showModelLibrary"></a> +<h4>OllamaWidget.__showModelLibrary</h4> +<b>__showModelLibrary</b>(<i></i>) +<p> + Private slot to open the 'ollama' model librayr web site. +</p> + +<a NAME="OllamaWidget.__showModels" ID="OllamaWidget.__showModels"></a> +<h4>OllamaWidget.__showModels</h4> +<b>__showModels</b>(<i></i>) +<p> + Private slot to ask the 'ollama' server for a list of available models with + some details. +</p> + +<a NAME="OllamaWidget.__showRunningModels" ID="OllamaWidget.__showRunningModels"></a> +<h4>OllamaWidget.__showRunningModels</h4> +<b>__showRunningModels</b>(<i></i>) +<p> + Private slot to show a dialog with data of the running models. +</p> + +<a NAME="OllamaWidget.__startLocalServer" ID="OllamaWidget.__startLocalServer"></a> +<h4>OllamaWidget.__startLocalServer</h4> +<b>__startLocalServer</b>(<i></i>) +<p> + Private slot to start a local 'ollama' server instance in the background. +</p> + +<a NAME="OllamaWidget.__startLocalServerMonitoring" ID="OllamaWidget.__startLocalServerMonitoring"></a> +<h4>OllamaWidget.__startLocalServerMonitoring</h4> +<b>__startLocalServerMonitoring</b>(<i></i>) +<p> + Private slot to open a dialog for running a local 'ollama' server instance + and monitor its output. +</p> + +<a NAME="OllamaWidget.__stopLocalServer" ID="OllamaWidget.__stopLocalServer"></a> +<h4>OllamaWidget.__stopLocalServer</h4> +<b>__stopLocalServer</b>(<i></i>) +<p> + Private slot to stop a running local 'ollama' server instance. +</p> + +<a NAME="OllamaWidget.__updateMessageEditState" ID="OllamaWidget.__updateMessageEditState"></a> +<h4>OllamaWidget.__updateMessageEditState</h4> +<b>__updateMessageEditState</b>(<i></i>) +<p> + Private slot to set the enabled state of the message line edit and the send + button. +</p> + +<a NAME="OllamaWidget.clearHistory" ID="OllamaWidget.clearHistory"></a> +<h4>OllamaWidget.clearHistory</h4> +<b>clearHistory</b>(<i></i>) +<p> + Public method to clear the history entries and close all chats. +</p> + +<a NAME="OllamaWidget.on_messageEdit_textChanged" ID="OllamaWidget.on_messageEdit_textChanged"></a> +<h4>OllamaWidget.on_messageEdit_textChanged</h4> +<b>on_messageEdit_textChanged</b>(<i></i>) +<p> + Private slot to handle a change of the entered message. +</p> + +<a NAME="OllamaWidget.on_modelComboBox_currentTextChanged" ID="OllamaWidget.on_modelComboBox_currentTextChanged"></a> +<h4>OllamaWidget.on_modelComboBox_currentTextChanged</h4> +<b>on_modelComboBox_currentTextChanged</b>(<i>model</i>) +<p> + Private slot handling the selection of a model. +</p> + +<dl> + +<dt><i>model</i> (str)</dt> +<dd> +name of the selected model +</dd> +</dl> +<a NAME="OllamaWidget.on_newChatButton_clicked" ID="OllamaWidget.on_newChatButton_clicked"></a> +<h4>OllamaWidget.on_newChatButton_clicked</h4> +<b>on_newChatButton_clicked</b>(<i></i>) +<p> + Private slot to start a new chat with the 'ollama' server. +</p> + +<a NAME="OllamaWidget.on_reloadModelsButton_clicked" ID="OllamaWidget.on_reloadModelsButton_clicked"></a> +<h4>OllamaWidget.on_reloadModelsButton_clicked</h4> +<b>on_reloadModelsButton_clicked</b>(<i></i>) +<p> + Private slot to reload the list of available models. +</p> + +<a NAME="OllamaWidget.prepareServerRuntimeEnvironment" ID="OllamaWidget.prepareServerRuntimeEnvironment"></a> +<h4>OllamaWidget.prepareServerRuntimeEnvironment</h4> +<b>prepareServerRuntimeEnvironment</b>(<i></i>) +<p> + Public method to prepare a QProcessEnvironment object. +</p> + +<dl> +<dt>Return:</dt> +<dd> +prepared environment object to be used with QProcess +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +QProcessEnvironment +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>