Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pull] main from lobehub:main #81

Merged
merged 5 commits into from
Aug 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,48 @@

# Changelog

### [Version 1.12.16](https://github.com/lobehub/lobe-chat/compare/v1.12.15...v1.12.16)

<sup>Released on **2024-08-24**</sup>

#### 🐛 Bug Fixes

- **misc**: Session not found error on mobile.

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

#### What's fixed

- **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))

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.12.15](https://github.com/lobehub/lobe-chat/compare/v1.12.14...v1.12.15)

<sup>Released on **2024-08-24**</sup>

<br/>

<details>
<summary><kbd>Improvements and Fixes</kbd></summary>

</details>

<div align="right">

[![](https://img.shields.io/badge/-BACK_TO_TOP-151515?style=flat-square)](#readme-top)

</div>

### [Version 1.12.14](https://github.com/lobehub/lobe-chat/compare/v1.12.13...v1.12.14)

<sup>Released on **2024-08-24**</sup>
Expand Down
3 changes: 3 additions & 0 deletions docs/self-hosting/advanced/feature-flags.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,5 +43,8 @@ You can achieve various feature combinations using the above configuration synta
| `dalle` | Enables the DALL-E functionality. | Enabled |
| `check_updates` | Allows checking for updates. | Enabled |
| `welcome_suggest` | Displays welcome suggestions. | Enabled |
| `market` | Enables the assistant market functionality. | Enabled |
| `speech_to_text` | Enables speech-to-text functionality. | Enabled |
| `knowledge_base` | Enables the knowledge base functionality. | Enabled |

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.
3 changes: 3 additions & 0 deletions docs/self-hosting/advanced/feature-flags.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,8 @@ tags:
| `dalle` | 启用 DALL-E 功能。 | 开启 |
| `check_updates` | 允许检查更新。 | 开启 |
| `welcome_suggest` | 显示欢迎建议。 | 开启 |
| `market` | 启用助手市场功能。 | 开启 |
| `speech_to_text` | 启用语音转文本功能。 | 开启 |
| `knowledge_base` | 启用知识库功能。 | 开启 |

你可以随时检查 [featureFlags](https://github.com/lobehub/lobe-chat/blob/main/src/config/featureFlags/schema.ts) 以获取最新的特性标志列表。
2 changes: 1 addition & 1 deletion docs/self-hosting/advanced/upstream-sync.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"

# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
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
echo "Removed old images."
```

Expand Down
2 changes: 1 addition & 1 deletion docs/self-hosting/advanced/upstream-sync.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"

# 清理不再使用的镜像
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
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
echo "Removed old images."
```

Expand Down
2 changes: 1 addition & 1 deletion docs/self-hosting/platform/docker-compose.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"

# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
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
echo "Removed old images."
```

Expand Down
2 changes: 1 addition & 1 deletion docs/self-hosting/platform/docker-compose.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"

# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
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
echo "Removed old images."
```

Expand Down
2 changes: 1 addition & 1 deletion docs/self-hosting/platform/docker.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"

# Clean up unused images
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
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
echo "Removed old images."
```

Expand Down
2 changes: 1 addition & 1 deletion docs/self-hosting/platform/docker.zh-CN.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ echo "Update time: $(date)"
echo "Version: $(docker inspect lobehub/lobe-chat:latest | grep 'org.opencontainers.image.version' | awk -F'"' '{print $4}')"

# 清理不再使用的镜像
docker images | grep 'lobehub/lobe-chat' | grep -v 'latest' | awk '{print $3}' | xargs -r docker rmi > /dev/null 2>&1
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
echo "Removed old images."
```

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@lobehub/chat",
"version": "1.12.14",
"version": "1.12.16",
"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.",
"keywords": [
"framework",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { MobileNavBar } from '@lobehub/ui';
import { memo, useState } from 'react';

import { useInitAgentConfig } from '@/app/(main)/chat/(workspace)/_layout/useInitAgentConfig';
import { INBOX_SESSION_ID } from '@/const/session';
import { useQueryRoute } from '@/hooks/useQueryRoute';
import { featureFlagsSelectors, useServerConfigStore } from '@/store/serverConfig';

Expand All @@ -21,7 +22,9 @@ const MobileHeader = memo(() => {
return (
<MobileNavBar
center={<ChatHeaderTitle />}
onBackClick={() => router.push('/chat', { query: { session: '' }, replace: true })}
onBackClick={() =>
router.push('/chat', { query: { session: INBOX_SESSION_ID }, replace: true })
}
right={
<>
<ShareButton mobile open={open} setOpen={setOpen} />
Expand Down
9 changes: 9 additions & 0 deletions src/libs/langchain/loaders/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { LangChainLoaderType } from '@/libs/langchain/types';

import { CodeLoader } from './code';
import { DocxLoader } from './docx';
import { LatexLoader } from './latex';
import { MarkdownLoader } from './markdown';
import { PdfLoader } from './pdf';
import { PPTXLoader } from './pptx';
Expand Down Expand Up @@ -38,6 +39,10 @@ export class ChunkingLoader {
return await PPTXLoader(fileBlob);
}

case 'latex': {
return await LatexLoader(txt);
}

case 'pdf': {
return await PdfLoader(fileBlob);
}
Expand Down Expand Up @@ -78,6 +83,10 @@ export class ChunkingLoader {
return 'pdf';
}

if (filename.endsWith('tex')) {
return 'latex';
}

if (filename.endsWith('md') || filename.endsWith('mdx')) {
return 'markdown';
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,205 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`LatexLoader > should run 1`] = `
[
Document {
"id": undefined,
"metadata": {
"loc": {
"lines": {
"from": 1,
"to": 41,
},
},
},
"pageContent": "\\documentclass{article}


\\usepackage{graphicx} % Required for inserting images
\\usepackage{amsmath} % Required for mathematical symbols
\\usepackage{hyperref} % For hyperlinks


\\title{Sample LaTeX Document}
\\author{Generated by ChatGPT}
\\date{\\today}


\\begin{document}


\\maketitle


\\tableofcontents


\\section{Introduction}
This is a sample LaTeX document that includes various common elements such as sections, lists, tables, figures, and mathematical equations.


\\section{Lists}
\\subsection{Itemized List}
\\begin{itemize}
\\item First item
\\item Second item
\\item Third item
\\end{itemize}


\\subsection{Enumerated List}
\\begin{enumerate}
\\item First item
\\item Second item
\\item Third item
\\end{enumerate}",
},
Document {
"id": undefined,
"metadata": {
"loc": {
"lines": {
"from": 27,
"to": 61,
},
},
},
"pageContent": "\\section{Lists}
\\subsection{Itemized List}
\\begin{itemize}
\\item First item
\\item Second item
\\item Third item
\\end{itemize}


\\subsection{Enumerated List}
\\begin{enumerate}
\\item First item
\\item Second item
\\item Third item
\\end{enumerate}


\\section{Mathematical Equations}
Here are some sample mathematical equations:


\\subsection{Inline Equation}
This is an inline equation: \\( E = mc^2 \\).


\\subsection{Displayed Equations}
\\begin{equation}
a^2 + b^2 = c^2
\\end{equation}


\\begin{align}
x &= y + z \\\\
y &= mx + b
\\end{align}",
},
Document {
"id": undefined,
"metadata": {
"loc": {
"lines": {
"from": 44,
"to": 93,
},
},
},
"pageContent": "\\section{Mathematical Equations}
Here are some sample mathematical equations:


\\subsection{Inline Equation}
This is an inline equation: \\( E = mc^2 \\).


\\subsection{Displayed Equations}
\\begin{equation}
a^2 + b^2 = c^2
\\end{equation}


\\begin{align}
x &= y + z \\\\
y &= mx + b
\\end{align}


\\section{Tables}
Here is a sample table:


\\begin{table}[h!]
\\centering
\\begin{tabular}{|c|c|c|}
\\hline
Header 1 & Header 2 & Header 3 \\\\
\\hline
Data 1 & Data 2 & Data 3 \\\\
Data 4 & Data 5 & Data 6 \\\\
Data 7 & Data 8 & Data 9 \\\\
\\hline
\\end{tabular}
\\caption{Sample Table}
\\label{table:1}
\\end{table}


\\section{Figures}
Here is a sample figure:


\\begin{figure}[h!]
\\centering
\\includegraphics[width=0.5\\textwidth]{example-image}
\\caption{Sample Figure}
\\label{fig:1}
\\end{figure}",
},
Document {
"id": undefined,
"metadata": {
"loc": {
"lines": {
"from": 84,
"to": 112,
},
},
},
"pageContent": "\\section{Figures}
Here is a sample figure:


\\begin{figure}[h!]
\\centering
\\includegraphics[width=0.5\\textwidth]{example-image}
\\caption{Sample Figure}
\\label{fig:1}
\\end{figure}


\\section{Sections and Subsections}
This is an example of a section with subsections.


\\subsection{Subsection 1}
Content of subsection 1.


\\subsection{Subsection 2}
Content of subsection 2.


\\section{References}
Here is a reference to the table \\ref{table:1} and the figure \\ref{fig:1}.


\\end{document}",
},
]
`;
Loading
Loading