17 </table> |
17 </table> |
18 |
18 |
19 <h3>Classes</h3> |
19 <h3>Classes</h3> |
20 <table> |
20 <table> |
21 <tr> |
21 <tr> |
|
22 <td><a href="#OllamaChatDialog">OllamaChatDialog</a></td> |
|
23 <td>Class implementing a dialog showing the chat with the 'ollama' server.</td> |
|
24 </tr> |
|
25 <tr> |
22 <td><a href="#OllamaChatWidget">OllamaChatWidget</a></td> |
26 <td><a href="#OllamaChatWidget">OllamaChatWidget</a></td> |
23 <td>Class implementing a widget showing the chat with the 'ollama' server.</td> |
27 <td>Class implementing a widget showing the chat with the 'ollama' server.</td> |
24 </tr> |
28 </tr> |
25 </table> |
29 </table> |
26 |
30 |
27 <h3>Functions</h3> |
31 <h3>Functions</h3> |
28 <table> |
32 <table> |
29 <tr><td>None</td></tr> |
33 <tr><td>None</td></tr> |
30 </table> |
34 </table> |
31 |
35 |
|
36 <hr /> |
|
37 <hr /> |
|
38 <a NAME="OllamaChatDialog" ID="OllamaChatDialog"></a> |
|
39 <h2>OllamaChatDialog</h2> |
|
40 <p> |
|
41 Class implementing a dialog showing the chat with the 'ollama' server. |
|
42 </p> |
|
43 |
|
44 <h3>Derived from</h3> |
|
45 QDialog |
|
46 <h3>Class Attributes</h3> |
|
47 <table> |
|
48 <tr><td>None</td></tr> |
|
49 </table> |
|
50 |
|
51 <h3>Class Methods</h3> |
|
52 <table> |
|
53 <tr><td>None</td></tr> |
|
54 </table> |
|
55 |
|
56 <h3>Methods</h3> |
|
57 <table> |
|
58 <tr> |
|
59 <td><a href="#OllamaChatDialog.__init__">OllamaChatDialog</a></td> |
|
60 <td>Constructor</td> |
|
61 </tr> |
|
62 <tr> |
|
63 <td><a href="#OllamaChatDialog.getHistoryId">getHistoryId</a></td> |
|
64 <td>Public method to get the history ID of this chat.</td> |
|
65 </tr> |
|
66 <tr> |
|
67 <td><a href="#OllamaChatDialog.setHistory">setHistory</a></td> |
|
68 <td>Public method to add a list of messages to the view.</td> |
|
69 </tr> |
|
70 </table> |
|
71 |
|
72 <h3>Static Methods</h3> |
|
73 <table> |
|
74 <tr><td>None</td></tr> |
|
75 </table> |
|
76 |
|
77 |
|
78 <a NAME="OllamaChatDialog.__init__" ID="OllamaChatDialog.__init__"></a> |
|
79 <h4>OllamaChatDialog (Constructor)</h4> |
|
80 <b>OllamaChatDialog</b>(<i>hid, title, model, parent=None</i>) |
|
81 <p> |
|
82 Constructor |
|
83 </p> |
|
84 |
|
85 <dl> |
|
86 |
|
87 <dt><i>hid</i> (str)</dt> |
|
88 <dd> |
|
89 ID of the chat history |
|
90 </dd> |
|
91 <dt><i>title</i> (str)</dt> |
|
92 <dd> |
|
93 title of the chat |
|
94 </dd> |
|
95 <dt><i>model</i> (str)</dt> |
|
96 <dd> |
|
97 model name used for the chat |
|
98 </dd> |
|
99 <dt><i>parent</i> (QWidget (optional))</dt> |
|
100 <dd> |
|
101 reference to the parent widget (defaults to None) |
|
102 </dd> |
|
103 </dl> |
|
104 <a NAME="OllamaChatDialog.getHistoryId" ID="OllamaChatDialog.getHistoryId"></a> |
|
105 <h4>OllamaChatDialog.getHistoryId</h4> |
|
106 <b>getHistoryId</b>(<i></i>) |
|
107 <p> |
|
108 Public method to get the history ID of this chat. |
|
109 </p> |
|
110 |
|
111 <dl> |
|
112 <dt>Return:</dt> |
|
113 <dd> |
|
114 DESCRIPTION |
|
115 </dd> |
|
116 </dl> |
|
117 <dl> |
|
118 <dt>Return Type:</dt> |
|
119 <dd> |
|
120 TYPE |
|
121 </dd> |
|
122 </dl> |
|
123 <a NAME="OllamaChatDialog.setHistory" ID="OllamaChatDialog.setHistory"></a> |
|
124 <h4>OllamaChatDialog.setHistory</h4> |
|
125 <b>setHistory</b>(<i>messages</i>) |
|
126 <p> |
|
127 Public method to add a list of messages to the view. |
|
128 </p> |
|
129 |
|
130 <dl> |
|
131 |
|
132 <dt><i>messages</i> (list[dict[str, str]])</dt> |
|
133 <dd> |
|
134 list of chat messages |
|
135 </dd> |
|
136 </dl> |
|
137 <div align="right"><a href="#top">Up</a></div> |
32 <hr /> |
138 <hr /> |
33 <hr /> |
139 <hr /> |
34 <a NAME="OllamaChatWidget" ID="OllamaChatWidget"></a> |
140 <a NAME="OllamaChatWidget" ID="OllamaChatWidget"></a> |
35 <h2>OllamaChatWidget</h2> |
141 <h2>OllamaChatWidget</h2> |
36 <p> |
142 <p> |
66 <tr> |
172 <tr> |
67 <td><a href="#OllamaChatWidget.appendMessage">appendMessage</a></td> |
173 <td><a href="#OllamaChatWidget.appendMessage">appendMessage</a></td> |
68 <td>Public method to append a given message to the bottom most message box.</td> |
174 <td>Public method to append a given message to the bottom most message box.</td> |
69 </tr> |
175 </tr> |
70 <tr> |
176 <tr> |
|
177 <td><a href="#OllamaChatWidget.clear">clear</a></td> |
|
178 <td>Public method to clear the list of messages.</td> |
|
179 </tr> |
|
180 <tr> |
71 <td><a href="#OllamaChatWidget.getHistoryId">getHistoryId</a></td> |
181 <td><a href="#OllamaChatWidget.getHistoryId">getHistoryId</a></td> |
72 <td>Public method to get the history ID of this chat.</td> |
182 <td>Public method to get the history ID of this chat.</td> |
73 </tr> |
183 </tr> |
74 <tr> |
184 <tr> |
75 <td><a href="#OllamaChatWidget.getRecentMessage">getRecentMessage</a></td> |
185 <td><a href="#OllamaChatWidget.getRecentMessage">getRecentMessage</a></td> |
116 Private slot to scroll the chat scroll area to the bottom. |
226 Private slot to scroll the chat scroll area to the bottom. |
117 </p> |
227 </p> |
118 |
228 |
119 <a NAME="OllamaChatWidget.addMessage" ID="OllamaChatWidget.addMessage"></a> |
229 <a NAME="OllamaChatWidget.addMessage" ID="OllamaChatWidget.addMessage"></a> |
120 <h4>OllamaChatWidget.addMessage</h4> |
230 <h4>OllamaChatWidget.addMessage</h4> |
121 <b>addMessage</b>(<i>role, message</i>) |
231 <b>addMessage</b>(<i>role, message, scrollToBottom=True</i>) |
122 <p> |
232 <p> |
123 Public method to add a new message. |
233 Public method to add a new message. |
124 </p> |
234 </p> |
125 |
235 |
126 <dl> |
236 <dl> |
130 role of the message sender (one of 'user' or 'assistant') |
240 role of the message sender (one of 'user' or 'assistant') |
131 </dd> |
241 </dd> |
132 <dt><i>message</i> (str)</dt> |
242 <dt><i>message</i> (str)</dt> |
133 <dd> |
243 <dd> |
134 message text |
244 message text |
|
245 </dd> |
|
246 <dt><i>scrollToBottom</i> (bool (optional))</dt> |
|
247 <dd> |
|
248 flag indicating to scroll the view to the bottom |
|
249 (defaults to True) |
135 </dd> |
250 </dd> |
136 </dl> |
251 </dl> |
137 <a NAME="OllamaChatWidget.appendMessage" ID="OllamaChatWidget.appendMessage"></a> |
252 <a NAME="OllamaChatWidget.appendMessage" ID="OllamaChatWidget.appendMessage"></a> |
138 <h4>OllamaChatWidget.appendMessage</h4> |
253 <h4>OllamaChatWidget.appendMessage</h4> |
139 <b>appendMessage</b>(<i>message</i>) |
254 <b>appendMessage</b>(<i>message</i>) |
146 <dt><i>message</i> (str)</dt> |
261 <dt><i>message</i> (str)</dt> |
147 <dd> |
262 <dd> |
148 message text to be appended |
263 message text to be appended |
149 </dd> |
264 </dd> |
150 </dl> |
265 </dl> |
|
266 <a NAME="OllamaChatWidget.clear" ID="OllamaChatWidget.clear"></a> |
|
267 <h4>OllamaChatWidget.clear</h4> |
|
268 <b>clear</b>(<i></i>) |
|
269 <p> |
|
270 Public method to clear the list of messages. |
|
271 </p> |
|
272 |
151 <a NAME="OllamaChatWidget.getHistoryId" ID="OllamaChatWidget.getHistoryId"></a> |
273 <a NAME="OllamaChatWidget.getHistoryId" ID="OllamaChatWidget.getHistoryId"></a> |
152 <h4>OllamaChatWidget.getHistoryId</h4> |
274 <h4>OllamaChatWidget.getHistoryId</h4> |
153 <b>getHistoryId</b>(<i></i>) |
275 <b>getHistoryId</b>(<i></i>) |
154 <p> |
276 <p> |
155 Public method to get the history ID of this chat. |
277 Public method to get the history ID of this chat. |