Undi95 commited on
Commit
3355090
·
verified ·
1 Parent(s): 100638b

Upload JVCGPT.html

Browse files
Files changed (1) hide show
  1. JVCGPT.html +60 -59
JVCGPT.html CHANGED
@@ -74,11 +74,12 @@
74
  font-size: 1em;
75
  color: #d3d3d3;
76
  word-wrap: break-word;
 
77
  }
78
  .post-content img {
79
  width: 75px;
80
  height: 50px;
81
- display: block;
82
  margin: 10px 0;
83
  }
84
  footer {
@@ -118,7 +119,7 @@
118
  <body>
119
 
120
  <header>
121
- <h1>JVCGPT</h1>
122
  </header>
123
 
124
  <div class="container">
@@ -134,7 +135,7 @@
134
  </div>
135
 
136
  <footer>
137
- <p>JVCGPT - Faux Forum simulé par IA</p>
138
  </footer>
139
 
140
  <script>
@@ -144,68 +145,68 @@
144
  postsContainer.innerHTML = ''; // Clear previous posts
145
 
146
  const blocks = logs.split('<|eot_id|>');
147
- let topicTitle = '';
148
 
149
  blocks.forEach(block => {
150
- if (block.includes('<|start_header_id|>system<|end_header_id|>')) {
151
  const titleMatch = block.match(/Sujet : "(.*?)"/);
152
  if (titleMatch) {
153
- topicTitle = titleMatch[1];
154
- document.getElementById('topic-title').textContent = topicTitle;
155
  }
156
- } else {
157
- const pseudoMatch = block.match(/<\|im_pseudo\|>(.*?)<\|end_pseudo\|>/);
158
- const dateMatch = block.match(/<\|im_date\|>(.*?)<\|end_date\|>/);
159
- const postMatch = block.match(/<\|begin_of_post\|>([\s\S]*?)<\|end_of_post\|>/);
160
-
161
- if (pseudoMatch && dateMatch && postMatch) {
162
- const username = pseudoMatch[1];
163
- const date = dateMatch[1];
164
- const message = postMatch[1];
165
-
166
- const postDiv = document.createElement('div');
167
- postDiv.className = 'post';
168
-
169
- const avatarDiv = document.createElement('div');
170
- avatarDiv.className = 'avatar';
171
- const avatarImg = document.createElement('img');
172
- avatarImg.src = 'https://image.jeuxvideo.com/avatar-md/default.jpg';
173
- avatarDiv.appendChild(avatarImg);
174
-
175
- const contentWrapper = document.createElement('div');
176
- contentWrapper.className = 'post-content-wrapper';
177
-
178
- const metaDiv = document.createElement('div');
179
- metaDiv.className = 'post-meta';
180
-
181
- const usernameDiv = document.createElement('div');
182
- usernameDiv.textContent = username;
183
- usernameDiv.className = 'username';
184
- if (block.includes('<|start_header_id|>user<|end_header_id|>')) {
185
- usernameDiv.classList.add('author');
186
- }
187
- metaDiv.appendChild(usernameDiv);
188
-
189
- const dateDiv = document.createElement('div');
190
- dateDiv.textContent = date;
191
- dateDiv.className = 'date';
192
- metaDiv.appendChild(dateDiv);
193
-
194
- const contentDiv = document.createElement('div');
195
- contentDiv.className = 'post-content';
196
-
197
- const formattedMessage = message.replace(/https?:\/\/image\.noelshack\.com\/[^\s]+/g, (url) => {
198
- return `<img src="${url}" alt="Image">`;
199
- });
200
- contentDiv.innerHTML = formattedMessage;
201
-
202
- contentWrapper.appendChild(metaDiv);
203
- contentWrapper.appendChild(contentDiv);
204
-
205
- postDiv.appendChild(avatarDiv);
206
- postDiv.appendChild(contentWrapper);
207
- postsContainer.appendChild(postDiv);
208
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  }
210
  });
211
  }
 
74
  font-size: 1em;
75
  color: #d3d3d3;
76
  word-wrap: break-word;
77
+ white-space: pre-wrap; /* Permet les retours à la ligne */
78
  }
