hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | //! A RAG thread. It only groups turns and carries the ordering key the |
| 2 | //! list view sorts on: `updated_at` moves on every new turn, so a user's |
| 3 | //! threads list newest-activity-first. The turns themselves live in |
| 4 | //! [`crate::db::rag_message`], and deleting a thread cascades them; the |
| 5 | //! threads' own persistence lives in [`crate::db::rag_thread`]. |
| 6 | //! |
| 7 | //! A user's RAG threads are capped per nest but on the **chatbot's knob**: |
| 8 | //! `app_user.rag_thread_count` holds this nest's seats, and the school's |
| 9 | //! `max_chatbot_threads` is the number both nests are read against — the two |
| 10 | //! are one package (`/chatbot` and `/rag` are both `Module::Chatbot`), and the |
| 11 | //! cap exists to bound what one account may store in a school's database, so |
| 12 | //! one knob governs the whole package. Each nest holds its own seats all the |
| 13 | //! same: a user at the cap in one nest may still open a thread in the other, |
| 14 | //! and the counter a claim moves counts exactly the rows it guards. |
| 15 | |
| 16 | use crateMAX_CHATBOT_THREAD_TITLE_LEN; |
| 17 | use cratenext_uuid; |
| 18 | use crateTimestamp; |
| 19 | use crateUserId; |
| 20 | use crateValidationError; |
| 21 | use cratevalidate_required; |
| 22 | |
| 23 | |
| 24 | |
| 25 | ; |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | /// A user-chosen thread name. Required-and-bounded here; "untitled" is |
| 54 | /// `Option<RagThreadTitle>` on the row. Named like the chatbot's |
| 55 | /// ([`crate::domain::chatbot_thread::ChatbotThreadTitle`]) and bounded by the |
| 56 | /// same constant: a name is a line a user typed either way. |
| 57 | |
| 58 | |
| 59 | ; |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 | |
| 90 | |
| 91 | |
| 92 | |
| 93 | |
| 94 | |
| 95 | |
| 96 | |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | |
| 103 | |
| 104 | |
| 105 | |
| 106 | |
| 107 | |
| 108 | |
| 109 | |
| 110 | |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 |