--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/OllamaInterface/Documentation/Source/Plugin_AI_Ollama.OllamaInterface.OllamaHistoryWidget.html Thu Aug 29 13:15:36 2024 +0200 @@ -0,0 +1,319 @@ +<!DOCTYPE html> +<html><head> +<title>Plugin_AI_Ollama.OllamaInterface.OllamaHistoryWidget</title> +<meta charset="UTF-8"> +<link rel="stylesheet" href="styles.css"> +</head> +<body> +<a NAME="top" ID="top"></a> +<h1>Plugin_AI_Ollama.OllamaInterface.OllamaHistoryWidget</h1> +<p> +Module implementing a widget showing a chat title and store a chat contents. +</p> + +<h3>Global Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Classes</h3> +<table> +<tr> +<td><a href="#OllamaHistoryWidget">OllamaHistoryWidget</a></td> +<td>Class implementing a widget showing a chat title and store a chat contents.</td> +</tr> +</table> + +<h3>Functions</h3> +<table> +<tr><td>None</td></tr> +</table> + +<hr /> +<hr /> +<a NAME="OllamaHistoryWidget" ID="OllamaHistoryWidget"></a> +<h2>OllamaHistoryWidget</h2> +<p> + Class implementing a widget showing a chat title and store a chat contents. +</p> + +<h3>Signals</h3> +<dl> + +<dt>dataChanged(id:str)</dt> +<dd> +emitted to indicate a change of the chat history data +</dd> +<dt>deleteChatHistory(id:str)</dt> +<dd> +emitted to indicate, that this chat history + should be deleted +</dd> +<dt>newChatWithHistory(id:str)</dt> +<dd> +emitted to indicate, that a new chat using + the saved history should be started +</dd> +</dl> +<h3>Derived from</h3> +QWidget, Ui_OllamaHistoryWidget +<h3>Class Attributes</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Class Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + +<h3>Methods</h3> +<table> +<tr> +<td><a href="#OllamaHistoryWidget.__init__">OllamaHistoryWidget</a></td> +<td>Constructor</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.addToMessages">addToMessages</a></td> +<td>Public method to add a chat message to the chat history.</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.checkModelAvailable">checkModelAvailable</a></td> +<td>Public method to set the enabled state depending on available models.</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.getId">getId</a></td> +<td>Public method to get the chat history ID.</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.getMessages">getMessages</a></td> +<td>Public method to get the list of messages.</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.getModel">getModel</a></td> +<td>Public method to get the model used by the chat.</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.getTitle">getTitle</a></td> +<td>Public method to get the chat title.</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.loadFromJson">loadFromJson</a></td> +<td>Public method to load the chat history data from a JSON string.</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.on_deleteButton_clicked">on_deleteButton_clicked</a></td> +<td>Private slot to delet this chat history entry..</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.on_editButton_clicked">on_editButton_clicked</a></td> +<td>Private slot to edit the chat title.</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.on_newChatButton_clicked">on_newChatButton_clicked</a></td> +<td>Private slot to start a new chat using the saved chat history.</td> +</tr> +<tr> +<td><a href="#OllamaHistoryWidget.saveToJson">saveToJson</a></td> +<td>Public method to serialize the chat history data to a JSON string.</td> +</tr> +</table> + +<h3>Static Methods</h3> +<table> +<tr><td>None</td></tr> +</table> + + +<a NAME="OllamaHistoryWidget.__init__" ID="OllamaHistoryWidget.__init__"></a> +<h4>OllamaHistoryWidget (Constructor)</h4> +<b>OllamaHistoryWidget</b>(<i>title, model, jsonStr=None, parent=None</i>) +<p> + Constructor +</p> + +<dl> + +<dt><i>title</i> (str)</dt> +<dd> +title of the ollama chat +</dd> +<dt><i>model</i> (str)</dt> +<dd> +name of the model used for the chat +</dd> +<dt><i>jsonStr</i> (str (optional))</dt> +<dd> +string containing JSON serialize chat history data + (defaults to None) +</dd> +<dt><i>parent</i> (QWidget (optional))</dt> +<dd> +reference to the parent widget (defaults to None) +</dd> +</dl> +<a NAME="OllamaHistoryWidget.addToMessages" ID="OllamaHistoryWidget.addToMessages"></a> +<h4>OllamaHistoryWidget.addToMessages</h4> +<b>addToMessages</b>(<i>role, content</i>) +<p> + Public method to add a chat message to the chat history. +</p> + +<dl> + +<dt><i>role</i> (str)</dt> +<dd> +chat role (one of 'system', 'user', 'assistant' or 'tool') +</dd> +<dt><i>content</i> (str)</dt> +<dd> +content of the chat message +</dd> +</dl> +<a NAME="OllamaHistoryWidget.checkModelAvailable" ID="OllamaHistoryWidget.checkModelAvailable"></a> +<h4>OllamaHistoryWidget.checkModelAvailable</h4> +<b>checkModelAvailable</b>(<i>modelNames</i>) +<p> + Public method to set the enabled state depending on available models. +</p> + +<dl> + +<dt><i>modelNames</i> (str)</dt> +<dd> +names of available models +</dd> +</dl> +<a NAME="OllamaHistoryWidget.getId" ID="OllamaHistoryWidget.getId"></a> +<h4>OllamaHistoryWidget.getId</h4> +<b>getId</b>(<i></i>) +<p> + Public method to get the chat history ID. +</p> + +<dl> +<dt>Return:</dt> +<dd> +ID of the history entry +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="OllamaHistoryWidget.getMessages" ID="OllamaHistoryWidget.getMessages"></a> +<h4>OllamaHistoryWidget.getMessages</h4> +<b>getMessages</b>(<i></i>) +<p> + Public method to get the list of messages. +</p> + +<dl> +<dt>Return:</dt> +<dd> +list of stored messages +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +list[dict[str, str]] +</dd> +</dl> +<a NAME="OllamaHistoryWidget.getModel" ID="OllamaHistoryWidget.getModel"></a> +<h4>OllamaHistoryWidget.getModel</h4> +<b>getModel</b>(<i></i>) +<p> + Public method to get the model used by the chat. +</p> + +<dl> +<dt>Return:</dt> +<dd> +model name +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="OllamaHistoryWidget.getTitle" ID="OllamaHistoryWidget.getTitle"></a> +<h4>OllamaHistoryWidget.getTitle</h4> +<b>getTitle</b>(<i></i>) +<p> + Public method to get the chat title. +</p> + +<dl> +<dt>Return:</dt> +<dd> +chat title +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<a NAME="OllamaHistoryWidget.loadFromJson" ID="OllamaHistoryWidget.loadFromJson"></a> +<h4>OllamaHistoryWidget.loadFromJson</h4> +<b>loadFromJson</b>(<i>jsonStr</i>) +<p> + Public method to load the chat history data from a JSON string. +</p> + +<dl> + +<dt><i>jsonStr</i> (str)</dt> +<dd> +JSON serialized chat data +</dd> +</dl> +<a NAME="OllamaHistoryWidget.on_deleteButton_clicked" ID="OllamaHistoryWidget.on_deleteButton_clicked"></a> +<h4>OllamaHistoryWidget.on_deleteButton_clicked</h4> +<b>on_deleteButton_clicked</b>(<i></i>) +<p> + Private slot to delet this chat history entry.. +</p> + +<a NAME="OllamaHistoryWidget.on_editButton_clicked" ID="OllamaHistoryWidget.on_editButton_clicked"></a> +<h4>OllamaHistoryWidget.on_editButton_clicked</h4> +<b>on_editButton_clicked</b>(<i></i>) +<p> + Private slot to edit the chat title. +</p> + +<a NAME="OllamaHistoryWidget.on_newChatButton_clicked" ID="OllamaHistoryWidget.on_newChatButton_clicked"></a> +<h4>OllamaHistoryWidget.on_newChatButton_clicked</h4> +<b>on_newChatButton_clicked</b>(<i></i>) +<p> + Private slot to start a new chat using the saved chat history. +</p> + +<a NAME="OllamaHistoryWidget.saveToJson" ID="OllamaHistoryWidget.saveToJson"></a> +<h4>OllamaHistoryWidget.saveToJson</h4> +<b>saveToJson</b>(<i></i>) +<p> + Public method to serialize the chat history data to a JSON string. +</p> + +<dl> +<dt>Return:</dt> +<dd> +JSON serialized chat data +</dd> +</dl> +<dl> +<dt>Return Type:</dt> +<dd> +str +</dd> +</dl> +<div align="right"><a href="#top">Up</a></div> +<hr /> +</body></html>