79
  .post-content img {
80
  width: 75px;
81
  height: 50px;
82
+ display: inline; /* Ne pas forcer un retour à la ligne pour les images */
83
  margin: 10px 0;
84
  }
85
  footer {
 
119
  <body>
120
 
121
  <header>
122
+ <h1>JVCGPT - Faux Forum</h1>
123
  </header>
124
 
125
  <div class="container">
 
135
  </div>
136
 
137
  <footer>
138
+ <p>JVCGPT - Faux Forum simulé pour usage personnel</p>
139
  </footer>
140
 
141
  <script>
 
145
  postsContainer.innerHTML = ''; // Clear previous posts
146
 
147
  const blocks = logs.split('<|eot_id|>');
148
+ let topicTitleSet = false; // Ensure the topic title is set only once
149
 
150
  blocks.forEach(block => {
151
+ if (!topicTitleSet && block.includes('<|start_header_id|><|khey|><|end_header_id|>')) {
152
  const titleMatch = block.match(/Sujet : "(.*?)"/);
153
  if (titleMatch) {
154
+ document.getElementById('topic-title').textContent = titleMatch[1];
155
+ topicTitleSet = true;
156
  }
157
+ }
158
+
159
+ const pseudoMatch = block.match(/<\|im_pseudo\|>(.*?)<\|end_pseudo\|>/);
160
+ const dateMatch = block.match(/<\|im_date\|>(.*?)<\|end_date\|>/);
161
+ const postMatch = block.match(/<\|begin_of_post\|>([\s\S]*?)<\|end_of_post\|>/);
162
+
163
+ if (pseudoMatch && dateMatch && postMatch) {
164
+ const username = pseudoMatch[1];
165
+ const date = dateMatch[1];
166
+ const message = postMatch[1];
167
+
168
+ const postDiv = document.createElement('div');
169
+ postDiv.className = 'post';
170
+
171
+ const avatarDiv = document.createElement('div');
172
+ avatarDiv.className = 'avatar';
173
+ const avatarImg = document.createElement('img');
174
+ avatarImg.src = 'https://image.jeuxvideo.com/avatar-md/default.jpg';
175
+ avatarDiv.appendChild(avatarImg);
176
+
177
+ const contentWrapper = document.createElement('div');
178
+ contentWrapper.className = 'post-content-wrapper';
179
+
180
+ const metaDiv = document.createElement('div');
181
+ metaDiv.className = 'post-meta';
182
+
183
+ const usernameDiv = document.createElement('div');
184
+ usernameDiv.textContent = username;
185
+ usernameDiv.className = 'username';
186
+ if (block.includes('<|start_header_id|><|autheur|><|end_header_id|>')) {
187
+ usernameDiv.classList.add('author');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
188
  }
189
+ metaDiv.appendChild(usernameDiv);
190
+
191
+ const dateDiv = document.createElement('div');
192
+ dateDiv.textContent = date;
193
+ dateDiv.className = 'date';
194
+ metaDiv.appendChild(dateDiv);
195
+
196
+ const contentDiv = document.createElement('div');
197
+ contentDiv.className = 'post-content';
198
+
199
+ const formattedMessage = message.replace(/https?:\/\/image\.noelshack\.com\/[^\s]+/g, (url) => {
200
+ return `<img src="${url}" alt="Image">`;
201
+ });
202
+ contentDiv.innerHTML = formattedMessage;
203
+
204
+ contentWrapper.appendChild(metaDiv);
205
+ contentWrapper.appendChild(contentDiv);
206
+
207
+ postDiv.appendChild(avatarDiv);
208
+ postDiv.appendChild(contentWrapper);
209
+ postsContainer.appendChild(postDiv);
210
  }
211
  });
212
  }