|
1 <!DOCTYPE html> |
|
2 <html><head> |
|
3 <title>Plugin_AI_Ollama.OllamaInterface.OllamaHistoryWidget</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.OllamaHistoryWidget</h1> |
|
10 <p> |
|
11 Module implementing a widget showing a chat title and store a chat contents. |
|
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="#OllamaHistoryWidget">OllamaHistoryWidget</a></td> |
|
23 <td>Class implementing a widget showing a chat title and store a chat contents.</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="OllamaHistoryWidget" ID="OllamaHistoryWidget"></a> |
|
35 <h2>OllamaHistoryWidget</h2> |
|
36 <p> |
|
37 Class implementing a widget showing a chat title and store a chat contents. |
|
38 </p> |
|
39 |
|
40 <h3>Signals</h3> |
|
41 <dl> |
|
42 |
|
43 <dt>dataChanged(id:str)</dt> |
|
44 <dd> |
|
45 emitted to indicate a change of the chat history data |
|
46 </dd> |
|
47 <dt>deleteChatHistory(id:str)</dt> |
|
48 <dd> |
|
49 emitted to indicate, that this chat history |
|
50 should be deleted |
|
51 </dd> |
|
52 <dt>newChatWithHistory(id:str)</dt> |
|
53 <dd> |
|
54 emitted to indicate, that a new chat using |
|
55 the saved history should be started |
|
56 </dd> |
|
57 </dl> |
|
58 <h3>Derived from</h3> |
|
59 QWidget, Ui_OllamaHistoryWidget |
|
60 <h3>Class Attributes</h3> |
|
61 <table> |
|
62 <tr><td>None</td></tr> |
|
63 </table> |
|
64 |
|
65 <h3>Class Methods</h3> |
|
66 <table> |
|
67 <tr><td>None</td></tr> |
|
68 </table> |
|
69 |
|
70 <h3>Methods</h3> |
|
71 <table> |
|
72 <tr> |
|
73 <td><a href="#OllamaHistoryWidget.__init__">OllamaHistoryWidget</a></td> |
|
74 <td>Constructor</td> |
|
75 </tr> |
|
76 <tr> |
|
77 <td><a href="#OllamaHistoryWidget.addToMessages">addToMessages</a></td> |
|
78 <td>Public method to add a chat message to the chat history.</td> |
|
79 </tr> |
|
80 <tr> |
|
81 <td><a href="#OllamaHistoryWidget.checkModelAvailable">checkModelAvailable</a></td> |
|
82 <td>Public method to set the enabled state depending on available models.</td> |
|
83 </tr> |
|
84 <tr> |
|
85 <td><a href="#OllamaHistoryWidget.getId">getId</a></td> |
|
86 <td>Public method to get the chat history ID.</td> |
|
87 </tr> |
|
88 <tr> |
|
89 <td><a href="#OllamaHistoryWidget.getMessages">getMessages</a></td> |
|
90 <td>Public method to get the list of messages.</td> |
|
91 </tr> |
|
92 <tr> |
|
93 <td><a href="#OllamaHistoryWidget.getModel">getModel</a></td> |
|
94 <td>Public method to get the model used by the chat.</td> |
|
95 </tr> |
|
96 <tr> |
|
97 <td><a href="#OllamaHistoryWidget.getTitle">getTitle</a></td> |
|
98 <td>Public method to get the chat title.</td> |
|
99 </tr> |
|
100 <tr> |
|
101 <td><a href="#OllamaHistoryWidget.loadFromJson">loadFromJson</a></td> |
|
102 <td>Public method to load the chat history data from a JSON string.</td> |
|
103 </tr> |
|
104 <tr> |
|
105 <td><a href="#OllamaHistoryWidget.on_deleteButton_clicked">on_deleteButton_clicked</a></td> |
|
106 <td>Private slot to delet this chat history entry..</td> |
|
107 </tr> |
|
108 <tr> |
|
109 <td><a href="#OllamaHistoryWidget.on_editButton_clicked">on_editButton_clicked</a></td> |
|
110 <td>Private slot to edit the chat title.</td> |
|
111 </tr> |
|
112 <tr> |
|
113 <td><a href="#OllamaHistoryWidget.on_newChatButton_clicked">on_newChatButton_clicked</a></td> |
|
114 <td>Private slot to start a new chat using the saved chat history.</td> |
|
115 </tr> |
|
116 <tr> |
|
117 <td><a href="#OllamaHistoryWidget.saveToJson">saveToJson</a></td> |
|
118 <td>Public method to serialize the chat history data to a JSON string.</td> |
|
119 </tr> |
|
120 </table> |
|
121 |
|
122 <h3>Static Methods</h3> |
|
123 <table> |
|
124 <tr><td>None</td></tr> |
|
125 </table> |
|
126 |
|
127 |
|
128 <a NAME="OllamaHistoryWidget.__init__" ID="OllamaHistoryWidget.__init__"></a> |
|
129 <h4>OllamaHistoryWidget (Constructor)</h4> |
|
130 <b>OllamaHistoryWidget</b>(<i>title, model, jsonStr=None, parent=None</i>) |
|
131 <p> |
|
132 Constructor |
|
133 </p> |
|
134 |
|
135 <dl> |
|
136 |
|
137 <dt><i>title</i> (str)</dt> |
|
138 <dd> |
|
139 title of the ollama chat |
|
140 </dd> |
|
141 <dt><i>model</i> (str)</dt> |
|
142 <dd> |
|
143 name of the model used for the chat |
|
144 </dd> |
|
145 <dt><i>jsonStr</i> (str (optional))</dt> |
|
146 <dd> |
|
147 string containing JSON serialize chat history data |
|
148 (defaults to None) |
|
149 </dd> |
|
150 <dt><i>parent</i> (QWidget (optional))</dt> |
|
151 <dd> |
|
152 reference to the parent widget (defaults to None) |
|
153 </dd> |
|
154 </dl> |
|
155 <a NAME="OllamaHistoryWidget.addToMessages" ID="OllamaHistoryWidget.addToMessages"></a> |
|
156 <h4>OllamaHistoryWidget.addToMessages</h4> |
|
157 <b>addToMessages</b>(<i>role, content</i>) |
|
158 <p> |
|
159 Public method to add a chat message to the chat history. |
|
160 </p> |
|
161 |
|
162 <dl> |
|
163 |
|
164 <dt><i>role</i> (str)</dt> |
|
165 <dd> |
|
166 chat role (one of 'system', 'user', 'assistant' or 'tool') |
|
167 </dd> |
|
168 <dt><i>content</i> (str)</dt> |
|
169 <dd> |
|
170 content of the chat message |
|
171 </dd> |
|
172 </dl> |
|
173 <a NAME="OllamaHistoryWidget.checkModelAvailable" ID="OllamaHistoryWidget.checkModelAvailable"></a> |
|
174 <h4>OllamaHistoryWidget.checkModelAvailable</h4> |
|
175 <b>checkModelAvailable</b>(<i>modelNames</i>) |
|
176 <p> |
|
177 Public method to set the enabled state depending on available models. |
|
178 </p> |
|
179 |
|
180 <dl> |
|
181 |
|
182 <dt><i>modelNames</i> (str)</dt> |
|
183 <dd> |
|
184 names of available models |
|
185 </dd> |
|
186 </dl> |
|
187 <a NAME="OllamaHistoryWidget.getId" ID="OllamaHistoryWidget.getId"></a> |
|
188 <h4>OllamaHistoryWidget.getId</h4> |
|
189 <b>getId</b>(<i></i>) |
|
190 <p> |
|
191 Public method to get the chat history ID. |
|
192 </p> |
|
193 |
|
194 <dl> |
|
195 <dt>Return:</dt> |
|
196 <dd> |
|
197 ID of the history entry |
|
198 </dd> |
|
199 </dl> |
|
200 <dl> |
|
201 <dt>Return Type:</dt> |
|
202 <dd> |
|
203 str |
|
204 </dd> |
|
205 </dl> |
|
206 <a NAME="OllamaHistoryWidget.getMessages" ID="OllamaHistoryWidget.getMessages"></a> |
|
207 <h4>OllamaHistoryWidget.getMessages</h4> |
|
208 <b>getMessages</b>(<i></i>) |
|
209 <p> |
|
210 Public method to get the list of messages. |
|
211 </p> |
|
212 |
|
213 <dl> |
|
214 <dt>Return:</dt> |
|
215 <dd> |
|
216 list of stored messages |
|
217 </dd> |
|
218 </dl> |
|
219 <dl> |
|
220 <dt>Return Type:</dt> |
|
221 <dd> |
|
222 list[dict[str, str]] |
|
223 </dd> |
|
224 </dl> |
|
225 <a NAME="OllamaHistoryWidget.getModel" ID="OllamaHistoryWidget.getModel"></a> |
|
226 <h4>OllamaHistoryWidget.getModel</h4> |
|
227 <b>getModel</b>(<i></i>) |
|
228 <p> |
|
229 Public method to get the model used by the chat. |
|
230 </p> |
|
231 |
|
232 <dl> |
|
233 <dt>Return:</dt> |
|
234 <dd> |
|
235 model name |
|
236 </dd> |
|
237 </dl> |
|
238 <dl> |
|
239 <dt>Return Type:</dt> |
|
240 <dd> |
|
241 str |
|
242 </dd> |
|
243 </dl> |
|
244 <a NAME="OllamaHistoryWidget.getTitle" ID="OllamaHistoryWidget.getTitle"></a> |
|
245 <h4>OllamaHistoryWidget.getTitle</h4> |
|
246 <b>getTitle</b>(<i></i>) |
|
247 <p> |
|
248 Public method to get the chat title. |
|
249 </p> |
|
250 |
|
251 <dl> |
|
252 <dt>Return:</dt> |
|
253 <dd> |
|
254 chat title |
|
255 </dd> |
|
256 </dl> |
|
257 <dl> |
|
258 <dt>Return Type:</dt> |
|
259 <dd> |
|
260 str |
|
261 </dd> |
|
262 </dl> |
|
263 <a NAME="OllamaHistoryWidget.loadFromJson" ID="OllamaHistoryWidget.loadFromJson"></a> |
|
264 <h4>OllamaHistoryWidget.loadFromJson</h4> |
|
265 <b>loadFromJson</b>(<i>jsonStr</i>) |
|
266 <p> |
|
267 Public method to load the chat history data from a JSON string. |
|
268 </p> |
|
269 |
|
270 <dl> |
|
271 |
|
272 <dt><i>jsonStr</i> (str)</dt> |
|
273 <dd> |
|
274 JSON serialized chat data |
|
275 </dd> |
|
276 </dl> |
|
277 <a NAME="OllamaHistoryWidget.on_deleteButton_clicked" ID="OllamaHistoryWidget.on_deleteButton_clicked"></a> |
|
278 <h4>OllamaHistoryWidget.on_deleteButton_clicked</h4> |
|
279 <b>on_deleteButton_clicked</b>(<i></i>) |
|
280 <p> |
|
281 Private slot to delet this chat history entry.. |
|
282 </p> |
|
283 |
|
284 <a NAME="OllamaHistoryWidget.on_editButton_clicked" ID="OllamaHistoryWidget.on_editButton_clicked"></a> |
|
285 <h4>OllamaHistoryWidget.on_editButton_clicked</h4> |
|
286 <b>on_editButton_clicked</b>(<i></i>) |
|
287 <p> |
|
288 Private slot to edit the chat title. |
|
289 </p> |
|
290 |
|
291 <a NAME="OllamaHistoryWidget.on_newChatButton_clicked" ID="OllamaHistoryWidget.on_newChatButton_clicked"></a> |
|
292 <h4>OllamaHistoryWidget.on_newChatButton_clicked</h4> |
|
293 <b>on_newChatButton_clicked</b>(<i></i>) |
|
294 <p> |
|
295 Private slot to start a new chat using the saved chat history. |
|
296 </p> |
|
297 |
|
298 <a NAME="OllamaHistoryWidget.saveToJson" ID="OllamaHistoryWidget.saveToJson"></a> |
|
299 <h4>OllamaHistoryWidget.saveToJson</h4> |
|
300 <b>saveToJson</b>(<i></i>) |
|
301 <p> |
|
302 Public method to serialize the chat history data to a JSON string. |
|
303 </p> |
|
304 |
|
305 <dl> |
|
306 <dt>Return:</dt> |
|
307 <dd> |
|
308 JSON serialized chat data |
|
309 </dd> |
|
310 </dl> |
|
311 <dl> |
|
312 <dt>Return Type:</dt> |
|
313 <dd> |
|
314 str |
|
315 </dd> |
|
316 </dl> |
|
317 <div align="right"><a href="#top">Up</a></div> |
|
318 <hr /> |
|
319 </body></html> |