push
This commit is contained in:
1 parent
6156a2702f
commit
d570c8b1ed
19 files changed
+1685
-267
No files matched your search
@@ -0,0 +1,13 @@
|
||||
import { Plugin, PluginID } from '@/types/plugin';
|
||||
|
||||
export const getEndpoint = (plugin: Plugin | null) => {
|
||||
if (!plugin) {
|
||||
return 'api/chat';
|
||||
}
|
||||
|
||||
if (plugin.id === PluginID.GOOGLE_SEARCH) {
|
||||
return 'api/google';
|
||||
}
|
||||
|
||||
return 'api/chat';
|
||||
};
|
||||
@@ -0,0 +1,9 @@
|
||||
export const cleanSourceText = (text: string) => {
|
||||
return text
|
||||
.trim()
|
||||
.replace(/(\n){4,}/g, '\n\n\n')
|
||||
.replace(/\n\n/g, ' ')
|
||||
.replace(/ {3,}/g, ' ')
|
||||
.replace(/\t/g, '')
|
||||
.replace(/\n+(\s*\n)*/g, '\n');
|
||||
};
|
||||
Reference in new issue
Block a user