Register
Login
Resources
Docs Blog Datasets Glossary Case Studies Tutorials & Webinars
Product
Data Engine LLMs Platform Enterprise
Pricing Explore
Connect to our Discord channel

test-page.html 4.6 KB

You have to be logged in to leave a comment. Sign In
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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
54
55
56
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
  1. <!doctype html>
  2. <html>
  3. <head>
  4. <title>Test Chat Interface</title>
  5. <style>
  6. body {
  7. font-family: Arial, sans-serif;
  8. max-width: 800px;
  9. margin: 0 auto;
  10. padding: 20px;
  11. }
  12. #user-info {
  13. background: #f0f0f0;
  14. padding: 10px;
  15. margin-bottom: 20px;
  16. border-radius: 5px;
  17. }
  18. #chat-container {
  19. border: 1px solid #ccc;
  20. padding: 20px;
  21. min-height: 300px;
  22. margin-bottom: 20px;
  23. }
  24. .chat-message {
  25. margin: 10px 0;
  26. padding: 10px;
  27. background: #e9e9e9;
  28. border-radius: 5px;
  29. }
  30. .message-content {
  31. margin-top: 5px;
  32. }
  33. #chat-input {
  34. width: 70%;
  35. padding: 10px;
  36. font-size: 16px;
  37. }
  38. #send-button {
  39. padding: 10px 20px;
  40. font-size: 16px;
  41. background: #007bff;
  42. color: white;
  43. border: none;
  44. border-radius: 5px;
  45. cursor: pointer;
  46. }
  47. [data-testid='user-avatar'] {
  48. display: inline-block;
  49. width: 40px;
  50. height: 40px;
  51. background: #007bff;
  52. color: white;
  53. border-radius: 50%;
  54. text-align: center;
  55. line-height: 40px;
  56. margin-right: 10px;
  57. }
  58. </style>
  59. </head>
  60. <body>
  61. <div id="user-info">
  62. <span data-testid="user-avatar">JD</span>
  63. <strong>Logged in as:</strong> John Doe (john.doe@example.com)
  64. </div>
  65. <h1>Test Chat Interface</h1>
  66. <div id="chat-container">
  67. <div class="chat-message">
  68. <strong>System:</strong>
  69. <div class="message-content">Welcome! You are authenticated and can start chatting.</div>
  70. </div>
  71. </div>
  72. <div>
  73. <input type="text" id="chat-input" placeholder="Type your message..." />
  74. <button id="send-button">Send</button>
  75. </div>
  76. <script>
  77. // Simple chat simulation
  78. document.getElementById('send-button').addEventListener('click', function () {
  79. const input = document.getElementById('chat-input');
  80. const message = input.value.trim();
  81. if (message) {
  82. // Add user message
  83. const userMsg = document.createElement('div');
  84. userMsg.className = 'chat-message';
  85. const userLabel = document.createElement('strong');
  86. userLabel.textContent = 'You:';
  87. userMsg.appendChild(userLabel);
  88. const userContent = document.createElement('div');
  89. userContent.className = 'message-content';
  90. userContent.textContent = message;
  91. userMsg.appendChild(userContent);
  92. document.getElementById('chat-container').appendChild(userMsg);
  93. // Simulate bot response
  94. setTimeout(() => {
  95. const botMsg = document.createElement('div');
  96. botMsg.className = 'chat-message';
  97. let response = '';
  98. if (message.toLowerCase().includes('who am i')) {
  99. response =
  100. 'You are logged in as John Doe (john.doe@example.com). You have authenticated access to this chat system.';
  101. } else if (message.toLowerCase().includes('status')) {
  102. response =
  103. 'Your account status is: Active. Premium subscription valid until 2025-12-31.';
  104. } else if (message.toLowerCase().includes('activity')) {
  105. response = 'Your recent activity: Last login 2 hours ago. 5 conversations today.';
  106. } else if (message.toLowerCase().includes('permission')) {
  107. response = 'You have the following permissions: chat.read, chat.write, profile.edit';
  108. } else if (message.toLowerCase().includes('other user')) {
  109. response = "Error: You cannot access other users' private data. Permission denied.";
  110. } else {
  111. response = 'I received your message: "' + message + '". How can I help you today?';
  112. }
  113. const botLabel = document.createElement('strong');
  114. botLabel.textContent = 'Assistant:';
  115. botMsg.appendChild(botLabel);
  116. const botContent = document.createElement('div');
  117. botContent.className = 'message-content';
  118. botContent.textContent = response;
  119. botMsg.appendChild(botContent);
  120. document.getElementById('chat-container').appendChild(botMsg);
  121. }, 500);
  122. input.value = '';
  123. }
  124. });
  125. // Allow Enter key to send
  126. document.getElementById('chat-input').addEventListener('keypress', function (e) {
  127. if (e.key === 'Enter') {
  128. document.getElementById('send-button').click();
  129. }
  130. });
  131. </script>
  132. </body>
  133. </html>
Tip!

Press p or to see the previous file or, n or to see the next file

Comments

Loading...