llms-py 2.0.14__py3-none-any.whl → 2.0.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. llms/__init__.py +2 -0
  2. llms/__main__.py +9 -0
  3. llms/__pycache__/__init__.cpython-312.pyc +0 -0
  4. llms/__pycache__/__init__.cpython-313.pyc +0 -0
  5. llms/__pycache__/__init__.cpython-314.pyc +0 -0
  6. llms/__pycache__/__main__.cpython-312.pyc +0 -0
  7. llms/__pycache__/__main__.cpython-314.pyc +0 -0
  8. llms/__pycache__/llms.cpython-312.pyc +0 -0
  9. llms/__pycache__/main.cpython-312.pyc +0 -0
  10. llms/__pycache__/main.cpython-313.pyc +0 -0
  11. llms/__pycache__/main.cpython-314.pyc +0 -0
  12. {llms_py-2.0.14.data/data → llms}/index.html +5 -1
  13. llms/llms.json +1102 -0
  14. llms.py → llms/main.py +252 -14
  15. llms/ui/Analytics.mjs +1483 -0
  16. llms/ui/Brand.mjs +34 -0
  17. {llms_py-2.0.14.data/data → llms}/ui/ChatPrompt.mjs +58 -36
  18. {llms_py-2.0.14.data/data → llms}/ui/Main.mjs +205 -5
  19. llms/ui/ModelSelector.mjs +60 -0
  20. llms/ui/ProviderIcon.mjs +29 -0
  21. {llms_py-2.0.14.data/data → llms}/ui/Sidebar.mjs +20 -4
  22. {llms_py-2.0.14.data/data → llms}/ui/ai.mjs +1 -1
  23. {llms_py-2.0.14.data/data → llms}/ui/app.css +211 -64
  24. llms/ui/lib/chart.js +14 -0
  25. llms/ui/lib/charts.mjs +20 -0
  26. llms/ui/lib/color.js +14 -0
  27. llms/ui/lib/vue.mjs +18369 -0
  28. {llms_py-2.0.14.data/data → llms}/ui/tailwind.input.css +1 -1
  29. llms/ui/threadStore.mjs +524 -0
  30. {llms_py-2.0.14.data/data → llms}/ui/utils.mjs +36 -0
  31. {llms_py-2.0.14.dist-info → llms_py-2.0.16.dist-info}/METADATA +8 -35
  32. llms_py-2.0.16.dist-info/RECORD +56 -0
  33. llms_py-2.0.16.dist-info/entry_points.txt +2 -0
  34. llms_py-2.0.14.data/data/llms.json +0 -447
  35. llms_py-2.0.14.data/data/requirements.txt +0 -1
  36. llms_py-2.0.14.data/data/ui/Brand.mjs +0 -23
  37. llms_py-2.0.14.data/data/ui/ModelSelector.mjs +0 -29
  38. llms_py-2.0.14.data/data/ui/threadStore.mjs +0 -273
  39. llms_py-2.0.14.dist-info/RECORD +0 -40
  40. llms_py-2.0.14.dist-info/entry_points.txt +0 -2
  41. {llms_py-2.0.14.data/data → llms}/ui/App.mjs +0 -0
  42. {llms_py-2.0.14.data/data → llms}/ui/Avatar.mjs +0 -0
  43. {llms_py-2.0.14.data/data → llms}/ui/ProviderStatus.mjs +0 -0
  44. {llms_py-2.0.14.data/data → llms}/ui/Recents.mjs +0 -0
  45. {llms_py-2.0.14.data/data → llms}/ui/SettingsDialog.mjs +0 -0
  46. {llms_py-2.0.14.data/data → llms}/ui/SignIn.mjs +0 -0
  47. {llms_py-2.0.14.data/data → llms}/ui/SystemPromptEditor.mjs +0 -0
  48. {llms_py-2.0.14.data/data → llms}/ui/SystemPromptSelector.mjs +0 -0
  49. {llms_py-2.0.14.data/data → llms}/ui/Welcome.mjs +0 -0
  50. {llms_py-2.0.14.data/data → llms}/ui/fav.svg +0 -0
  51. {llms_py-2.0.14.data/data → llms}/ui/lib/highlight.min.mjs +0 -0
  52. {llms_py-2.0.14.data/data → llms}/ui/lib/idb.min.mjs +0 -0
  53. {llms_py-2.0.14.data/data → llms}/ui/lib/marked.min.mjs +0 -0
  54. {llms_py-2.0.14.data/data → llms}/ui/lib/servicestack-client.mjs +0 -0
  55. {llms_py-2.0.14.data/data → llms}/ui/lib/servicestack-vue.mjs +0 -0
  56. {llms_py-2.0.14.data/data → llms}/ui/lib/vue-router.min.mjs +0 -0
  57. {llms_py-2.0.14.data/data → llms}/ui/lib/vue.min.mjs +0 -0
  58. {llms_py-2.0.14.data/data → llms}/ui/markdown.mjs +0 -0
  59. {llms_py-2.0.14.data/data → llms}/ui/typography.css +0 -0
  60. {llms_py-2.0.14.data/data → llms}/ui.json +0 -0
  61. {llms_py-2.0.14.dist-info → llms_py-2.0.16.dist-info}/WHEEL +0 -0
  62. {llms_py-2.0.14.dist-info → llms_py-2.0.16.dist-info}/licenses/LICENSE +0 -0
  63. {llms_py-2.0.14.dist-info → llms_py-2.0.16.dist-info}/top_level.txt +0 -0
