You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

408 lines
27KB

  1. @page "/chatroom_base/{typellm:int}"
  2. @page "/chatroom_base/{typellm:int}/{conversationid}"
  3. <script>
  4. window.autoResizeTextarea = function (elementId) {
  5. const element = document.getElementById(elementId);
  6. if (!element) return;
  7. element.style.height = 'auto';
  8. element.style.height = Math.min(element.scrollHeight, 200) + 'px';
  9. };
  10. window.setupTextareaAutoResize = function (textareaId) {
  11. const textarea = document.getElementById(textareaId);
  12. if (!textarea) return;
  13. textarea.addEventListener('input', function () {
  14. window.autoResizeTextarea(this);
  15. });
  16. // Initial resize
  17. window.autoResizeTextarea(textarea);
  18. };
  19. </script>
  20. @if (TypeLLM == 0)
  21. {
  22. <!-- Vue Home -->
  23. <div class="home-container">
  24. <div class="home-content">
  25. <!-- Section bienvenue -->
  26. <div class="welcome-section">
  27. <h1 class="welcome-title">Bonjour !</h1>
  28. <p class="welcome-subtitle">Qu'est-ce qu'on fait aujourd'hui ?</p>
  29. </div>
  30. <!-- Zone de saisie -->
  31. <div class="input-container">
  32. @if (UploadedDocuments.Any())
  33. {
  34. <div class="input-files">
  35. @foreach (var doc in UploadedDocuments)
  36. {
  37. <div class="file-item">
  38. <div class="file-preview">
  39. <div class="file-icon">
  40. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
  41. <path d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z" />
  42. </svg>
  43. </div>
  44. </div>
  45. <div class="file-info">
  46. <span class="file-name">@doc.FileName</span>
  47. <span class="file-size">@FormatFileSize(doc.Bytes.Length)</span>
  48. </div>
  49. <button class="remove-file-button" @onclick="() => RemoveDocument(doc)" aria-label="Supprimer le fichier">
  50. <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
  51. <path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z" />
  52. </svg>
  53. </button>
  54. </div>
  55. }
  56. </div>
  57. }
  58. <div class="input-wrapper @(UploadedDocuments.Any() ? "has-files" : "")">
  59. <textarea id="homeTextarea"
  60. @bind="CurrentInput"
  61. @oninput="OnHomeTextareaInput"
  62. placeholder="Nouvelle conversation..."
  63. rows="1"
  64. disabled="@isDisabled"></textarea>
  65. <div class="input-actions">
  66. <label class="attach-button" for="fileInputHome">
  67. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  68. <path d="M4.5 3a2.5 2.5 0 0 1 5 0v9a1.5 1.5 0 0 1-3 0V5a.5.5 0 0 1 1 0v7a.5.5 0 0 0 1 0V3a1.5 1.5 0 1 0-3 0v9a2.5 2.5 0 0 0 5 0V5a.5.5 0 0 1 1 0v7a3.5 3.5 0 1 1-7 0z" />
  69. </svg>
  70. <span>Importer un fichier</span>
  71. <InputFile id="fileInputHome" OnChange="HandleFileSelection" multiple style="display: none;" />
  72. </label>
  73. <div class="input-right-actions">
  74. @* Sélecteur de domaine pour RAG *@
  75. @if (!hiddenDomain && SelectedAgentType == 2 && RagDomains.Any())
  76. {
  77. <select class="domain-select" @bind="SelectedDomain">
  78. @foreach (var domain in RagDomains)
  79. {
  80. <option value="@domain">@domain</option>
  81. }
  82. </select>
  83. }
  84. @* Input ID Client pour AUDIT *@
  85. @if (SelectedAgentType == 3)
  86. {
  87. <input type="text"
  88. class="client-id-input"
  89. @bind="ClientId"
  90. placeholder="ID Client"
  91. aria-label="ID Client" />
  92. }
  93. <button class="voice-button" @onclick="RecordVoice" aria-label="Message vocal">
  94. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  95. <path fill-rule="evenodd" d="M8.5 2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-1 0v-11a.5.5 0 0 1 .5-.5m-2 2a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5m4 0a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5m-6 1.5A.5.5 0 0 1 5 6v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m8 0a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m-10 1A.5.5 0 0 1 3 7v2a.5.5 0 0 1-1 0V7a.5.5 0 0 1 .5-.5m12 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0V7a.5.5 0 0 1 .5-.5" />
  96. </svg>
  97. </button>
  98. <button class="send-button"
  99. @onclick="SendMessageFromHome"
  100. disabled="@((string.IsNullOrWhiteSpace(CurrentInput) && !UploadedDocuments.Any()) || isDisabled || (SelectedAgentType == 3 && string.IsNullOrWhiteSpace(ClientId)))"
  101. aria-label="Envoyer le message">
  102. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  103. <path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5" />
  104. </svg>
  105. </button>
  106. </div>
  107. </div>
  108. </div>
  109. <!-- Cartes des agents -->
  110. <div class="agents-grid">
  111. <label class="agent-card @(SelectedAgentType == 1 ? "selected" : "")" for="agent1">
  112. <input type="radio"
  113. id="agent1"
  114. name="agentType"
  115. value="1"
  116. checked="@(SelectedAgentType == 1)"
  117. @onchange="() => SelectAgent(1)" />
  118. <div class="agent-icon">
  119. <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" fill="currentColor" viewBox="0 0 16 16">
  120. <path d="M12.146.146a.5.5 0 0 1 .708 0l3 3a.5.5 0 0 1 0 .708l-10 10a.5.5 0 0 1-.168.11l-5 2a.5.5 0 0 1-.65-.65l2-5a.5.5 0 0 1 .11-.168zM11.207 2.5 13.5 4.793 14.793 3.5 12.5 1.207zm1.586 3L10.5 3.207 4 9.707V10h.5a.5.5 0 0 1 .5.5v.5h.5a.5.5 0 0 1 .5.5v.5h.293zm-9.761 5.175-.106.106-1.528 3.821 3.821-1.528.106-.106A.5.5 0 0 1 5 12.5V12h-.5a.5.5 0 0 1-.5-.5V11h-.5a.5.5 0 0 1-.468-.325" />
  121. </svg>
  122. </div>
  123. <div class="agent-content">
  124. <h3 class="agent-name">conversation</h3>
  125. <p class="agent-description">
  126. Discutez avec un agent IA ayant une bonne connaissance de votre secteur d'activité
  127. </p>
  128. </div>
  129. <div class="agent-check">
  130. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
  131. <path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z" />
  132. </svg>
  133. </div>
  134. </label>
  135. <label class="agent-card @(SelectedAgentType == 2 ? "selected" : "")" for="agent2">
  136. <input type="radio"
  137. id="agent2"
  138. name="agentType"
  139. value="2"
  140. checked="@(SelectedAgentType == 2)"
  141. @onchange="() => SelectAgent(2)" />
  142. <div class="agent-icon">
  143. <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" fill="currentColor" viewBox="0 0 16 16">
  144. <path fill-rule="evenodd" d="M5 11.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5m0-4a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 0 1h-9a.5.5 0 0 1-.5-.5M3.854 2.146a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708L2 3.293l1.146-1.147a.5.5 0 0 1 .708 0m0 4a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 1 1 .708-.708L2 7.293l1.146-1.147a.5.5 0 0 1 .708 0m0 4a.5.5 0 0 1 0 .708l-1.5 1.5a.5.5 0 0 1-.708 0l-.5-.5a.5.5 0 0 1 .708-.708l.146.147 1.146-1.147a.5.5 0 0 1 .708 0" />
  145. </svg>
  146. </div>
  147. <div class="agent-content">
  148. <h3 class="agent-name">Agent RAG</h3>
  149. <p class="agent-description">
  150. un agent possédant une excellente connaissance de votre base documentaire
  151. </p>
  152. </div>
  153. <div class="agent-check">
  154. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
  155. <path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z" />
  156. </svg>
  157. </div>
  158. </label>
  159. <label class="agent-card @(SelectedAgentType == 3 ? "selected" : "")" for="agent3">
  160. <input type="radio"
  161. id="agent3"
  162. name="agentType"
  163. value="3"
  164. checked="@(SelectedAgentType == 3)"
  165. @onchange="() => SelectAgent(3)" />
  166. <div class="agent-icon">
  167. <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" fill="currentColor" viewBox="0 0 16 16">
  168. <path fill-rule="evenodd" d="M10.854 6.146a.5.5 0 0 1 0 .708l-3 3a.5.5 0 0 1-.708 0l-1.5-1.5a.5.5 0 1 1 .708-.708L7.5 8.793l2.646-2.647a.5.5 0 0 1 .708 0" />
  169. <path d="M3 0h10a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2v-1h1v1a1 1 0 0 0 1 1h10a1 1 0 0 0 1-1V2a1 1 0 0 0-1-1H3a1 1 0 0 0-1 1v1H1V2a2 2 0 0 1 2-2" />
  170. <path d="M1 5v-.5a.5.5 0 0 1 1 0V5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1zm0 3v-.5a.5.5 0 0 1 1 0V8h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1zm0 3v-.5a.5.5 0 0 1 1 0v.5h.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1 0-1z" />
  171. </svg>
  172. </div>
  173. <div class="agent-content">
  174. <h3 class="agent-name">L'agent Audit</h3>
  175. <p class="agent-description">
  176. Un agent IA spécialisé dans l'étude de vos documents et dans la réalisation d'audit financier
  177. </p>
  178. </div>
  179. <div class="agent-check">
  180. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
  181. <path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z" />
  182. </svg>
  183. </div>
  184. </label>
  185. <label class="agent-card @(SelectedAgentType == 4 ? "selected" : "")" for="agent4">
  186. <input type="radio"
  187. id="agent4"
  188. name="agentType"
  189. value="4"
  190. checked="@(SelectedAgentType == 4)"
  191. @onchange="() => SelectAgent(4)" />
  192. <div class="agent-icon">
  193. <svg xmlns="http://www.w3.org/2000/svg" width="26" height="26" fill="currentColor" viewBox="0 0 16 16">
  194. <path d="M.05 3.555A2 2 0 0 1 2 2h12a2 2 0 0 1 1.95 1.555L8 8.414zM0 4.697v7.104l5.803-3.558zM6.761 8.83l-6.57 4.027A2 2 0 0 0 2 14h12a2 2 0 0 0 1.808-1.144l-6.57-4.027L8 9.586zm3.436-.586L16 11.801V4.697z" />
  195. </svg>
  196. </div>
  197. <div class="agent-content">
  198. <h3 class="agent-name">L'agent mail spécialisé</h3>
  199. <p class="agent-description">
  200. un agent IA spécialisé dans le traitement de vos mails avec une approche humaine et experte
  201. </p>
  202. </div>
  203. <div class="agent-check">
  204. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
  205. <path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425z" />
  206. </svg>
  207. </div>
  208. </label>
  209. </div>
  210. </div>
  211. </div>
  212. </div>
  213. }
  214. else
  215. {
  216. <!-- Vue ChatRoom -->
  217. <div class="chatroom-container">
  218. <!-- Zone de messages -->
  219. <div class="chatroom-messages">
  220. @if (SelectedConversation == null || !Messages.Any())
  221. {
  222. <div class="chatroom-empty">
  223. <div class="empty-icon">💬</div>
  224. <h3>Commencez une conversation</h3>
  225. <p>Tapez votre premier message ci-dessous</p>
  226. </div>
  227. }
  228. else
  229. {
  230. @foreach (var msg in Messages)
  231. {
  232. <div class="message-row @(msg.IsUser ? "user" : "assistant")">
  233. <div class="avatar @(msg.IsUser ? "avatar-user" : "avatar-assistant")">
  234. @if (msg.IsUser)
  235. {
  236. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
  237. <path d="M8 8a3 3 0 1 0 0-6 3 3 0 0 0 0 6m2-3a2 2 0 1 1-4 0 2 2 0 0 1 4 0m4 8c0 1-1 1-1 1H3s-1 0-1-1 1-4 6-4 6 3 6 4m-1-.004c-.001-.246-.154-.986-.832-1.664C11.516 10.68 10.289 10 8 10s-3.516.68-4.168 1.332c-.678.678-.83 1.418-.832 1.664z" />
  238. </svg>
  239. }
  240. else
  241. {
  242. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
  243. <path d="M6 12.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5M3 8.062C3 6.76 4.235 5.765 5.53 5.886a26.6 26.6 0 0 0 4.94 0C11.765 5.765 13 6.76 13 8.062v1.157a.93.93 0 0 1-.765.935c-.845.147-2.34.346-4.235.346s-3.39-.2-4.235-.346A.93.93 0 0 1 3 9.219zm4.542-.827a.25.25 0 0 0-.217.068l-.92.9a25 25 0 0 1-1.871-.183.25.25 0 0 0-.068.495c.55.076 1.232.149 2.02.193a.25.25 0 0 0 .189-.071l.754-.736.847 1.71a.25.25 0 0 0 .404.062l.932-.97a25 25 0 0 0 1.922-.188.25.25 0 0 0-.068-.495c-.538.074-1.207.145-1.98.189a.25.25 0 0 0-.166.076l-.754.785-.842-1.7a.25.25 0 0 0-.182-.135" />
  244. <path d="M8.5 1.866a1 1 0 1 0-1 0V3h-2A4.5 4.5 0 0 0 1 7.5V8a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1v1a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1v-.5A4.5 4.5 0 0 0 10.5 3h-2zM14 7.5V13a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7.5A3.5 3.5 0 0 1 5.5 4h5A3.5 3.5 0 0 1 14 7.5" />
  245. </svg>
  246. }
  247. </div>
  248. <div class="message-content-wrapper">
  249. <div class="bubble @(msg.IsUser ? "bubble-user" : "bubble-assistant")">
  250. @msg.Text
  251. </div>
  252. @if (!msg.IsUser)
  253. {
  254. <div class="message-actions">
  255. <button class="btn-message-action" @onclick="() => CopyMessage(msg.Text)" title="Copier">
  256. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  257. <path d="M4 1.5H3a2 2 0 0 0-2 2V14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V3.5a2 2 0 0 0-2-2h-1v1h1a1 1 0 0 1 1 1V14a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V3.5a1 1 0 0 1 1-1h1z" />
  258. <path d="M9.5 1a.5.5 0 0 1 .5.5v1a.5.5 0 0 1-.5.5h-3a.5.5 0 0 1-.5-.5v-1a.5.5 0 0 1 .5-.5zm-3-1A1.5 1.5 0 0 0 5 1.5v1A1.5 1.5 0 0 0 6.5 4h3A1.5 1.5 0 0 0 11 2.5v-1A1.5 1.5 0 0 0 9.5 0z" />
  259. </svg>
  260. </button>
  261. </div>
  262. }
  263. </div>
  264. </div>
  265. }
  266. @if (isTyping)
  267. {
  268. <div class="message-row assistant">
  269. <div class="avatar avatar-assistant">
  270. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
  271. <path d="M6 12.5a.5.5 0 0 1 .5-.5h3a.5.5 0 0 1 0 1h-3a.5.5 0 0 1-.5-.5M3 8.062C3 6.76 4.235 5.765 5.53 5.886a26.6 26.6 0 0 0 4.94 0C11.765 5.765 13 6.76 13 8.062v1.157a.93.93 0 0 1-.765.935c-.845.147-2.34.346-4.235.346s-3.39-.2-4.235-.346A.93.93 0 0 1 3 9.219zm4.542-.827a.25.25 0 0 0-.217.068l-.92.9a25 25 0 0 1-1.871-.183.25.25 0 0 0-.068.495c.55.076 1.232.149 2.02.193a.25.25 0 0 0 .189-.071l.754-.736.847 1.71a.25.25 0 0 0 .404.062l.932-.97a25 25 0 0 0 1.922-.188.25.25 0 0 0-.068-.495c-.538.074-1.207.145-1.98.189a.25.25 0 0 0-.166.076l-.754.785-.842-1.7a.25.25 0 0 0-.182-.135" />
  272. <path d="M8.5 1.866a1 1 0 1 0-1 0V3h-2A4.5 4.5 0 0 0 1 7.5V8a1 1 0 0 0-1 1v2a1 1 0 0 0 1 1v1a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2v-1a1 1 0 0 0 1-1V9a1 1 0 0 0-1-1v-.5A4.5 4.5 0 0 0 10.5 3h-2zM14 7.5V13a1 1 0 0 1-1 1H3a1 1 0 0 1-1-1V7.5A3.5 3.5 0 0 1 5.5 4h5A3.5 3.5 0 0 1 14 7.5" />
  273. </svg>
  274. </div>
  275. <div class="message-content-wrapper">
  276. <div class="bubble bubble-assistant">
  277. <div class="typing-indicator">
  278. <span></span>
  279. <span></span>
  280. <span></span>
  281. </div>
  282. </div>
  283. </div>
  284. </div>
  285. }
  286. }
  287. </div>
  288. <!-- Zone de saisie moderne -->
  289. <div class="chat-input-container">
  290. <!-- Fichiers attachés -->
  291. @if (UploadedDocuments.Any())
  292. {
  293. <div class="attached-files">
  294. @foreach (var doc in UploadedDocuments)
  295. {
  296. <div class="file-item">
  297. <div class="file-preview">
  298. <div class="file-icon">
  299. <svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 16 16">
  300. <path d="M14 4.5V14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V2a2 2 0 0 1 2-2h5.5zm-3 0A1.5 1.5 0 0 1 9.5 3V1H4a1 1 0 0 0-1 1v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1V4.5z" />
  301. </svg>
  302. </div>
  303. </div>
  304. <div class="file-info">
  305. <span class="file-name">@doc.FileName</span>
  306. <span class="file-size">@FormatFileSize(doc.Bytes.Length)</span>
  307. </div>
  308. <button class="remove-file-button" @onclick="() => RemoveDocument(doc)" aria-label="Supprimer le fichier">
  309. <svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" fill="currentColor" viewBox="0 0 16 16">
  310. <path d="M2.146 2.854a.5.5 0 1 1 .708-.708L8 7.293l5.146-5.147a.5.5 0 0 1 .708.708L8.707 8l5.147 5.146a.5.5 0 0 1-.708.708L8 8.707l-5.146 5.147a.5.5 0 0 1-.708-.708L7.293 8z" />
  311. </svg>
  312. </button>
  313. </div>
  314. }
  315. </div>
  316. }
  317. <!-- Input wrapper -->
  318. <div class="input-wrapper @(UploadedDocuments.Any() ? "has-files" : "")">
  319. <textarea id="chatroomTextarea"
  320. @bind="CurrentInput"
  321. @oninput="OnChatroomTextareaInput"
  322. @onkeydown="HandleKeyPress"
  323. placeholder="Nouvelle conversation..."
  324. rows="1"></textarea>
  325. <div class="actions-row">
  326. <!-- Bouton attachement -->
  327. <label class="attach-button" for="fileUpload">
  328. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  329. <path d="M4.5 3a2.5 2.5 0 0 1 5 0v9a1.5 1.5 0 0 1-3 0V5a.5.5 0 0 1 1 0v7a.5.5 0 0 0 1 0V3a1.5 1.5 0 1 0-3 0v9a2.5 2.5 0 0 0 5 0V5a.5.5 0 0 1 1 0v7a3.5 3.5 0 1 1-7 0z" />
  330. </svg>
  331. <span>Importer un fichier</span>
  332. <InputFile id="fileUpload" OnChange="UploadDocuments" multiple style="display: none;" />
  333. </label>
  334. <div class="right-actions">
  335. <!-- Sélecteur de domaine RAG -->
  336. @if (!hiddenDomain && RagDomains.Any())
  337. {
  338. <select class="domain-select" @bind="SelectedDomain">
  339. @foreach (var domain in RagDomains)
  340. {
  341. <option value="@domain">@domain</option>
  342. }
  343. </select>
  344. }
  345. @* Input ID Client pour AUDIT *@
  346. @if (TypeLLM == 3)
  347. {
  348. <input type="text"
  349. class="client-id-input"
  350. @bind="ClientId"
  351. placeholder="ID Client"
  352. aria-label="ID Client" />
  353. }
  354. <!-- Bouton historique -->
  355. <button class="history-button @(IsWithHistorique ? "active" : "desactive")" @onclick="ToggleHistory" title="@(IsWithHistorique ? "Historique activé" : "Historique désactivé")">
  356. <svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" fill="currentColor" viewBox="0 0 16 16">
  357. <path d="M8.515 1.019A7 7 0 0 0 8 1V0a8 8 0 0 1 .589.022zm2.004.45a7 7 0 0 0-.985-.299l.219-.976q.576.129 1.126.342zm1.37.71a7 7 0 0 0-.439-.27l.493-.87a8 8 0 0 1 .979.654l-.615.789a7 7 0 0 0-.418-.302zm1.834 1.79a7 7 0 0 0-.653-.796l.724-.69q.406.429.747.91zm.744 1.352a7 7 0 0 0-.214-.468l.893-.45a8 8 0 0 1 .45 1.088l-.95.313a7 7 0 0 0-.179-.483m.53 2.507a7 7 0 0 0-.1-1.025l.985-.17q.1.58.116 1.17zm-.131 1.538q.05-.254.081-.51l.993.123a8 8 0 0 1-.23 1.155l-.964-.267q.069-.247.12-.501m-.952 2.379q.276-.436.486-.908l.914.405q-.24.54-.555 1.038zm-.964 1.205q.183-.183.35-.378l.758.653a8 8 0 0 1-.401.432z" />
  358. <path d="M8 1a7 7 0 1 0 4.95 11.95l.707.707A8.001 8.001 0 1 1 8 0z" />
  359. <path d="M7.5 3a.5.5 0 0 1 .5.5v5.21l3.248 1.856a.5.5 0 0 1-.496.868l-3.5-2A.5.5 0 0 1 7 9V3.5a.5.5 0 0 1 .5-.5" />
  360. </svg>
  361. </button>
  362. <button class="voice-button" @onclick="RecordVoice" aria-label="Message vocal">
  363. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  364. <path fill-rule="evenodd" d="M8.5 2a.5.5 0 0 1 .5.5v11a.5.5 0 0 1-1 0v-11a.5.5 0 0 1 .5-.5m-2 2a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5m4 0a.5.5 0 0 1 .5.5v7a.5.5 0 0 1-1 0v-7a.5.5 0 0 1 .5-.5m-6 1.5A.5.5 0 0 1 5 6v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m8 0a.5.5 0 0 1 .5.5v4a.5.5 0 0 1-1 0V6a.5.5 0 0 1 .5-.5m-10 1A.5.5 0 0 1 3 7v2a.5.5 0 0 1-1 0V7a.5.5 0 0 1 .5-.5m12 0a.5.5 0 0 1 .5.5v2a.5.5 0 0 1-1 0V7a.5.5 0 0 1 .5-.5" />
  365. </svg>
  366. </button>
  367. <!-- Bouton envoyer -->
  368. <button class="send-button"
  369. @onclick="SendMessage"
  370. disabled="@((string.IsNullOrWhiteSpace(CurrentInput) && !UploadedDocuments.Any()) || (TypeLLM == 3 && string.IsNullOrWhiteSpace(ClientId)))"
  371. aria-label="Envoyer le message">
  372. <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" viewBox="0 0 16 16">
  373. <path fill-rule="evenodd" d="M8 15a.5.5 0 0 0 .5-.5V2.707l3.146 3.147a.5.5 0 0 0 .708-.708l-4-4a.5.5 0 0 0-.708 0l-4 4a.5.5 0 1 0 .708.708L7.5 2.707V14.5a.5.5 0 0 0 .5.5" />
  374. </svg>
  375. </button>
  376. </div>
  377. </div>
  378. </div>
  379. </div>
  380. </div>
  381. }