@lobehub/chat 1.69.4 → 1.69.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +52 -0
- package/changelog/v1.json +18 -0
- package/docker-compose/setup.sh +92 -1
- package/docs/self-hosting/advanced/auth/clerk.mdx +1 -0
- package/locales/ar/components.json +2 -0
- package/locales/ar/models.json +3 -0
- package/locales/bg-BG/components.json +2 -0
- package/locales/bg-BG/models.json +3 -0
- package/locales/de-DE/components.json +2 -0
- package/locales/de-DE/models.json +3 -0
- package/locales/en-US/components.json +2 -0
- package/locales/en-US/models.json +3 -0
- package/locales/es-ES/components.json +2 -0
- package/locales/es-ES/models.json +3 -0
- package/locales/fa-IR/components.json +2 -0
- package/locales/fa-IR/models.json +3 -0
- package/locales/fr-FR/components.json +2 -0
- package/locales/fr-FR/models.json +3 -0
- package/locales/it-IT/components.json +2 -0
- package/locales/it-IT/models.json +3 -0
- package/locales/ja-JP/components.json +2 -0
- package/locales/ja-JP/models.json +3 -0
- package/locales/ko-KR/components.json +2 -0
- package/locales/ko-KR/models.json +3 -0
- package/locales/nl-NL/components.json +2 -0
- package/locales/nl-NL/models.json +3 -0
- package/locales/pl-PL/components.json +2 -0
- package/locales/pl-PL/models.json +3 -0
- package/locales/pt-BR/components.json +2 -0
- package/locales/pt-BR/models.json +3 -0
- package/locales/ru-RU/components.json +2 -0
- package/locales/ru-RU/models.json +3 -0
- package/locales/tr-TR/components.json +2 -0
- package/locales/tr-TR/models.json +3 -0
- package/locales/vi-VN/components.json +2 -0
- package/locales/vi-VN/models.json +3 -0
- package/locales/zh-CN/components.json +3 -1
- package/locales/zh-CN/models.json +3 -0
- package/locales/zh-TW/components.json +2 -0
- package/locales/zh-TW/models.json +3 -0
- package/package.json +4 -4
- package/packages/web-crawler/package.json +1 -1
- package/packages/web-crawler/src/crawImpl/__tests__/browserless.test.ts +94 -0
- package/packages/web-crawler/src/crawImpl/browserless.ts +1 -1
- package/packages/web-crawler/src/crawImpl/naive.ts +1 -1
- package/packages/web-crawler/src/utils/__snapshots__/htmlToMarkdown.test.ts.snap +2 -382
- package/packages/web-crawler/src/utils/htmlToMarkdown.ts +32 -2
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/MessageFromUrl.tsx +31 -0
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatInput/Desktop/Footer/index.tsx +45 -39
- package/src/app/[variants]/(main)/chat/(workspace)/@conversation/features/ChatList/WelcomeChatItem/InboxWelcome/AgentsSuggest.tsx +5 -1
- package/src/config/aiModels/openrouter.ts +26 -1
- package/src/config/modelProviders/openai.ts +3 -0
- package/src/database/client/db.ts +3 -3
- package/src/features/Conversation/components/MarkdownElements/LobeArtifact/Render/index.tsx +51 -52
- package/src/features/ModelSwitchPanel/index.tsx +37 -8
- package/src/libs/agent-runtime/anthropic/index.ts +5 -2
- package/src/libs/agent-runtime/openrouter/index.test.ts +33 -0
- package/src/libs/agent-runtime/openrouter/index.ts +11 -2
- package/src/libs/agent-runtime/openrouter/type.ts +19 -0
- package/src/locales/default/components.ts +3 -1
- package/src/services/__tests__/chat.test.ts +123 -0
- package/src/services/chat.ts +19 -19
- package/src/store/user/slices/modelList/action.ts +17 -16
- package/src/utils/fetch/__tests__/fetchSSE.test.ts +3 -2
- package/src/utils/fetch/fetchSSE.ts +1 -1
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@lobehub/chat",
|
3
|
-
"version": "1.69.
|
3
|
+
"version": "1.69.6",
|
4
4
|
"description": "Lobe Chat - an open-source, high-performance chatbot framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
5
5
|
"keywords": [
|
6
6
|
"framework",
|
@@ -120,7 +120,7 @@
|
|
120
120
|
"@clerk/themes": "^2.2.4",
|
121
121
|
"@codesandbox/sandpack-react": "^2.19.10",
|
122
122
|
"@cyntler/react-doc-viewer": "^1.17.0",
|
123
|
-
"@electric-sql/pglite": "0.2.
|
123
|
+
"@electric-sql/pglite": "0.2.17",
|
124
124
|
"@google-cloud/vertexai": "^1.9.2",
|
125
125
|
"@google/generative-ai": "^0.24.0",
|
126
126
|
"@huggingface/inference": "^2.8.1",
|
@@ -180,7 +180,7 @@
|
|
180
180
|
"langfuse": "3.29.1",
|
181
181
|
"langfuse-core": "3.29.1",
|
182
182
|
"lodash-es": "^4.17.21",
|
183
|
-
"lucide-react": "^0.
|
183
|
+
"lucide-react": "^0.479.0",
|
184
184
|
"mammoth": "^1.9.0",
|
185
185
|
"mdast-util-to-markdown": "^2.1.2",
|
186
186
|
"modern-screenshot": "^4.5.5",
|
@@ -326,7 +326,7 @@
|
|
326
326
|
"vitest": "~1.2.2",
|
327
327
|
"vitest-canvas-mock": "^0.3.3"
|
328
328
|
},
|
329
|
-
"packageManager": "pnpm@9.15.
|
329
|
+
"packageManager": "pnpm@9.15.7",
|
330
330
|
"publishConfig": {
|
331
331
|
"access": "public",
|
332
332
|
"registry": "https://registry.npmjs.org"
|
@@ -0,0 +1,94 @@
|
|
1
|
+
import { describe, expect, it, vi } from 'vitest';
|
2
|
+
|
3
|
+
import { browserless } from '../browserless';
|
4
|
+
|
5
|
+
describe('browserless', () => {
|
6
|
+
it('should throw BrowserlessInitError when env vars not set', async () => {
|
7
|
+
const originalEnv = { ...process.env };
|
8
|
+
process.env = { ...originalEnv };
|
9
|
+
delete process.env.BROWSERLESS_URL;
|
10
|
+
delete process.env.BROWSERLESS_TOKEN;
|
11
|
+
|
12
|
+
await expect(browserless('https://example.com', { filterOptions: {} })).rejects.toThrow(
|
13
|
+
'`BROWSERLESS_URL` or `BROWSERLESS_TOKEN` are required',
|
14
|
+
);
|
15
|
+
|
16
|
+
process.env = originalEnv;
|
17
|
+
});
|
18
|
+
|
19
|
+
it('should return undefined on fetch error', async () => {
|
20
|
+
process.env.BROWSERLESS_TOKEN = 'test-token';
|
21
|
+
global.fetch = vi.fn().mockRejectedValue(new Error('Fetch error'));
|
22
|
+
|
23
|
+
const result = await browserless('https://example.com', { filterOptions: {} });
|
24
|
+
expect(result).toBeUndefined();
|
25
|
+
});
|
26
|
+
|
27
|
+
it('should return undefined when content is empty', async () => {
|
28
|
+
process.env.BROWSERLESS_TOKEN = 'test-token';
|
29
|
+
global.fetch = vi.fn().mockResolvedValue({
|
30
|
+
text: vi.fn().mockResolvedValue('<html></html>'),
|
31
|
+
} as any);
|
32
|
+
|
33
|
+
const result = await browserless('https://example.com', { filterOptions: {} });
|
34
|
+
expect(result).toBeUndefined();
|
35
|
+
});
|
36
|
+
|
37
|
+
it('should return undefined when title is "Just a moment..."', async () => {
|
38
|
+
process.env.BROWSERLESS_TOKEN = 'test-token';
|
39
|
+
global.fetch = vi.fn().mockResolvedValue({
|
40
|
+
text: vi.fn().mockResolvedValue('<html><title>Just a moment...</title></html>'),
|
41
|
+
} as any);
|
42
|
+
|
43
|
+
const result = await browserless('https://example.com', { filterOptions: {} });
|
44
|
+
expect(result).toBeUndefined();
|
45
|
+
});
|
46
|
+
|
47
|
+
it('should return crawl result on successful fetch', async () => {
|
48
|
+
process.env.BROWSERLESS_TOKEN = 'test-token';
|
49
|
+
global.fetch = vi.fn().mockResolvedValue({
|
50
|
+
text: vi.fn().mockResolvedValue(`
|
51
|
+
<html>
|
52
|
+
<head>
|
53
|
+
<title>Test Title</title>
|
54
|
+
<meta name="description" content="Test Description">
|
55
|
+
</head>
|
56
|
+
<body>
|
57
|
+
<h1>Test Content</h1>
|
58
|
+
</body>
|
59
|
+
</html>
|
60
|
+
`),
|
61
|
+
} as any);
|
62
|
+
|
63
|
+
const result = await browserless('https://example.com', { filterOptions: {} });
|
64
|
+
|
65
|
+
expect(result).toEqual({
|
66
|
+
content: expect.any(String),
|
67
|
+
contentType: 'text',
|
68
|
+
description: expect.any(String),
|
69
|
+
length: expect.any(Number),
|
70
|
+
siteName: undefined,
|
71
|
+
title: 'Test Title',
|
72
|
+
url: 'https://example.com',
|
73
|
+
});
|
74
|
+
});
|
75
|
+
|
76
|
+
it('should use correct URL when BROWSERLESS_URL is provided', async () => {
|
77
|
+
const customUrl = 'https://custom.browserless.io';
|
78
|
+
const originalEnv = { ...process.env };
|
79
|
+
process.env.BROWSERLESS_TOKEN = 'test-token';
|
80
|
+
process.env.BROWSERLESS_URL = customUrl;
|
81
|
+
global.fetch = vi.fn().mockImplementation((url) => {
|
82
|
+
expect(url).toContain(customUrl);
|
83
|
+
return Promise.resolve({
|
84
|
+
text: () => Promise.resolve('<html><title>Test</title></html>'),
|
85
|
+
});
|
86
|
+
});
|
87
|
+
|
88
|
+
await browserless('https://example.com', { filterOptions: {} });
|
89
|
+
|
90
|
+
expect(global.fetch).toHaveBeenCalled();
|
91
|
+
|
92
|
+
process.env = originalEnv;
|
93
|
+
});
|
94
|
+
});
|
@@ -48,7 +48,7 @@ export const browserless: CrawlImpl = async (url, { filterOptions }) => {
|
|
48
48
|
return {
|
49
49
|
content: result.content,
|
50
50
|
contentType: 'text',
|
51
|
-
description: result?.
|
51
|
+
description: result?.description,
|
52
52
|
length: result.length,
|
53
53
|
siteName: result?.siteName,
|
54
54
|
title: result?.title,
|
@@ -103,7 +103,7 @@ export const naive: CrawlImpl = async (url, { filterOptions }) => {
|
|
103
103
|
return {
|
104
104
|
content: result.content,
|
105
105
|
contentType: 'text',
|
106
|
-
description: result?.
|
106
|
+
description: result?.description,
|
107
107
|
length: result.length,
|
108
108
|
siteName: result?.siteName,
|
109
109
|
title: result?.title,
|
@@ -2,7 +2,6 @@
|
|
2
2
|
|
3
3
|
exports[`htmlToMarkdown > should transform terms.html to markdown 1`] = `
|
4
4
|
{
|
5
|
-
"byline": null,
|
6
5
|
"content": " Lasted Updated at
|
7
6
|
|
8
7
|
2024-03-01
|
@@ -111,378 +110,14 @@ Examples of prohibited activities include but are not limited to:
|
|
111
110
|
This agreement represents the entire agreement between You and LobeHub regarding the use of the Services. It supersedes any prior agreements or understandings. The failure of LobeHub to enforce any provision of this agreement does not constitute a waiver of its rights.
|
112
111
|
|
113
112
|
By accessing or using the LobeHub Services, You acknowledge that You have read, understood, and agreed to be bound by this agreement. If You have any questions regarding this agreement, please contact us at[support@lobehub.com](mailto:support@lobehub.com).",
|
114
|
-
"
|
115
|
-
"excerpt": "Lasted Updated at",
|
116
|
-
"lang": null,
|
113
|
+
"description": "Lasted Updated at",
|
117
114
|
"length": 18284,
|
118
|
-
"publishedTime": null,
|
119
|
-
"siteName": null,
|
120
|
-
"textContent": "
|
121
|
-
|
122
|
-
|
123
|
-
Lasted Updated at
|
124
|
-
2024-03-01
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
Welcome to LobeHub! Please carefully read the following Terms of Use (hereinafter
|
129
|
-
referred to as the "Agreement"). This Agreement constitutes a legally binding
|
130
|
-
agreement between You and LobeHub regarding the access and use of the LobeHub
|
131
|
-
software applications, services, and websites (collectively referred to as the
|
132
|
-
"Services").
|
133
|
-
|
134
|
-
|
135
|
-
By accessing or using the Services in any way, You acknowledge that You have read,
|
136
|
-
understood, and agreed to be bound by all the terms of this Agreement. If You do not
|
137
|
-
agree to any part of this Agreement, You are not permitted to continue accessing or
|
138
|
-
using the Services.
|
139
|
-
|
140
|
-
|
141
|
-
Definitions
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
The words of which the initial letter is capitalized have meanings defined under the
|
149
|
-
following conditions. The following definitions shall have the same meaning
|
150
|
-
regardless of whether they appear in singular or in plural.
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
Affiliate means an entity that controls, is controlled by or is
|
155
|
-
under common control with a party, where "control" means ownership of 50% or more
|
156
|
-
of the shares, equity interest or other securities entitled to vote for election
|
157
|
-
of directors or other managing authority.
|
158
|
-
|
159
|
-
Agreement means this Terms of Use Agreement.
|
160
|
-
|
161
|
-
Company (referred to as either "the Company", "We", "Us" or "Our"
|
162
|
-
in this Agreement) refers to LobeHub LLC.
|
163
|
-
|
164
|
-
|
165
|
-
Service means the LobeHub software applications, services, and
|
166
|
-
website.
|
167
|
-
|
168
|
-
|
169
|
-
You means the individual accessing or using the Services, or the
|
170
|
-
company, or other legal entity on behalf of which such individual is accessing or
|
171
|
-
using the Services, as applicable.
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
Our Services
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
LobeHub provides a platform and interface that enables users to interact with
|
183
|
-
artificial intelligence technologies, including but not limited to natural language
|
184
|
-
processing models or content generation models developed independently or provided
|
185
|
-
by third parties such as Google, Microsoft, OpenAI, and other commercial companies
|
186
|
-
as well as open-source communities. The Service facilitates functions such as
|
187
|
-
information retrieval, content creation, and automation through user interaction
|
188
|
-
with AI systems. Additionally, it utilizes cloud technology to provide capabilities
|
189
|
-
like data synchronization, vector data storage, server-side functionalities, etc.,
|
190
|
-
to enhance the interactive experience with AI models.
|
191
|
-
|
192
|
-
|
193
|
-
Eligibility
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
By accessing or using the Services, You represent and warrant to the Company that
|
201
|
-
You: (1)Are of legal age (18 years and above). (2)Have legal capacity and agree to
|
202
|
-
abide by these terms. (3)Will use the Services in accordance with this Agreement and
|
203
|
-
all applicable laws. (4)Will not use the Services for any illegal, harmful,
|
204
|
-
dangerous, or offensive purposes.
|
205
|
-
|
206
|
-
Examples of prohibited activities include but are not limited to:
|
207
|
-
|
208
|
-
Illegal activities
|
209
|
-
Infringement of intellectual property rights
|
210
|
-
Generating harmful, unsafe, deceptive, or illegal content
|
211
|
-
Impersonation, fraud
|
212
|
-
|
213
|
-
|
214
|
-
If You do not comply with the usage conditions, We reserve the right to suspend or
|
215
|
-
terminate Your account and refuse any and all current or future use of the Services
|
216
|
-
(or any part thereof).
|
217
|
-
|
218
|
-
|
219
|
-
Account Registration
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
To access the Services, You must register an account by providing true, accurate,
|
227
|
-
up-to-date, and complete information. You are solely responsible for all activities
|
228
|
-
that occur under Your account, including maintaining the security of Your account
|
229
|
-
and restricting access. You must immediately notify LobeHub of any unauthorized
|
230
|
-
account use or other security breaches.
|
231
|
-
|
232
|
-
|
233
|
-
Please ensure to keep Your password secure and take responsibility for all use of
|
234
|
-
Your account and password. If We deem the chosen username inappropriate, containing
|
235
|
-
obscene content, or otherwise offensive, We reserve the right to delete, revoke, or
|
236
|
-
modify that username.
|
237
|
-
|
238
|
-
|
239
|
-
Purchases and Payments
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
You agree to provide current, complete, and accurate purchase and account
|
247
|
-
information for all purchases made using the Services. You also agree to promptly
|
248
|
-
update Your account and payment information, including email address, payment
|
249
|
-
method, and payment card expiration date, to allow us to complete Your transactions
|
250
|
-
and contact You when necessary. Sales tax will be added to the purchase price as
|
251
|
-
required by law.
|
252
|
-
|
253
|
-
|
254
|
-
You agree to pay all charges at the current purchase price and authorize us to
|
255
|
-
charge any such amounts to Your chosen payment provider at the time of purchase. If
|
256
|
-
Your order requires recurring charges, You agree that We may charge Your payment
|
257
|
-
method on a recurring basis at the specified intervals without obtaining prior
|
258
|
-
approval for each recurring charge until the relevant order is canceled. We reserve
|
259
|
-
the right to correct any errors or pricing errors even after payment has been
|
260
|
-
requested or accepted.
|
261
|
-
|
262
|
-
|
263
|
-
We may utilize third-party payment processing services (such as Stripe) for payment
|
264
|
-
processing. You may use a valid card (credit or debit card) for payment, subject to
|
265
|
-
verification and authorization by Your card issuer. We will not be liable for any
|
266
|
-
delays or failure to provide Services resulting from payment failures due to
|
267
|
-
authorization issues or any reasons related to third-party payment providers.
|
268
|
-
|
269
|
-
|
270
|
-
We reserve the right to refuse or cancel Your order at any time for certain reasons,
|
271
|
-
including but not limited to: (1) Service availability, (2) errors in Service
|
272
|
-
description or pricing, (3) order errors, (4) suspected fraud or unauthorized or
|
273
|
-
illegal transactions. We reserve the right, at our sole discretion, to limit or
|
274
|
-
prohibit orders placed by dealers, resellers, or distributors.
|
275
|
-
|
276
|
-
|
277
|
-
Fee Changes
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
284
|
-
We reserve the right to adjust the Service fees at our discretion and at any time.
|
285
|
-
Any changes in fees will take effect immediately upon the change. Services that have
|
286
|
-
already been paid for and purchased will not be affected.
|
287
|
-
|
288
|
-
|
289
|
-
If Your order requires recurring automatic billing, the revised price will take
|
290
|
-
effect on the next billing cycle. We will notify You in advance of any fee
|
291
|
-
adjustments so that You have the opportunity to cancel the order before the
|
292
|
-
adjustment takes effect. If You do not cancel the order and continue to use the
|
293
|
-
Services, You agree to pay the revised fee amount.
|
294
|
-
|
295
|
-
|
296
|
-
Refunds
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
For Services that have been purchased but not used, We support refunds within 30
|
304
|
-
days of payment. However, for Services that have been used or purchased for more
|
305
|
-
than 30 days, We will not accept refund requests.
|
306
|
-
|
307
|
-
|
308
|
-
For subscription-based Services where partial usage has occurred, Your refund
|
309
|
-
request will be reviewed on a case-by-case basis, and the final decision on
|
310
|
-
approving the refund will be at the Company's discretion.
|
311
|
-
|
312
|
-
|
313
|
-
Content
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
Our Services allows You to generate and publish content. You are responsible for the
|
321
|
-
legality, reliability, and appropriateness of the content generated using the AI
|
322
|
-
ability. We do not assume responsibility for user-generated content on the Services.
|
323
|
-
You explicitly understand and agree that You are solely responsible for the content
|
324
|
-
You post and all activities conducted under Your account, whether by Yourself or by
|
325
|
-
third parties using Your account.
|
326
|
-
|
327
|
-
|
328
|
-
By generating and publishing content in the Services, You grant us the rights and
|
329
|
-
licenses necessary to use, modify, publicly perform, publicly display, copy, and
|
330
|
-
distribute such content within the Services. You retain full ownership of all
|
331
|
-
content created, published, or displayed within the Services and are responsible for
|
332
|
-
maintaining these rights. You agree that this license includes the permission for us
|
333
|
-
to provide Your content to other Service users for their use under these terms.
|
334
|
-
Additionally, You declare and warrant that: (1) the content is owned by You or You
|
335
|
-
have the legal right to use and authorize it to us under this agreement. (2) posting
|
336
|
-
the shared information in the Services will not infringe upon the privacy rights,
|
337
|
-
image rights, copyrights, contractual relationships, or other individual rights of
|
338
|
-
others.
|
339
|
-
|
340
|
-
|
341
|
-
All content generated by You is by default stored locally on the client-side, and
|
342
|
-
You are responsible for the storage and backup of Your content.
|
343
|
-
|
344
|
-
|
345
|
-
Additionally, We offer optional cloud sync content functionality. By using this
|
346
|
-
feature, You agree that We may retain complete and accurate copies of any content in
|
347
|
-
locations independent of the Services in our manner. However, We cannot guarantee
|
348
|
-
that data will not be lost or damaged. Data or content loss or damage can occur due
|
349
|
-
to various reasons, such as pre-existing damage before synchronization or changes
|
350
|
-
during synchronization.
|
351
|
-
|
352
|
-
|
353
|
-
We do not assume any responsibility for the security and integrity of content in the
|
354
|
-
event of content damage or loss under any circumstances.
|
355
|
-
|
356
|
-
|
357
|
-
Intellectual Property Rights
|
358
|
-
|
359
|
-
|
360
|
-
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
LobeHub reserves all rights to the technology, software, first-party content, and
|
365
|
-
data within the Services, including but not limited to patents, trademarks, trade
|
366
|
-
secrets, copyrights, and other intellectual property rights. Your permission to use
|
367
|
-
the Services does not grant You any ownership or title. You are not permitted to
|
368
|
-
copy, modify, adapt, translate, create derivative works, reverse engineer,
|
369
|
-
disassemble, or decompile the Services or any part thereof. If You wish to
|
370
|
-
participate in collaborative technical development, please engage through our GitHub
|
371
|
-
open-source community and adhere to the relevant open-source licenses.
|
372
|
-
|
373
|
-
|
374
|
-
Privacy and Security
|
375
|
-
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
LobeHub employs industry-standard technical, managerial, and physical security
|
382
|
-
measures to protect the security, confidentiality, and integrity of Your data.
|
383
|
-
However, We cannot guarantee that unauthorized access, hacking attacks, data loss,
|
384
|
-
or other breaches will never occur. LobeHub is not liable for any damages or
|
385
|
-
liabilities related to security incidents. Please refer to our Privacy Policy for
|
386
|
-
more detailed information.
|
387
|
-
|
388
|
-
|
389
|
-
Termination of Services
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
395
|
-
|
396
|
-
You may close Your account and cease using the Services at any time. In the event of
|
397
|
-
a violation of the terms of the agreement, LobeHub may immediately suspend or
|
398
|
-
terminate Your access to the Services. Upon termination, You will immediately lose
|
399
|
-
the right to access or use the Services. LobeHub will not be liable to You or any
|
400
|
-
third party for the termination of the Services.
|
401
|
-
|
402
|
-
|
403
|
-
Disclaimer of Warranties
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
|
408
|
-
|
409
|
-
|
410
|
-
The Services provided by LobeHub are provided on an "as-is" basis, and without any
|
411
|
-
form of guarantee. We explicitly disclaim all warranties, whether express, implied,
|
412
|
-
statutory, or otherwise, including but not limited to warranties of merchantability,
|
413
|
-
fitness for a particular purpose, and non-infringement. Your use of the Services is
|
414
|
-
at Your own risk.
|
415
|
-
|
416
|
-
|
417
|
-
Limitation of Liability
|
418
|
-
|
419
|
-
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
|
424
|
-
In no event shall LobeHub, its Affiliates, directors, employees, or agents be liable
|
425
|
-
for any direct, indirect, punitive, incidental, special, or consequential damages
|
426
|
-
arising from or related to Your use or inability to use the Services. This
|
427
|
-
limitation applies regardless of the basis or form of action.
|
428
|
-
|
429
|
-
|
430
|
-
Modification of Terms
|
431
|
-
|
432
|
-
|
433
|
-
|
434
|
-
|
435
|
-
|
436
|
-
|
437
|
-
We may revise this agreement periodically, and the new version of the agreement will
|
438
|
-
replace the previous version. We will indicate the "last updated" date at the
|
439
|
-
beginning and provide notice within the Services to inform You of significant
|
440
|
-
changes. It is Your responsibility to regularly review these legal terms to stay
|
441
|
-
informed of any updates. By continuing to use the Services after the revised legal
|
442
|
-
terms are posted, You will be deemed to have understood and accepted any changes to
|
443
|
-
the revised legal terms.
|
444
|
-
|
445
|
-
|
446
|
-
Governing Law and Jurisdiction
|
447
|
-
|
448
|
-
|
449
|
-
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
This agreement shall be governed by the laws of the State of Delaware, and You agree
|
454
|
-
to submit to the exclusive jurisdiction of the state and federal courts located in
|
455
|
-
Delaware for the resolution of any disputes related to this agreement or the
|
456
|
-
Services. You may also be required to comply with the laws of Your local
|
457
|
-
jurisdiction, state, country, or international laws when using the Services.
|
458
|
-
|
459
|
-
|
460
|
-
Conclusion
|
461
|
-
|
462
|
-
|
463
|
-
|
464
|
-
|
465
|
-
|
466
|
-
|
467
|
-
This agreement represents the entire agreement between You and LobeHub regarding the
|
468
|
-
use of the Services. It supersedes any prior agreements or understandings. The
|
469
|
-
failure of LobeHub to enforce any provision of this agreement does not constitute a
|
470
|
-
waiver of its rights.
|
471
|
-
|
472
|
-
|
473
|
-
By accessing or using the LobeHub Services, You acknowledge that You have read,
|
474
|
-
understood, and agreed to be bound by this agreement. If You have any questions
|
475
|
-
regarding this agreement, please contact us at
|
476
|
-
support@lobehub.com.
|
477
|
-
|
478
|
-
",
|
479
115
|
"title": "Terms of Service · LobeHub",
|
480
116
|
}
|
481
117
|
`;
|
482
118
|
|
483
119
|
exports[`htmlToMarkdown > should transform yingchao.html to markdown 1`] = `
|
484
120
|
{
|
485
|
-
"byline": null,
|
486
121
|
"content": " 资讯
|
487
122
|
|
488
123
|
全部 NBA CBA 英超 法甲 意甲 德甲 西甲 综合 专题 预测
|
@@ -616,23 +251,8 @@ copyright © 2016 - 2025 qiumiwu.com All Rights Reserved
|
|
616
251
|
温馨提示
|
617
252
|
|
618
253
|
扫描二维码,下载球迷屋App,获得更好的使用体验",
|
619
|
-
"
|
620
|
-
"excerpt": "球迷屋为您提供2024-2025赛季英超积分排行榜,包含所有英超球队的全部赛季的排行榜数据,包含了英超球队的排名、场次、胜平负、进球、失球、积分等等详细积分数据,让大家迅速了解英超积分排行榜的数据。",
|
621
|
-
"lang": null,
|
254
|
+
"description": "球迷屋为您提供2024-2025赛季英超积分排行榜,包含所有英超球队的全部赛季的排行榜数据,包含了英超球队的排名、场次、胜平负、进球、失球、积分等等详细积分数据,让大家迅速了解英超积分排行榜的数据。",
|
622
255
|
"length": 201,
|
623
|
-
"publishedTime": null,
|
624
|
-
"siteName": null,
|
625
|
-
"textContent": "
|
626
|
-
copyright © 2016 - 2025 qiumiwu.com All Rights Reserved
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
粤公网安备 44190002004105号
|
631
|
-
粤ICP备16062857号
|
632
|
-
增值电信业务经营许可证粤B2-20210041
|
633
|
-
粤网文[2021]4047-607号
|
634
|
-
|
635
|
-
",
|
636
256
|
"title": "英超排行榜|英超积分榜2024-2025赛季 - 球迷屋",
|
637
257
|
}
|
638
258
|
`;
|
@@ -4,10 +4,28 @@ import { NodeHtmlMarkdown, type TranslatorConfigObject } from 'node-html-markdow
|
|
4
4
|
|
5
5
|
import { FilterOptions } from '../type';
|
6
6
|
|
7
|
+
const cleanObj = <T extends object>(
|
8
|
+
obj: T,
|
9
|
+
): {
|
10
|
+
[K in keyof T as T[K] extends null ? never : K]: T[K];
|
11
|
+
} => Object.fromEntries(Object.entries(obj).filter(([, value]) => value !== null)) as any;
|
12
|
+
|
13
|
+
interface HtmlToMarkdownOutput {
|
14
|
+
author?: string;
|
15
|
+
content: string;
|
16
|
+
description?: string;
|
17
|
+
dir?: string;
|
18
|
+
lang?: string;
|
19
|
+
length?: number;
|
20
|
+
publishedTime?: string;
|
21
|
+
siteName?: string;
|
22
|
+
title?: string;
|
23
|
+
}
|
24
|
+
|
7
25
|
export const htmlToMarkdown = (
|
8
26
|
html: string,
|
9
27
|
{ url, filterOptions }: { filterOptions: FilterOptions; url: string },
|
10
|
-
) => {
|
28
|
+
): HtmlToMarkdownOutput => {
|
11
29
|
const window = new Window({ url });
|
12
30
|
|
13
31
|
const document = window.document;
|
@@ -41,5 +59,17 @@ export const htmlToMarkdown = (
|
|
41
59
|
|
42
60
|
const content = nodeHtmlMarkdown.translate(htmlNode);
|
43
61
|
|
44
|
-
|
62
|
+
const result = {
|
63
|
+
author: parsedContent?.byline,
|
64
|
+
content,
|
65
|
+
description: parsedContent?.excerpt,
|
66
|
+
dir: parsedContent?.dir,
|
67
|
+
lang: parsedContent?.lang,
|
68
|
+
length: parsedContent?.length,
|
69
|
+
publishedTime: parsedContent?.publishedTime,
|
70
|
+
siteName: parsedContent?.siteName,
|
71
|
+
title: parsedContent?.title,
|
72
|
+
};
|
73
|
+
|
74
|
+
return cleanObj(result) as HtmlToMarkdownOutput;
|
45
75
|
};
|
@@ -0,0 +1,31 @@
|
|
1
|
+
'use client';
|
2
|
+
|
3
|
+
import { useSearchParams } from 'next/navigation';
|
4
|
+
import { useEffect } from 'react';
|
5
|
+
|
6
|
+
import { useSendMessage } from '@/features/ChatInput/useSend';
|
7
|
+
import { useChatStore } from '@/store/chat';
|
8
|
+
|
9
|
+
const MessageFromUrl = () => {
|
10
|
+
const updateInputMessage = useChatStore((s) => s.updateInputMessage);
|
11
|
+
const { send: sendMessage } = useSendMessage();
|
12
|
+
const searchParams = useSearchParams();
|
13
|
+
|
14
|
+
useEffect(() => {
|
15
|
+
const message = searchParams.get('message');
|
16
|
+
if (message) {
|
17
|
+
// Remove message from URL
|
18
|
+
const params = new URLSearchParams(searchParams.toString());
|
19
|
+
params.delete('message');
|
20
|
+
const newUrl = `${window.location.pathname}?${params.toString()}`;
|
21
|
+
window.history.replaceState({}, '', newUrl);
|
22
|
+
|
23
|
+
updateInputMessage(message);
|
24
|
+
sendMessage();
|
25
|
+
}
|
26
|
+
}, [searchParams, updateInputMessage, sendMessage]);
|
27
|
+
|
28
|
+
return null;
|
29
|
+
};
|
30
|
+
|
31
|
+
export default MessageFromUrl;
|