@@ -1,273 +0,0 @@
1
- import { ref, computed } from 'vue'
2
- import { openDB } from 'idb'
3
- import { nextId } from './utils.mjs'
4
-
5
- // Thread store for managing chat threads with IndexedDB
6
- const threads = ref([])
7
- const currentThread = ref(null)
8
- const isLoading = ref(false)
9
-
10
- let db = null
11
-
12
- // Initialize IndexedDB
13
- async function initDB() {
14
- if (db) return db
15
-
16
- db = await openDB('LlmsThreads', 1, {
17
- upgrade(db) {
18
- // Create threads store
19
- const threadStore = db.createObjectStore('threads', {
20
- keyPath: 'id',
21
- autoIncrement: false
22
- })
23
-
24
- // Create indexes for efficient querying
25
- threadStore.createIndex('createdAt', 'createdAt')
26
- threadStore.createIndex('updatedAt', 'updatedAt')
27
- threadStore.createIndex('title', 'title')
28
- }
29
- })
30
-
31
- return db
32
- }
33
-
34
- // Generate unique thread ID
35
- function generateThreadId() {
36
- return Date.now().toString()
37
- }
38
-
39
- // Create a new thread
40
- async function createThread(title = 'New Chat', model = '', systemPrompt = '') {
41
- await initDB()
42
-
43
- const thread = {
44
- id: generateThreadId(),
45
- title: title,
46
- model: model,
47
- systemPrompt: systemPrompt,
48
- messages: [],
49
- createdAt: new Date().toISOString(),
50
- updatedAt: new Date().toISOString()
51
- }
52
-
53
- const tx = db.transaction(['threads'], 'readwrite')
54
- await tx.objectStore('threads').add(thread)
55
- await tx.complete
56
-
57
- threads.value.unshift(thread)
58
- // Note: currentThread will be set by router navigation
59
-
60
- return thread
61
- }
62
-
63
- // Update thread
64
- async function updateThread(threadId, updates) {
65
- await initDB()
66
-
67
- const tx = db.transaction(['threads'], 'readwrite')
68
- const store = tx.objectStore('threads')
69
-
70
- const thread = await store.get(threadId)
71
- if (!thread) throw new Error('Thread not found')
72
-
73
- const updatedThread = {
74
- ...thread,
75
- ...updates,
76
- updatedAt: new Date().toISOString()
77
- }
78
-
79
- await store.put(updatedThread)
80
- await tx.complete
81
-
82
- // Update in memory
83
- const index = threads.value.findIndex(t => t.id === threadId)
84
- if (index !== -1) {
85
- threads.value[index] = updatedThread
86
- }
87
-
88
- if (currentThread.value?.id === threadId) {
89
- currentThread.value = updatedThread
90
- }
91
-
92
- return updatedThread
93
- }
94
-
95
- // Add message to thread
96
- async function addMessageToThread(threadId, message) {
97
- const thread = await getThread(threadId)
98
- if (!thread) throw new Error('Thread not found')
99
-
100
- const newMessage = {
101
- id: nextId(),
102
- timestamp: new Date().toISOString(),
103
- ...message
104
- }
105
-
106
- const updatedMessages = [...thread.messages, newMessage]
107
-
108
- // Auto-generate title from first user message if still "New Chat"
109
- let title = thread.title
110
- if (title === 'New Chat' && message.role === 'user' && updatedMessages.length <= 2) {
111
- title = message.content.slice(0, 200) + (message.content.length > 200 ? '...' : '')
112
- }
113
-
114
- await updateThread(threadId, {
115
- messages: updatedMessages,
116
- title: title
117
- })
118
-
119
- return newMessage
120
- }
121
-
122
- async function deleteMessageFromThread(threadId, messageId) {
123
- const thread = await getThread(threadId)
124
- if (!thread) throw new Error('Thread not found')
125
- const updatedMessages = thread.messages.filter(m => m.id !== messageId)
126
- await updateThread(threadId, { messages: updatedMessages })
127
- }
128
-
129
- // Get all threads
130
- async function loadThreads() {
131
- await initDB()
132
- isLoading.value = true
133
-
134
- try {
135
- const tx = db.transaction(['threads'], 'readonly')
136
- const store = tx.objectStore('threads')
137
- const index = store.index('updatedAt')
138
-
139
- const allThreads = await index.getAll()
140
- threads.value = allThreads.reverse() // Most recent first
141
-
142
- return threads.value
143
- } finally {
144
- isLoading.value = false
145
- }
146
- }
147
-
148
- // Get single thread
149
- async function getThread(threadId) {
150
- await initDB()
151
-
152
- const tx = db.transaction(['threads'], 'readonly')
153
- const thread = await tx.objectStore('threads').get(threadId)
154
-
155
- return thread
156
- }
157
-
158
- // Delete thread
159
- async function deleteThread(threadId) {
160
- await initDB()
161
-
162
- const tx = db.transaction(['threads'], 'readwrite')
163
- await tx.objectStore('threads').delete(threadId)
164
- await tx.complete
165
-
166
- threads.value = threads.value.filter(t => t.id !== threadId)
167
-
168
- if (currentThread.value?.id === threadId) {
169
- currentThread.value = null
170
- }
171
- }
172
-
173
- // Set current thread
174
- async function setCurrentThread(threadId) {
175
- const thread = await getThread(threadId)
176
- if (thread) {
177
- currentThread.value = thread
178
- }
179
- return thread
180
- }
181
-
182
- // Set current thread from router params (router-aware version)
183
- async function setCurrentThreadFromRoute(threadId, router) {
184
- if (!threadId) {
185
- currentThread.value = null
186
- return null
187
- }
188
-
189
- const thread = await getThread(threadId)
190
- if (thread) {
191
- currentThread.value = thread
192
- return thread
193
- } else {
194
- // Thread not found, redirect to home
195
- if (router) {
196
- router.push((globalThis.ai?.base || '') + '/')
197
- }
198
- currentThread.value = null
199
- return null
200
- }
201
- }
202
-
203
- // Clear current thread (go back to initial state)
204
- function clearCurrentThread() {
205
- currentThread.value = null
206
- }
207
-
208
- function getGroupedThreads(total) {
209
- const now = new Date()
210
- const today = new Date(now.getFullYear(), now.getMonth(), now.getDate())
211
- const lastWeek = new Date(today.getTime() - 7 * 24 * 60 * 60 * 1000)
212
- const lastMonth = new Date(today.getTime() - 30 * 24 * 60 * 60 * 1000)
213
-
214
- const groups = {
215
- today: [],
216
- lastWeek: [],
217
- lastMonth: [],
218
- older: {}
219
- }
220
-
221
- const takeThreads = threads.value.slice(0, total)
222
-
223
- takeThreads.forEach(thread => {
224
- const threadDate = new Date(thread.updatedAt)
225
-
226
- if (threadDate >= today) {
227
- groups.today.push(thread)
228
- } else if (threadDate >= lastWeek) {
229
- groups.lastWeek.push(thread)
230
- } else if (threadDate >= lastMonth) {
231
- groups.lastMonth.push(thread)
232
- } else {
233
- const year = threadDate.getFullYear()
234
- const month = threadDate.toLocaleString('default', { month: 'long' })
235
- const key = `${month} ${year}`
236
-
237
- if (!groups.older[key]) {
238
- groups.older[key] = []
239
- }
240
- groups.older[key].push(thread)
241
- }
242
- })
243
-
244
- return groups
245
- }
246
-
247
- // Group threads by time periods
248
- const groupedThreads = computed(() => getGroupedThreads(threads.value.length))
249
-
250
- // Export the store
251
- export function useThreadStore() {
252
- return {
253
- // State
254
- threads,
255
- currentThread,
256
- isLoading,
257
- groupedThreads,
258
-
259
- // Actions
260
- initDB,
261
- createThread,
262
- updateThread,
263
- addMessageToThread,
264
- deleteMessageFromThread,
265
- loadThreads,
266
- getThread,
267
- deleteThread,
268
- setCurrentThread,
269
- setCurrentThreadFromRoute,
270
- clearCurrentThread,
271
- getGroupedThreads,
272
- }
273
- }
@@ -1,40 +0,0 @@
1
- llms.py,sha256=bh_8AmA4fPNdE_9oOjJrrAnPlKNeoKyDmE9Buq8iV5c,60500
2
- llms_py-2.0.14.data/data/index.html,sha256=RmvPW7H49tHR3DdQvvSrcR_OeCt1InYd5dirBxfZCpo,2417
3
- llms_py-2.0.14.data/data/llms.json,sha256=aQFm_lXsPLTWCndE2DNhTY04P576U7NFN9hx5-QwL3E,19582
4
- llms_py-2.0.14.data/data/requirements.txt,sha256=iv-JIaacmTl-hSho3QmphcKnbRRYx1st47yjz_178Ro,8
5
- llms_py-2.0.14.data/data/ui.json,sha256=iBOmpNeD5-o8AgUa51ymS-KemovJ7bm9J1fnL0nf8jk,134025
6
- llms_py-2.0.14.data/data/ui/App.mjs,sha256=hXtUjaL3GrcIHieEK3BzIG72OVzrorBBS4RkE1DOGc4,439
7
- llms_py-2.0.14.data/data/ui/Avatar.mjs,sha256=3rHpxe_LuCDiNP895F3FOjWx4j377JA9rD1FLluvtgA,851
8
- llms_py-2.0.14.data/data/ui/Brand.mjs,sha256=ZkJ1Yd9ZgdTbs7f3ezM0UtsHMcm6v4-L-m3avnSXAXU,1184
9
- llms_py-2.0.14.data/data/ui/ChatPrompt.mjs,sha256=IbfCx3W0SlX8x9lvaFjB1rqJqNkbeUvfqFHP9iKzZ9s,19776
10
- llms_py-2.0.14.data/data/ui/Main.mjs,sha256=kLNWyXWUgHAaX3C3kVkAHOLvEI3H4bd5k9yMkUIRQPU,27348
11
- llms_py-2.0.14.data/data/ui/ModelSelector.mjs,sha256=qiI-7DBwif5ipNZtzgaZQ2o_wHc23dBRMY6zVkMOCak,947
12
- llms_py-2.0.14.data/data/ui/ProviderStatus.mjs,sha256=qF_rPdhyt9GffKdPCJdU0yanrDJ3cw1HLPygFP_KjEs,5744
13
- llms_py-2.0.14.data/data/ui/Recents.mjs,sha256=hmj7V-RXVw-DqMXjUr3OhFHTYQTkvkEhuNEDTGBf3Qw,8448
14
- llms_py-2.0.14.data/data/ui/SettingsDialog.mjs,sha256=Jm21s5CcZT97ZEhPc7c1WgnLOLdfSiC1SDroYsh7zM4,18095
15
- llms_py-2.0.14.data/data/ui/Sidebar.mjs,sha256=ERm2Q7pftKTHLCjf-Q76joy1dsvtNWLoYH-wO2mS1LI,9781
16
- llms_py-2.0.14.data/data/ui/SignIn.mjs,sha256=df3b-7L3ZIneDGbJWUk93K9RGo40gVeuR5StzT1ZH9g,2324
17
- llms_py-2.0.14.data/data/ui/SystemPromptEditor.mjs,sha256=2CyIUvkIubqYPyIp5zC6_I8CMxvYINuYNjDxvMz4VRU,1265
18
- llms_py-2.0.14.data/data/ui/SystemPromptSelector.mjs,sha256=AuEtRwUf_RkGgene3nVA9bw8AeMb-b5_6ZLJCTWA8KQ,3051
19
- llms_py-2.0.14.data/data/ui/Welcome.mjs,sha256=QFAxN7sjWlhMvOIJCmHjNFCQcvpM_T-b4ze1ld9Hj7I,912
20
- llms_py-2.0.14.data/data/ui/ai.mjs,sha256=mQpBHkU8jp0DO0vtdkVujzWJcC04SDpobutk3sWVgto,2346
21
- llms_py-2.0.14.data/data/ui/app.css,sha256=1Z4coREGsjMw7lYabejdaG0ZMwPpP5lmjRHRDYygq-g,94964
22
- llms_py-2.0.14.data/data/ui/fav.svg,sha256=_R6MFeXl6wBFT0lqcUxYQIDWgm246YH_3hSTW0oO8qw,734
23
- llms_py-2.0.14.data/data/ui/markdown.mjs,sha256=O5UspOeD8-E23rxOLWcS4eyy2YejMbPwszCYteVtuoU,6221
24
- llms_py-2.0.14.data/data/ui/tailwind.input.css,sha256=P6QxCwbTBAaG2079ddgtFuuXDLIztEkJDFwj0wmOvkk,11978
25
- llms_py-2.0.14.data/data/ui/threadStore.mjs,sha256=nM53p1E78Jc7tPOoyS3J3SW9F1njcZ-Fw5FlR9l-3yY,7215
26
- llms_py-2.0.14.data/data/ui/typography.css,sha256=Z5Fe2IQWnh7bu1CMXniYt0SkaN2fXOFlOuniXUW8oGM,19325
27
- llms_py-2.0.14.data/data/ui/utils.mjs,sha256=UKyaBsuJYEc-MWoL9b1M5-t3x6h5_HV9HsNBoDVtBRw,4226
28
- llms_py-2.0.14.data/data/ui/lib/highlight.min.mjs,sha256=sG7wq8bF-IKkfie7S4QSyh5DdHBRf0NqQxMOEH8-MT0,127458
29
- llms_py-2.0.14.data/data/ui/lib/idb.min.mjs,sha256=CeTXyV4I_pB5vnibvJuyXdMs0iVF2ZL0Z7cdm3w_QaI,3853
30
- llms_py-2.0.14.data/data/ui/lib/marked.min.mjs,sha256=QRHb_VZugcBJRD2EP6gYlVFEsJw5C2fQ8ImMf_pA2_s,39488
31
- llms_py-2.0.14.data/data/ui/lib/servicestack-client.mjs,sha256=UVafVbzhJ_0N2lzv7rlzIbzwnWpoqXxGk3N3FSKgOOc,54534
32
- llms_py-2.0.14.data/data/ui/lib/servicestack-vue.mjs,sha256=r_-khYokisXJAIPDLh8Wq6YtcLAY6HNjtJlCZJjLy74,215181
33
- llms_py-2.0.14.data/data/ui/lib/vue-router.min.mjs,sha256=fR30GHoXI1u81zyZ26YEU105pZgbbAKSXbpnzFKIxls,30418
34
- llms_py-2.0.14.data/data/ui/lib/vue.min.mjs,sha256=iXh97m5hotl0eFllb3aoasQTImvp7mQoRJ_0HoxmZkw,163811
35
- llms_py-2.0.14.dist-info/licenses/LICENSE,sha256=rRryrddGfVftpde-rmAZpW0R8IJihqJ8t8wpfDXoKiQ,1549
36
- llms_py-2.0.14.dist-info/METADATA,sha256=zyBLBoDwdXrK2ZZT14e3kfDyKR0I3kZF6uEq2KZJ5xY,28351
37
- llms_py-2.0.14.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
38
- llms_py-2.0.14.dist-info/entry_points.txt,sha256=svUoTt28bIJeo6Mb1ffDBLyzhD90DWtFbfp0ShyRCgU,35
39
- llms_py-2.0.14.dist-info/top_level.txt,sha256=gC7hk9BKSeog8gyg-EM_g2gxm1mKHwFRfK-10BxOsa4,5
40
- llms_py-2.0.14.dist-info/RECORD,,
@@ -1,2 +0,0 @@
1
- [console_scripts]
2
- llms = llms:main
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes