No Description
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.

ai-response.component.scss 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383
  1. :host {
  2. display: block;
  3. height: 100%;
  4. }
  5. .ai-response-container {
  6. display: flex;
  7. flex-direction: column;
  8. height: 100%;
  9. background: var(--mat-app-background-color, #f5f5f5);
  10. border-radius: 8px;
  11. overflow: hidden;
  12. box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  13. }
  14. /* 头部工具栏 */
  15. .header-toolbar {
  16. display: flex;
  17. justify-content: space-between;
  18. align-items: center;
  19. padding: 12px 16px;
  20. background: white;
  21. border-bottom: 1px solid var(--mat-divider-color, #e0e0e0);
  22. min-height: 56px;
  23. box-sizing: border-box;
  24. }
  25. .session-info {
  26. display: flex;
  27. align-items: center;
  28. gap: 12px;
  29. flex-wrap: wrap;
  30. }
  31. .type-indicator {
  32. display: flex;
  33. align-items: center;
  34. gap: 6px;
  35. padding: 4px 10px;
  36. border-radius: 16px;
  37. color: white;
  38. font-size: 12px;
  39. font-weight: 500;
  40. }
  41. .type-icon {
  42. font-size: 16px;
  43. width: 16px;
  44. height: 16px;
  45. line-height: 16px;
  46. }
  47. .type-label {
  48. line-height: 1;
  49. }
  50. .session-id, .timestamp, .empty-state {
  51. display: flex;
  52. align-items: center;
  53. gap: 6px;
  54. font-size: 12px;
  55. color: var(--mat-secondary-text-color, #666);
  56. }
  57. .empty-state {
  58. font-size: 14px;
  59. color: var(--mat-primary-text-color, #333);
  60. mat-icon {
  61. color: var(--mat-primary-color, #3f51b5);
  62. }
  63. }
  64. .toolbar-actions {
  65. display: flex;
  66. gap: 4px;
  67. }
  68. /* 内容区域 */
  69. .content-area {
  70. flex: 1;
  71. overflow: auto;
  72. padding: 16px;
  73. background: white;
  74. transition: all 0.3s ease;
  75. &.streaming {
  76. background: linear-gradient(135deg, #f9f9ff 0%, #f0f8ff 100%);
  77. }
  78. &.collapsed {
  79. max-height: 200px;
  80. overflow: hidden;
  81. position: relative;
  82. &::after {
  83. content: '';
  84. position: absolute;
  85. bottom: 0;
  86. left: 0;
  87. right: 0;
  88. height: 60px;
  89. background: linear-gradient(to bottom, transparent, white);
  90. pointer-events: none;
  91. }
  92. }
  93. }
  94. .content-wrapper {
  95. min-height: 100%;
  96. }
  97. .response-content {
  98. font-size: 14px;
  99. line-height: 1.6;
  100. color: var(--mat-primary-text-color, #333);
  101. // Markdown样式增强
  102. ::ng-deep {
  103. h1, h2, h3, h4 {
  104. margin-top: 1.2em;
  105. margin-bottom: 0.6em;
  106. color: var(--mat-primary-color, #3f51b5);
  107. }
  108. code {
  109. background: var(--mat-app-background-color, #f5f5f5);
  110. padding: 2px 6px;
  111. border-radius: 4px;
  112. font-family: 'Courier New', monospace;
  113. font-size: 0.9em;
  114. }
  115. pre {
  116. background: #1e1e1e;
  117. color: #d4d4d4;
  118. padding: 16px;
  119. border-radius: 6px;
  120. overflow: auto;
  121. margin: 1em 0;
  122. code {
  123. background: transparent;
  124. padding: 0;
  125. border-radius: 0;
  126. font-size: 0.9em;
  127. line-height: 1.5;
  128. }
  129. }
  130. blockquote {
  131. border-left: 4px solid var(--mat-primary-color, #3f51b5);
  132. margin: 1em 0;
  133. padding-left: 1em;
  134. color: var(--mat-secondary-text-color, #666);
  135. font-style: italic;
  136. }
  137. ul, ol {
  138. padding-left: 1.5em;
  139. margin: 0.5em 0;
  140. }
  141. table {
  142. border-collapse: collapse;
  143. width: 100%;
  144. margin: 1em 0;
  145. th, td {
  146. border: 1px solid var(--mat-divider-color, #e0e0e0);
  147. padding: 8px 12px;
  148. text-align: left;
  149. }
  150. th {
  151. background: var(--mat-app-background-color, #f5f5f5);
  152. font-weight: 600;
  153. }
  154. }
  155. }
  156. }
  157. .streaming-indicator {
  158. margin-top: 20px;
  159. padding: 12px;
  160. background: rgba(33, 150, 243, 0.05);
  161. border-radius: 8px;
  162. border: 1px solid rgba(33, 150, 243, 0.2);
  163. .streaming-text {
  164. display: flex;
  165. align-items: center;
  166. gap: 8px;
  167. margin-top: 8px;
  168. font-size: 12px;
  169. color: var(--mat-primary-color, #3f51b5);
  170. mat-icon {
  171. font-size: 16px;
  172. width: 16px;
  173. height: 16px;
  174. line-height: 16px;
  175. animation: pulse 1.5s infinite;
  176. }
  177. }
  178. }
  179. @keyframes pulse {
  180. 0%, 100% { opacity: 1; }
  181. 50% { opacity: 0.5; }
  182. }
  183. .response-complete {
  184. display: flex;
  185. align-items: center;
  186. gap: 8px;
  187. margin-top: 20px;
  188. padding: 8px 12px;
  189. background: rgba(76, 175, 80, 0.1);
  190. border-radius: 8px;
  191. color: #2e7d32;
  192. font-size: 13px;
  193. mat-icon {
  194. color: #2e7d32;
  195. font-size: 16px;
  196. width: 16px;
  197. height: 16px;
  198. line-height: 16px;
  199. }
  200. }
  201. .no-response {
  202. display: flex;
  203. flex-direction: column;
  204. align-items: center;
  205. justify-content: center;
  206. height: 100%;
  207. color: var(--mat-secondary-text-color, #666);
  208. text-align: center;
  209. .empty-icon {
  210. font-size: 48px;
  211. width: 48px;
  212. height: 48px;
  213. line-height: 48px;
  214. margin-bottom: 16px;
  215. color: var(--mat-primary-color, #3f51b5);
  216. opacity: 0.3;
  217. }
  218. .hint {
  219. font-size: 12px;
  220. margin-top: 4px;
  221. color: var(--mat-secondary-text-color, #888);
  222. }
  223. }
  224. /* 响应历史 */
  225. .response-history {
  226. border-top: 1px solid var(--mat-divider-color, #e0e0e0);
  227. background: var(--mat-app-background-color, #f5f5f5);
  228. max-height: 200px;
  229. overflow: auto;
  230. }
  231. .history-header {
  232. display: flex;
  233. align-items: center;
  234. gap: 8px;
  235. padding: 12px 16px;
  236. font-size: 12px;
  237. font-weight: 500;
  238. color: var(--mat-secondary-text-color, #666);
  239. background: rgba(0, 0, 0, 0.02);
  240. border-bottom: 1px solid var(--mat-divider-color, #e0e0e0);
  241. }
  242. .history-list {
  243. padding: 8px;
  244. }
  245. .history-item {
  246. display: flex;
  247. align-items: center;
  248. gap: 10px;
  249. padding: 8px 12px;
  250. background: white;
  251. border-radius: 6px;
  252. margin-bottom: 6px;
  253. cursor: pointer;
  254. border-left: 3px solid;
  255. transition: all 0.2s ease;
  256. &:hover {
  257. background: var(--mat-app-background-color, #f5f5f5);
  258. transform: translateX(2px);
  259. }
  260. &:active {
  261. transform: translateX(0);
  262. }
  263. }
  264. .history-type-icon {
  265. display: flex;
  266. align-items: center;
  267. justify-content: center;
  268. width: 24px;
  269. height: 24px;
  270. border-radius: 50%;
  271. background: currentColor;
  272. opacity: 0.2;
  273. mat-icon {
  274. font-size: 16px;
  275. width: 16px;
  276. height: 16px;
  277. line-height: 16px;
  278. color: white;
  279. }
  280. }
  281. .history-content {
  282. flex: 1;
  283. overflow: hidden;
  284. }
  285. .history-session {
  286. font-size: 10px;
  287. color: var(--mat-secondary-text-color, #888);
  288. margin-bottom: 2px;
  289. }
  290. .history-preview {
  291. font-size: 11px;
  292. color: var(--mat-primary-text-color, #444);
  293. white-space: nowrap;
  294. overflow: hidden;
  295. text-overflow: ellipsis;
  296. }
  297. .history-time {
  298. font-size: 10px;
  299. color: var(--mat-secondary-text-color, #888);
  300. white-space: nowrap;
  301. }
  302. /* 滚动条样式 */
  303. ::-webkit-scrollbar {
  304. width: 6px;
  305. height: 6px;
  306. }
  307. ::-webkit-scrollbar-track {
  308. background: transparent;
  309. }
  310. ::-webkit-scrollbar-thumb {
  311. background: var(--mat-divider-color, #ccc);
  312. border-radius: 3px;
  313. }
  314. ::-webkit-scrollbar-thumb:hover {
  315. background: var(--mat-secondary-text-color, #999);
  316. }
  317. /* 响应式设计 */
  318. @media (max-width: 768px) {
  319. .header-toolbar {
  320. flex-direction: column;
  321. align-items: stretch;
  322. gap: 8px;
  323. }
  324. .session-info {
  325. justify-content: space-between;
  326. }
  327. .toolbar-actions {
  328. align-self: flex-end;
  329. }
  330. }