usmv3131 commited on
Commit
6c35361
·
verified ·
1 Parent(s): 7ac342a

нужно отправлять данные на вебхук https://obigoolooleg.beget.app/webhook-test/41bb43f2-9bed-4e49-bbc5-e90e6f7f2138 - Initial Deployment

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +204 -19
  3. prompts.txt +15 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Test2
3
- emoji: 😻
4
- colorFrom: purple
5
- colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: test2
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: purple
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - deepsite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,204 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="ru">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Webhook Client</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ max-width: 600px;
11
+ margin: 50px auto;
12
+ padding: 20px;
13
+ background-color: #f5f5f5;
14
+ }
15
+ .container {
16
+ background: white;
17
+ padding: 25px;
18
+ border-radius: 8px;
19
+ box-shadow: 0 2px 10px rgba(0,0,0,0.1);
20
+ }
21
+ h2 {
22
+ color: #333;
23
+ margin-top: 0;
24
+ }
25
+ textarea {
26
+ width: 100%;
27
+ min-height: 100px;
28
+ padding: 12px;
29
+ border: 1px solid #ddd;
30
+ border-radius: 4px;
31
+ resize: vertical;
32
+ font-family: inherit;
33
+ box-sizing: border-box;
34
+ }
35
+ button {
36
+ padding: 12px 24px;
37
+ background-color: #4CAF50;
38
+ color: white;
39
+ border: none;
40
+ border-radius: 4px;
41
+ cursor: pointer;
42
+ font-size: 16px;
43
+ transition: background-color 0.3s;
44
+ }
45
+ button:hover {
46
+ background-color: #45a049;
47
+ }
48
+ button:disabled {
49
+ background-color: #cccccc;
50
+ cursor: not-allowed;
51
+ }
52
+ .status {
53
+ padding: 12px;
54
+ border-radius: 4px;
55
+ margin: 15px 0;
56
+ font-weight: 500;
57
+ }
58
+ .waiting {
59
+ background-color: #e3f2fd;
60
+ color: #1565c0;
61
+ }
62
+ .sending {
63
+ background-color: #fff3e0;
64
+ color: #ef6c00;
65
+ }
66
+ .success {
67
+ background-color: #e8f5e9;
68
+ color: #2e7d32;
69
+ }
70
+ .error {
71
+ background-color: #ffebee;
72
+ color: #c62828;
73
+ }
74
+ .info {
75
+ margin-top: 20px;
76
+ padding: 15px;
77
+ background-color: #f5f5f5;
78
+ border-left: 4px solid #2196f3;
79
+ font-size: 14px;
80
+ }
81
+ </style>
82
+ </head>
83
+ <body>
84
+ <div class="container">
85
+ <h2>Webhook Client</h2>
86
+
87
+ <textarea id="inputData" placeholder="Введите данные для отправки (JSON или текст)..."></textarea>
88
+
89
+ <button id="sendButton" onclick="sendData()">Отправить</button>
90
+
91
+ <div class="status waiting" id="status">Статус: Ожидание действий...</div>
92
+
93
+ <h3>Ответ от сервера:</h3>
94
+ <textarea id="outputResponse" readonly placeholder="Здесь появится ответ..."></textarea>
95
+
96
+ <div class="info" id="infoBox">
97
+ <strong>Информация:</strong> Если возникает ошибка "Failed to fetch", это может быть связано с:
98
+ <ul>
99
+ <li>Проблемами CORS на сервере</li>
100
+ <li>Блокировкой запроса расширениями браузера</li>
101
+ <li>Неточностью в URL вебхука</li>
102
+ </ul>
103
+ </div>
104
+ </div>
105
+
106
+ <script>
107
+ const sendButton = document.getElementById('sendButton');
108
+ const inputElement = document.getElementById('inputData');
109
+ const outputElement = document.getElementById('outputResponse');
110
+ const statusElement = document.getElementById('status');
111
+ const infoBox = document.getElementById('infoBox');
112
+
113
+ async function sendData() {
114
+ const data = inputElement.value.trim();
115
+
116
+ // Очистка предыдущего статуса
117
+ infoBox.style.display = 'none';
118
+
119
+ if (!data) {
120
+ showStatus('error', 'Ошибка: пустой ввод');
121
+ return;
122
+ }
123
+
124
+ try {
125
+ // Блокируем кнопку на время отправки
126
+ sendButton.disabled = true;
127
+ showStatus('sending', 'Статус: Отправка данных...');
128
+
129
+ const response = await fetchWithTimeout(
130
+ 'https://obigoolooleg.beget.app/webhook-test/41bb43f2-9bed-4e49-bbc5-e90e6f7f2138',
131
+ {
132
+ method: 'POST',
133
+ headers: {
134
+ 'Content-Type': 'application/json',
135
+ },
136
+ body: JSON.stringify({
137
+ data: data,
138
+ timestamp: new Date().toISOString()
139
+ })
140
+ },
141
+ 10000 // 10 секунд таймаут
142
+ );
143
+
144
+ if (!response.ok) {
145
+ throw new Error(`HTTP error! status: ${response.status}`);
146
+ }
147
+
148
+ const responseData = await response.text();
149
+
150
+ outputElement.value = responseData;
151
+ showStatus('success', 'Статус: Успешно отправлено!');
152
+
153
+ } catch (error) {
154
+ console.error('Ошибка:', error);
155
+
156
+ // Анализ типа ошибки
157
+ if (error.name === 'TypeError' && error.message === 'Failed to fetch') {
158
+ showStatus('error', 'Ошибка: Не удалось подключиться к серверу (Failed to fetch)');
159
+ infoBox.style.display = 'block';
160
+ } else if (error.name === 'AbortError') {
161
+ showStatus('error', 'Ошибка: Превышено время ожидания ответа сервера');
162
+ } else {
163
+ showStatus('error', 'Ошибка: ' + error.message);
164
+ }
165
+
166
+ outputElement.value = '';
167
+ } finally {
168
+ sendButton.disabled = false;
169
+ }
170
+ }
171
+
172
+ // Функция для выполнения fetch с таймаутом
173
+ async function fetchWithTimeout(url, options, timeout) {
174
+ const controller = new AbortController();
175
+ const id = setTimeout(() => controller.abort(), timeout);
176
+
177
+ try {
178
+ const response = await fetch(url, {
179
+ ...options,
180
+ signal: controller.signal
181
+ });
182
+ clearTimeout(id);
183
+ return response;
184
+ } catch (error) {
185
+ clearTimeout(id);
186
+ throw error;
187
+ }
188
+ }
189
+
190
+ // Функция для отображения статуса
191
+ function showStatus(type, message) {
192
+ statusElement.textContent = message;
193
+ statusElement.className = 'status ' + type;
194
+ }
195
+
196
+ // Добавляем возможность отправки по Enter
197
+ inputElement.addEventListener('keypress', function(e) {
198
+ if (e.key === 'Enter' && e.ctrlKey) {
199
+ sendData();
200
+ }
201
+ });
202
+ </script>
203
+ </body>
204
+ </html>
prompts.txt ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ создай простое веб приложение на русском языке с полем ввода и кнопкой "отправить" и полем вывода
2
+
3
+ поле ввода должно отправлять webhook POST https://obigoolooleg.beget.app/webhook-test/41bb43f2-9bed-4e49-bbc5-e90e6f7f2138
4
+
5
+ далее ждём ответа от webhook и выводим его в поле вывода
6
+ Ошибка: Failed to execute 'json' on 'Response': Unexpected end of JSON input
7
+ Ошибка: Failed to fetch
8
+ Ошибка подключения к серверу. Проверьте интернет соединение или попробуйте позже.
9
+ Ошибка подключения к серверу. Проверьте интернет соединение или попробуйте позже.
10
+ Ошибка подключения к серверу. Проверьте интернет соединение или попробуйте позже.
11
+ Ошибка подключения к серверу. Проверьте интернет соединение или попробуйте позже.!!!!
12
+ Ошибка подключения к серверу. Проверьте интернет соединение или попробуйте позже.
13
+ Ошибка подключения к серверу. Проверьте интернет соединение или попробуйте позже.
14
+ здесь какая то ошибка, проверь, webhook не отправляется
15
+ нужно отправлять данные на вебхук https://obigoolooleg.beget.app/webhook-test/41bb43f2-9bed-4e49-bbc5-e90e6f7f2138