@lobehub/chat 1.12.14 → 1.12.16
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 +42 -0
- package/docs/self-hosting/advanced/feature-flags.mdx +3 -0
- package/docs/self-hosting/advanced/feature-flags.zh-CN.mdx +3 -0
- package/docs/self-hosting/advanced/upstream-sync.mdx +1 -1
- package/docs/self-hosting/advanced/upstream-sync.zh-CN.mdx +1 -1
- package/docs/self-hosting/platform/docker-compose.mdx +1 -1
- package/docs/self-hosting/platform/docker-compose.zh-CN.mdx +1 -1
- package/docs/self-hosting/platform/docker.mdx +1 -1
- package/docs/self-hosting/platform/docker.zh-CN.mdx +1 -1
- package/package.json +1 -1
- package/src/app/(main)/chat/(workspace)/_layout/Mobile/ChatHeader/index.tsx +4 -1
- package/src/libs/langchain/loaders/index.ts +9 -0
- package/src/libs/langchain/loaders/latex/__tests__/__snapshots__/index.test.ts.snap +205 -0
- package/src/libs/langchain/loaders/latex/__tests__/demo.tex +112 -0
- package/src/libs/langchain/loaders/latex/__tests__/index.test.ts +16 -0
- package/src/libs/langchain/loaders/latex/index.ts +9 -0
- package/src/libs/langchain/types.ts +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,48 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
### [Version 1.12.16](https://github.com/lobehub/lobe-chat/compare/v1.12.15...v1.12.16)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2024-08-24**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Session not found error on mobile.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Session not found error on mobile, closes [#3428](https://github.com/lobehub/lobe-chat/issues/3428) ([7e9c15e](https://github.com/lobehub/lobe-chat/commit/7e9c15e))
|
|
21
|
+
|
|
22
|
+
</details>
|
|
23
|
+
|
|
24
|
+
<div align="right">
|
|
25
|
+
|
|
26
|
+
[](#readme-top)
|
|
27
|
+
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
### [Version 1.12.15](https://github.com/lobehub/lobe-chat/compare/v1.12.14...v1.12.15)
|
|
31
|
+
|
|
32
|
+
<sup>Released on **2024-08-24**</sup>
|
|
33
|
+
|
|
34
|
+
<br/>
|
|
35
|
+
|
|
36
|
+
<details>
|
|
37
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
38
|
+
|
|
39
|
+
</details>
|
|
40
|
+
|
|
41
|
+
<div align="right">
|
|
42
|
+
|
|
43
|
+
[](#readme-top)
|
|
44
|
+
|
|
45
|
+
</div>
|
|
46
|
+
|
|
5
47
|
### [Version 1.12.14](https://github.com/lobehub/lobe-chat/compare/v1.12.13...v1.12.14)
|
|
6
48
|
|
|
7
49
|
<sup>Released on **2024-08-24**</sup>
|
|
@@ -43,5 +43,8 @@ You can achieve various feature combinations using the above configuration synta
|
|
|
43
43
|
| `dalle` | Enables the DALL-E functionality. | Enabled |
|
|
44
44
|
| `check_updates` | Allows checking for updates. | Enabled |
|
|
45
45
|
| `welcome_suggest` | Displays welcome suggestions. | Enabled |
|
|
46
|
+
| `market` | Enables the assistant market functionality. | Enabled |
|
|
47
|
+
| `speech_to_text` | Enables speech-to-text functionality. | Enabled |
|
|
48
|
+
| `knowledge_base` | Enables the knowledge base functionality. | Enabled |
|
|
46
49
|
|
|
47
50
|
You can always check the [featureFlags](https://github.com/lobehub/lobe-chat/blob/main/src/config/featureFlags/schema.ts) to get the latest list of feature flags.
|
|
@@ -39,5 +39,8 @@ tags:
|
|
|
39
39
|
| `dalle` | 启用 DALL-E 功能。 | 开启 |
|
|
40
40
|
| `check_updates` | 允许检查更新。 | 开启 |
|
|
41
41
|
| `welcome_suggest` | 显示欢迎建议。 | 开启 |
|
|
42
|
+
| `market` | 启用助手市场功能。 | 开启 |
|
|
43
|
+
| `speech_to_text` | 启用语音转文本功能。 | 开启 |
|
|
44
|
+
| `knowledge_base` | 启用知识库功能。 | 开启 |
|
|
42
45
|
|
|
43
46
|
你可以随时检查 [featureFlags](https://github.com/lobehub/lobe-chat/blob/main/src/config/featureFlags/schema.ts) 以获取最新的特性标志列表。
|
|
@@ -151,7 +151,7 @@ echo "Update time: $(date)"
|
|
|
151
151
|
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
152
152
|
|
|
153
153
|
# Clean up unused images
|
|
154
|
-
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
154
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
155
155
|
echo "Removed old images."
|
|
156
156
|
```
|
|
157
157
|
|
|
@@ -146,7 +146,7 @@ echo "Update time: $(date)"
|
|
|
146
146
|
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
147
147
|
|
|
148
148
|
# 清理不再使用的镜像
|
|
149
|
-
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
149
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
150
150
|
echo "Removed old images."
|
|
151
151
|
```
|
|
152
152
|
|
|
@@ -121,7 +121,7 @@ echo "Update time: $(date)"
|
|
|
121
121
|
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
122
122
|
|
|
123
123
|
# Clean up unused images
|
|
124
|
-
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
124
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
125
125
|
echo "Removed old images."
|
|
126
126
|
```
|
|
127
127
|
|
|
@@ -118,7 +118,7 @@ echo "Update time: $(date)"
|
|
|
118
118
|
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
119
119
|
|
|
120
120
|
# Clean up unused images
|
|
121
|
-
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
121
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
122
122
|
echo "Removed old images."
|
|
123
123
|
```
|
|
124
124
|
|
|
@@ -147,7 +147,7 @@ echo "Update time: $(date)"
|
|
|
147
147
|
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
148
148
|
|
|
149
149
|
# Clean up unused images
|
|
150
|
-
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
150
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
151
151
|
echo "Removed old images."
|
|
152
152
|
```
|
|
153
153
|
|
|
@@ -147,7 +147,7 @@ echo "Update time: $(date)"
|
|
|
147
147
|
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"
|
|
148
148
|
|
|
149
149
|
# 清理不再使用的镜像
|
|
150
|
-
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
150
|
+
docker images | grep 'lobehub/lobe-chat' | grep -v 'lobehub/lobe-chat-database' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
|
|
151
151
|
echo "Removed old images."
|
|
152
152
|
```
|
|
153
153
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/chat",
|
|
3
|
-
"version": "1.12.
|
|
3
|
+
"version": "1.12.16",
|
|
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",
|
|
@@ -4,6 +4,7 @@ import { MobileNavBar } from '@lobehub/ui';
|
|
|
4
4
|
import { memo, useState } from 'react';
|
|
5
5
|
|
|
6
6
|
import { useInitAgentConfig } from '@/app/(main)/chat/(workspace)/_layout/useInitAgentConfig';
|
|
7
|
+
import { INBOX_SESSION_ID } from '@/const/session';
|
|
7
8
|
import { useQueryRoute } from '@/hooks/useQueryRoute';
|
|
8
9
|
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';
|
|
9
10
|
|
|
@@ -21,7 +22,9 @@ const MobileHeader = memo(() => {
|
|
|
21
22
|
return (
|
|
22
23
|
<MobileNavBar
|
|
23
24
|
center={<ChatHeaderTitle />}
|
|
24
|
-
onBackClick={() =>
|
|
25
|
+
onBackClick={() =>
|
|
26
|
+
router.push('/chat', { query: { session: INBOX_SESSION_ID }, replace: true })
|
|
27
|
+
}
|
|
25
28
|
right={
|
|
26
29
|
<>
|
|
27
30
|
<ShareButton mobile open={open} setOpen={setOpen} />
|
|
@@ -8,6 +8,7 @@ import { LangChainLoaderType } from '@/libs/langchain/types';
|
|
|
8
8
|
|
|
9
9
|
import { CodeLoader } from './code';
|
|
10
10
|
import { DocxLoader } from './docx';
|
|
11
|
+
import { LatexLoader } from './latex';
|
|
11
12
|
import { MarkdownLoader } from './markdown';
|
|
12
13
|
import { PdfLoader } from './pdf';
|
|
13
14
|
import { PPTXLoader } from './pptx';
|
|
@@ -38,6 +39,10 @@ export class ChunkingLoader {
|
|
|
38
39
|
return await PPTXLoader(fileBlob);
|
|
39
40
|
}
|
|
40
41
|
|
|
42
|
+
case 'latex': {
|
|
43
|
+
return await LatexLoader(txt);
|
|
44
|
+
}
|
|
45
|
+
|
|
41
46
|
case 'pdf': {
|
|
42
47
|
return await PdfLoader(fileBlob);
|
|
43
48
|
}
|
|
@@ -78,6 +83,10 @@ export class ChunkingLoader {
|
|
|
78
83
|
return 'pdf';
|
|
79
84
|
}
|
|
80
85
|
|
|
86
|
+
if (filename.endsWith('tex')) {
|
|
87
|
+
return 'latex';
|
|
88
|
+
}
|
|
89
|
+
|
|
81
90
|
if (filename.endsWith('md') || filename.endsWith('mdx')) {
|
|
82
91
|
return 'markdown';
|
|
83
92
|
}
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
|
+
|
|
3
|
+
exports[`LatexLoader > should run 1`] = `
|
|
4
|
+
[
|
|
5
|
+
Document {
|
|
6
|
+
"id": undefined,
|
|
7
|
+
"metadata": {
|
|
8
|
+
"loc": {
|
|
9
|
+
"lines": {
|
|
10
|
+
"from": 1,
|
|
11
|
+
"to": 41,
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
"pageContent": "\\documentclass{article}
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
\\usepackage{graphicx} % Required for inserting images
|
|
19
|
+
\\usepackage{amsmath} % Required for mathematical symbols
|
|
20
|
+
\\usepackage{hyperref} % For hyperlinks
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
\\title{Sample LaTeX Document}
|
|
24
|
+
\\author{Generated by ChatGPT}
|
|
25
|
+
\\date{\\today}
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
\\begin{document}
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
\\maketitle
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
\\tableofcontents
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
\\section{Introduction}
|
|
38
|
+
This is a sample LaTeX document that includes various common elements such as sections, lists, tables, figures, and mathematical equations.
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
\\section{Lists}
|
|
42
|
+
\\subsection{Itemized List}
|
|
43
|
+
\\begin{itemize}
|
|
44
|
+
\\item First item
|
|
45
|
+
\\item Second item
|
|
46
|
+
\\item Third item
|
|
47
|
+
\\end{itemize}
|
|
48
|
+
|
|
49
|
+
|
|
50
|
+
\\subsection{Enumerated List}
|
|
51
|
+
\\begin{enumerate}
|
|
52
|
+
\\item First item
|
|
53
|
+
\\item Second item
|
|
54
|
+
\\item Third item
|
|
55
|
+
\\end{enumerate}",
|
|
56
|
+
},
|
|
57
|
+
Document {
|
|
58
|
+
"id": undefined,
|
|
59
|
+
"metadata": {
|
|
60
|
+
"loc": {
|
|
61
|
+
"lines": {
|
|
62
|
+
"from": 27,
|
|
63
|
+
"to": 61,
|
|
64
|
+
},
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
"pageContent": "\\section{Lists}
|
|
68
|
+
\\subsection{Itemized List}
|
|
69
|
+
\\begin{itemize}
|
|
70
|
+
\\item First item
|
|
71
|
+
\\item Second item
|
|
72
|
+
\\item Third item
|
|
73
|
+
\\end{itemize}
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
\\subsection{Enumerated List}
|
|
77
|
+
\\begin{enumerate}
|
|
78
|
+
\\item First item
|
|
79
|
+
\\item Second item
|
|
80
|
+
\\item Third item
|
|
81
|
+
\\end{enumerate}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
\\section{Mathematical Equations}
|
|
85
|
+
Here are some sample mathematical equations:
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
\\subsection{Inline Equation}
|
|
89
|
+
This is an inline equation: \\( E = mc^2 \\).
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
\\subsection{Displayed Equations}
|
|
93
|
+
\\begin{equation}
|
|
94
|
+
a^2 + b^2 = c^2
|
|
95
|
+
\\end{equation}
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
\\begin{align}
|
|
99
|
+
x &= y + z \\\\
|
|
100
|
+
y &= mx + b
|
|
101
|
+
\\end{align}",
|
|
102
|
+
},
|
|
103
|
+
Document {
|
|
104
|
+
"id": undefined,
|
|
105
|
+
"metadata": {
|
|
106
|
+
"loc": {
|
|
107
|
+
"lines": {
|
|
108
|
+
"from": 44,
|
|
109
|
+
"to": 93,
|
|
110
|
+
},
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
"pageContent": "\\section{Mathematical Equations}
|
|
114
|
+
Here are some sample mathematical equations:
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
\\subsection{Inline Equation}
|
|
118
|
+
This is an inline equation: \\( E = mc^2 \\).
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
\\subsection{Displayed Equations}
|
|
122
|
+
\\begin{equation}
|
|
123
|
+
a^2 + b^2 = c^2
|
|
124
|
+
\\end{equation}
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
\\begin{align}
|
|
128
|
+
x &= y + z \\\\
|
|
129
|
+
y &= mx + b
|
|
130
|
+
\\end{align}
|
|
131
|
+
|
|
132
|
+
|
|
133
|
+
\\section{Tables}
|
|
134
|
+
Here is a sample table:
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
\\begin{table}[h!]
|
|
138
|
+
\\centering
|
|
139
|
+
\\begin{tabular}{|c|c|c|}
|
|
140
|
+
\\hline
|
|
141
|
+
Header 1 & Header 2 & Header 3 \\\\
|
|
142
|
+
\\hline
|
|
143
|
+
Data 1 & Data 2 & Data 3 \\\\
|
|
144
|
+
Data 4 & Data 5 & Data 6 \\\\
|
|
145
|
+
Data 7 & Data 8 & Data 9 \\\\
|
|
146
|
+
\\hline
|
|
147
|
+
\\end{tabular}
|
|
148
|
+
\\caption{Sample Table}
|
|
149
|
+
\\label{table:1}
|
|
150
|
+
\\end{table}
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
\\section{Figures}
|
|
154
|
+
Here is a sample figure:
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
\\begin{figure}[h!]
|
|
158
|
+
\\centering
|
|
159
|
+
\\includegraphics[width=0.5\\textwidth]{example-image}
|
|
160
|
+
\\caption{Sample Figure}
|
|
161
|
+
\\label{fig:1}
|
|
162
|
+
\\end{figure}",
|
|
163
|
+
},
|
|
164
|
+
Document {
|
|
165
|
+
"id": undefined,
|
|
166
|
+
"metadata": {
|
|
167
|
+
"loc": {
|
|
168
|
+
"lines": {
|
|
169
|
+
"from": 84,
|
|
170
|
+
"to": 112,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
"pageContent": "\\section{Figures}
|
|
175
|
+
Here is a sample figure:
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
\\begin{figure}[h!]
|
|
179
|
+
\\centering
|
|
180
|
+
\\includegraphics[width=0.5\\textwidth]{example-image}
|
|
181
|
+
\\caption{Sample Figure}
|
|
182
|
+
\\label{fig:1}
|
|
183
|
+
\\end{figure}
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
\\section{Sections and Subsections}
|
|
187
|
+
This is an example of a section with subsections.
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
\\subsection{Subsection 1}
|
|
191
|
+
Content of subsection 1.
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
\\subsection{Subsection 2}
|
|
195
|
+
Content of subsection 2.
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
\\section{References}
|
|
199
|
+
Here is a reference to the table \\ref{table:1} and the figure \\ref{fig:1}.
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
\\end{document}",
|
|
203
|
+
},
|
|
204
|
+
]
|
|
205
|
+
`;
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
\documentclass{article}
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
\usepackage{graphicx} % Required for inserting images
|
|
5
|
+
\usepackage{amsmath} % Required for mathematical symbols
|
|
6
|
+
\usepackage{hyperref} % For hyperlinks
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
\title{Sample LaTeX Document}
|
|
10
|
+
\author{Generated by ChatGPT}
|
|
11
|
+
\date{\today}
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
\begin{document}
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
\maketitle
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
\tableofcontents
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
\section{Introduction}
|
|
24
|
+
This is a sample LaTeX document that includes various common elements such as sections, lists, tables, figures, and mathematical equations.
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
\section{Lists}
|
|
28
|
+
\subsection{Itemized List}
|
|
29
|
+
\begin{itemize}
|
|
30
|
+
\item First item
|
|
31
|
+
\item Second item
|
|
32
|
+
\item Third item
|
|
33
|
+
\end{itemize}
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
\subsection{Enumerated List}
|
|
37
|
+
\begin{enumerate}
|
|
38
|
+
\item First item
|
|
39
|
+
\item Second item
|
|
40
|
+
\item Third item
|
|
41
|
+
\end{enumerate}
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
\section{Mathematical Equations}
|
|
45
|
+
Here are some sample mathematical equations:
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
\subsection{Inline Equation}
|
|
49
|
+
This is an inline equation: \( E = mc^2 \).
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
\subsection{Displayed Equations}
|
|
53
|
+
\begin{equation}
|
|
54
|
+
a^2 + b^2 = c^2
|
|
55
|
+
\end{equation}
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
\begin{align}
|
|
59
|
+
x &= y + z \\
|
|
60
|
+
y &= mx + b
|
|
61
|
+
\end{align}
|
|
62
|
+
|
|
63
|
+
|
|
64
|
+
\section{Tables}
|
|
65
|
+
Here is a sample table:
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
\begin{table}[h!]
|
|
69
|
+
\centering
|
|
70
|
+
\begin{tabular}{|c|c|c|}
|
|
71
|
+
\hline
|
|
72
|
+
Header 1 & Header 2 & Header 3 \\
|
|
73
|
+
\hline
|
|
74
|
+
Data 1 & Data 2 & Data 3 \\
|
|
75
|
+
Data 4 & Data 5 & Data 6 \\
|
|
76
|
+
Data 7 & Data 8 & Data 9 \\
|
|
77
|
+
\hline
|
|
78
|
+
\end{tabular}
|
|
79
|
+
\caption{Sample Table}
|
|
80
|
+
\label{table:1}
|
|
81
|
+
\end{table}
|
|
82
|
+
|
|
83
|
+
|
|
84
|
+
\section{Figures}
|
|
85
|
+
Here is a sample figure:
|
|
86
|
+
|
|
87
|
+
|
|
88
|
+
\begin{figure}[h!]
|
|
89
|
+
\centering
|
|
90
|
+
\includegraphics[width=0.5\textwidth]{example-image}
|
|
91
|
+
\caption{Sample Figure}
|
|
92
|
+
\label{fig:1}
|
|
93
|
+
\end{figure}
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
\section{Sections and Subsections}
|
|
97
|
+
This is an example of a section with subsections.
|
|
98
|
+
|
|
99
|
+
|
|
100
|
+
\subsection{Subsection 1}
|
|
101
|
+
Content of subsection 1.
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
\subsection{Subsection 2}
|
|
105
|
+
Content of subsection 2.
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
\section{References}
|
|
109
|
+
Here is a reference to the table \ref{table:1} and the figure \ref{fig:1}.
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
\end{document}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// @vitest-environment node
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { expect } from 'vitest';
|
|
5
|
+
|
|
6
|
+
import { LatexLoader } from '../index';
|
|
7
|
+
|
|
8
|
+
describe('LatexLoader', () => {
|
|
9
|
+
it('should run', async () => {
|
|
10
|
+
const content = fs.readFileSync(join(__dirname, `./demo.tex`), 'utf-8');
|
|
11
|
+
|
|
12
|
+
const data = await LatexLoader(content);
|
|
13
|
+
|
|
14
|
+
expect(data).toMatchSnapshot();
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { LatexTextSplitter } from 'langchain/text_splitter';
|
|
2
|
+
|
|
3
|
+
import { loaderConfig } from '../config';
|
|
4
|
+
|
|
5
|
+
export const LatexLoader = async (text: string) => {
|
|
6
|
+
const splitter = new LatexTextSplitter(loaderConfig);
|
|
7
|
+
|
|
8
|
+
return await splitter.createDocuments([text]);
|
|
9
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export type LangChainLoaderType = 'code' | 'ppt' | 'pdf' | 'markdown' | 'doc' | 'text';
|
|
1
|
+
export type LangChainLoaderType = 'code' | 'ppt' | 'pdf' | 'markdown' | 'doc' | 'text' | 'latex';
|