mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac
Some checks are pending
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Python CI / Format Backend (3.11.x) (push) Waiting to run
Python CI / Format Backend (3.12.x) (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run
Some checks are pending
Deploy to HuggingFace Spaces / check-secret (push) Waiting to run
Deploy to HuggingFace Spaces / deploy (push) Blocked by required conditions
Create and publish Docker images with specific build args / build-main-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-main-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-cuda-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/amd64) (push) Waiting to run
Create and publish Docker images with specific build args / build-ollama-image (linux/arm64) (push) Waiting to run
Create and publish Docker images with specific build args / merge-main-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-cuda-images (push) Blocked by required conditions
Create and publish Docker images with specific build args / merge-ollama-images (push) Blocked by required conditions
Python CI / Format Backend (3.11.x) (push) Waiting to run
Python CI / Format Backend (3.12.x) (push) Waiting to run
Frontend Build / Format & Build Frontend (push) Waiting to run
Frontend Build / Frontend Unit Tests (push) Waiting to run
This commit is contained in:
parent
040f29d058
commit
caa5ad44d4
@ -90,20 +90,20 @@ export const sanitizeResponseContent = (content: string) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const processResponseContent = (content: string) => {
|
export const processResponseContent = (content: string) => {
|
||||||
|
content = processChineseContent(content);
|
||||||
|
return content.trim();
|
||||||
|
};
|
||||||
|
|
||||||
|
function isChineseChar(char: string): boolean {
|
||||||
|
return /\p{Script=Han}/u.test(char);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Tackle "Model output issue not following the standard Markdown/LaTeX format" in Chinese.
|
||||||
|
function processChineseContent(content: string): string {
|
||||||
// This function is used to process the response content before the response content is rendered.
|
// This function is used to process the response content before the response content is rendered.
|
||||||
const lines = content.split('\n');
|
const lines = content.split('\n');
|
||||||
const processedLines = lines.map((line) => {
|
const processedLines = lines.map((line) => {
|
||||||
if (/[\u4e00-\u9fa5]/.test(line)) {
|
if (/[\u4e00-\u9fa5]/.test(line)) {
|
||||||
line = processChineseContent(line);
|
|
||||||
}
|
|
||||||
return line;
|
|
||||||
});
|
|
||||||
content = processedLines.join('\n');
|
|
||||||
return content.trim();
|
|
||||||
};
|
|
||||||
|
|
||||||
// Tackle "Model output issue not following the standard Markdown/LaTeX format" in Chinese.
|
|
||||||
function processChineseContent(line: string): string {
|
|
||||||
// Problems caused by Chinese parentheses
|
// Problems caused by Chinese parentheses
|
||||||
/* Discription:
|
/* Discription:
|
||||||
* When `*` has Chinese parentheses on the inside, markdown parser ignore bold or italic style.
|
* When `*` has Chinese parentheses on the inside, markdown parser ignore bold or italic style.
|
||||||
@ -123,11 +123,12 @@ function processChineseContent(line: string): string {
|
|||||||
// Handle *italic* with Chinese parentheses
|
// Handle *italic* with Chinese parentheses
|
||||||
line = processChineseParentheses(line, '*', '(', ')');
|
line = processChineseParentheses(line, '*', '(', ')');
|
||||||
}
|
}
|
||||||
return line;
|
|
||||||
}
|
}
|
||||||
|
return line;
|
||||||
|
});
|
||||||
|
content = processedLines.join('\n');
|
||||||
|
|
||||||
function isChineseChar(char: string): boolean {
|
return content;
|
||||||
return /\p{Script=Han}/u.test(char);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Helper function for `processChineseContent`
|
// Helper function for `processChineseContent`
|
||||||
|
Loading…
Reference in New Issue
Block a user