Merge remote-tracking branch 'origin/dev' into feat/model-config

This commit is contained in:
Jun Siang Cheah
2024-05-20 09:02:41 +01:00
57 changed files with 899 additions and 290 deletions

View File

@@ -30,70 +30,17 @@
};
const checkPythonCode = (str) => {
// Check if the string contains typical Python keywords, syntax, or functions
const pythonKeywords = [
'def',
'class',
'import',
'from',
'if',
'else',
'elif',
'for',
'while',
'try',
'except',
'finally',
'return',
'yield',
'lambda',
'assert',
'pass',
'break',
'continue',
'global',
'nonlocal',
'del',
'True',
'False',
'None',
'and',
'or',
'not',
'in',
'is',
'as',
'with'
];
for (let keyword of pythonKeywords) {
if (str.includes(keyword)) {
return true;
}
}
// Check if the string contains typical Python syntax characters
const pythonSyntax = [
'def ',
'class ',
'import ',
'from ',
'if ',
'else:',
'elif ',
'for ',
'while ',
'try:',
'except:',
'finally:',
'return ',
'yield ',
'lambda ',
'assert ',
'pass',
'break',
'continue',
'global ',
'nonlocal ',
'del ',
'True',
@@ -104,29 +51,7 @@
' not ',
' in ',
' is ',
' as ',
' with ',
':',
'=',
'==',
'!=',
'>',
'<',
'>=',
'<=',
'+',
'-',
'*',
'/',
'%',
'**',
'//',
'(',
')',
'[',
']',
'{',
'}'
' with '
];
for (let syntax of pythonSyntax) {
@@ -186,7 +111,8 @@
code.includes('matplotlib') ? 'matplotlib' : null,
code.includes('sklearn') ? 'scikit-learn' : null,
code.includes('scipy') ? 'scipy' : null,
code.includes('re') ? 'regex' : null
code.includes('re') ? 'regex' : null,
code.includes('seaborn') ? 'seaborn' : null
].filter(Boolean);
console.log(packages);
@@ -235,7 +161,8 @@ __builtins__.input = input`);
code.includes('pandas') ? 'pandas' : null,
code.includes('sklearn') ? 'scikit-learn' : null,
code.includes('scipy') ? 'scipy' : null,
code.includes('re') ? 'regex' : null
code.includes('re') ? 'regex' : null,
code.includes('seaborn') ? 'seaborn' : null
].filter(Boolean);
console.log(packages);

View File

@@ -68,11 +68,11 @@
<!-- svelte-ignore a11y-click-events-have-key-events -->
<div
class=" snap-center min-w-80 w-full max-w-full m-1 outline outline-1 {history.messages[
class=" snap-center min-w-80 w-full max-w-full m-1 border {history.messages[
currentMessageId
].model === model
? 'outline-gray-200 dark:outline-gray-700 outline-2'
: 'outline-gray-100 dark:outline-gray-850 '} transition p-6 rounded-3xl"
? 'border-gray-100 dark:border-gray-700 border-[1.5px]'
: 'border-gray-50 dark:border-gray-850 '} transition p-5 rounded-3xl"
on:click={() => {
currentMessageId = groupedMessages[model].messages[groupedMessagesIdx[model]].id;

View File

@@ -5,7 +5,7 @@
export let src = '/user.png';
</script>
<div class={$settings?.chatDirection === 'LTR' ? 'mr-3' : 'ml-3'}>
<div class={($settings?.chatDirection ?? 'LTR') === 'LTR' ? 'mr-3' : 'ml-3'}>
<img
crossorigin="anonymous"
src={src.startsWith(WEBUI_BASE_URL) ||