enhanced UI

This commit is contained in:
Saifeddine ALOUI 2023-08-23 04:21:58 +02:00
parent 6e284ed346
commit 413103216c
17 changed files with 226 additions and 127 deletions

View File

@ -490,10 +490,10 @@ class LoLLMsAPPI(LollmsApplication):
path:Path = self.lollms_paths.personal_uploads_path / self.personality.personality_folder_name
path.mkdir(parents=True, exist_ok=True)
file_path = path / data["filename"]
File64BitsManager.b642file(data["fileData"],file_path)
if self.personality.processor:
self.personality.processor.add_file(file_path, partial(self.process_chunk, client_id=client_id))
else:
self.personality.add_file(file_path, partial(self.process_chunk, client_id=client_id))
self.socketio.emit('file_received',
{
"status":True,
@ -754,7 +754,7 @@ class LoLLMsAPPI(LollmsApplication):
if id_==-1:
message = self.connections[client_id]["current_discussion"].current_message
else:
message = self.connections[client_id]["current_discussion"].select_message(id_)
message = self.connections[client_id]["current_discussion"].get_message(id_)
if message is None:
return
self.connections[client_id]['generation_thread'] = threading.Thread(target=self.start_message_generation, args=(message, message.id, client_id))
@ -777,7 +777,7 @@ class LoLLMsAPPI(LollmsApplication):
if id_==-1:
message = self.connections[client_id]["current_discussion"].current_message
else:
message = self.connections[client_id]["current_discussion"].select_message(id_)
message = self.connections[client_id]["current_discussion"].get_message(id_)
self.connections[client_id]['generation_thread'] = threading.Thread(target=self.start_message_generation, args=(message, message.id, client_id, True))
self.connections[client_id]['generation_thread'].start()
@ -954,13 +954,32 @@ class LoLLMsAPPI(LollmsApplication):
nb_tk = max_prompt_stx_size-n_cond_tk
composed_messages = self.model.detokenize(t[-nb_tk:])
ASCIIColors.warning(f"Cropping discussion to fit context [using {nb_tk} tokens/{self.config.ctx_size}]")
discussion_messages = self.personality.personality_conditioning+ composed_messages
discussion_messages = composed_messages
tokens = self.model.tokenize(discussion_messages)
if self.config["debug"]:
ASCIIColors.yellow(discussion_messages)
ASCIIColors.info(f"prompt size:{len(tokens)} tokens")
if len(self.personality.files)>0 and self.personality.vectorizer:
pr = PromptReshaper("!@>Documentation:{{doc}}\n{{conditionning}}{{content}}")
emb = self.personality.vectorizer.embed_query(message.content)
doc = self.personality.vectorizer.recover_text(emb, top_k=self.config.data_vectorization_nb_chunks)
// TODO, fix
discussion_messages = pr.build({
"doc":doc,
"conditionning":self.personality.personality_conditioning,
"content":discussion_messages
}, self.model.tokenize, self.model.detokenize, self.config.ctx_size, place_holders_to_sacrifice=["content"])
else:
pr = PromptReshaper("{{conditionning}}\n{{content}}")
discussion_messages = pr.build({
"conditionning":self.personality.personality_conditioning,
"content":discussion_messages
}, self.model.tokenize, self.model.detokenize, self.config.ctx_size, place_holders_to_sacrifice=["content"])
return discussion_messages, message.content, tokens
def get_discussion_to(self, client_id, message_id=-1):
@ -1187,8 +1206,6 @@ class LoLLMsAPPI(LollmsApplication):
print("Finished executing the workflow")
return
if len(self.personality.files)>0:
PromptReshaper("Documentation:{{doc}}\n{{Content}}")
self._generate(full_prompt, n_predict, client_id, callback)
ASCIIColors.success("\nFinished executing the generation")

View File

@ -548,13 +548,21 @@ class Discussion:
return self.messages
def select_message(self, message_id):
def get_message(self, message_id):
for message in self.messages:
if message.id == message_id:
if message.id == int(message_id):
self.current_message = message
return message
return None
def select_message(self, message_id):
msg = self.get_message(message_id)
if msg is not None:
self.current_message = msg
return True
else:
return False
def update_message(self, new_content, new_metadata=None):
"""Updates the content of a message
@ -563,7 +571,22 @@ class Discussion:
new_content (str): The nex message content
"""
self.current_message.update(new_content, new_metadata)
def edit_message(self, message_id, new_content, new_metadata=None):
"""Edits the content of a message
Args:
message_id (int): The id of the message to be changed
new_content (str): The nex message content
"""
msg = self.get_message(message_id)
if msg:
msg.update(new_content, new_metadata)
return True
else:
return False
def message_rank_up(self, message_id):
"""Increments the rank of the message

5
app.py
View File

@ -1579,12 +1579,13 @@ class LoLLMsWebUI(LoLLMsAPPI):
def edit_message(self):
client_id = request.args.get("client_id")
discussion_id = request.args.get("id")
message_id = request.args.get("id")
new_message = request.args.get("message")
try:
self.connections[client_id]["current_discussion"].edit_message(discussion_id, new_message)
self.connections[client_id]["current_discussion"].edit_message(message_id, new_message)
return jsonify({"status": True})
except Exception as ex:
trace_exception(ex)
return jsonify({"status": False, "error":str(ex)})

View File

@ -1,5 +1,5 @@
# =================== Lord Of Large Language Models Configuration file ===========================
version: 16
version: 19
binding_name: null
model_name: null
@ -46,4 +46,12 @@ audio_in_language: 'en-US'
audio_out_voice: null
auto_speak: false
audio_pitch: 1
silenceTimer: 5000
silenceTimer: 5000
# Data vectorization
data_vectorization_method: "ftidf_vectorizer" #"model_embedding" or "ftidf_vectorizer"
data_visualization_method: "PCA" #"PCA" or "TSNE"
data_vectorization_save_db: False # For each new session, new files
data_vectorization_chunk_size: 512 # chunk size
data_vectorization_overlap_size: 128 # overlap between chunks size
data_vectorization_nb_chunks: 2 # number of chunks to use

View File

@ -4,11 +4,10 @@
"Simple Question Answer":"User:@<What is your question>@\nAssistant:@<generation_placeholder>@",
"Question Answer with conditionning":"Assistant is a highly developed AI capable of answering any question about any subject.\nUser:@<What's your question?>\nAssistant:@<generation_placeholder>@",
"Instruct mode": "Instructions:\n@<Give instructions to the AI>@\nAnswer:@<generation_placeholder>@",
"Code explainer": "# Code\n```@<Programming language:python>@\n@<Code to document>@\n```\n# Documantation\n```markdown\n@<generation_placeholder>@\n```\n",
"Make a function": "Here is a @<Language:python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio@ function that @<describe the function you want lollms to build>@:\n```@<Language:python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio>@\n@<generation_placeholder>@",
"Fix a code": "Here is a @<Language:python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio>@ code:\n```@<Language:python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio>@\n@<Input your code>@\n```\nInstruction:Check this code and fix any errors if there are any.\nAI:@<generation_placeholder>@",
"Make programming project": "```@<Language:python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio>@\n# project: @<Project name>@ \n# author: @<Author name>@\n# description: @<The description of the code>@\n\n@<generation_placeholder>@\n```\n---------\nExtra information:\nLicence: apache 2.0\nProgram type: Stand alone.\nDocumentation:\nMake README.md with the following table of contents:\n## Description\n## Installation\n## Usage\n## Licence\n## Contribute\n## Ethical guidelines\nInstructions:\nWrite a user side README.md\nStick to the provided code content and do not invent extra information.\nMake sure all sections of the table of contents are present in the file.\n----\nREADME.md:\n```markdown\n@<generation_placeholder>@\n```",
"Explain code": "```@<Language:python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio>@\n@<put your code here>@\n```\nHere is an explanation of the previous method:",
"Translate code file": "Instruction: Translate the comments and values of the @<File type:yaml:json:python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio>@ file from @<Source language:english:french:german:chinese:japanese:spanish:italian:russian:portuguese:swedish:danish:dutch:norwegian:slovak:czech:hungarian:polish:ukrainian:bulgarian:latvian:lithuanian:estonian:maltese:irish:galician:basque:welsh:breton:georgian:turkmen:kazakh:uzbek:tajik:afghan:sri-lankan:filipino:vietnamese:lao:cambodian:thai:burmese:kenyan:botswanan:zimbabwean:malawian:mozambican:angolan:namibian:south-african:madagascan:seychellois:mauritian:haitian:peruvian:ecuadorian:bolivian:paraguayan:chilean:argentinean:uruguayan:brazilian:colombian:venezuelan:puerto-rican:cuban:dominican:honduran:nicaraguan:salvadorean:guatemalan:el-salvadoran:belizean:panamanian:costa-rican:antiguan:barbudan:dominica's:grenada's:st-lucia's:st-vincent's:gibraltarian:faroe-islander:greenlandic:icelandic:jamaican:trinidadian:tobagonian:barbadian:anguillan:british-virgin-islander:us-virgin-islander:turkish:israeli:palestinian:lebanese:egyptian:libyan:tunisian:algerian:moroccan:bahraini:kuwaiti:saudi-arabian:yemeni:omani:irani:iraqi:afghanistan's:pakistani:indian:nepalese:sri-lankan:maldivan:burmese:thai:lao:vietnamese:kampuchean:malaysian:bruneian:indonesian:australian:new-zealanders:fijians:tongans:samoans:vanuatuans:wallisians:kiribatians:tuvaluans:solomon-islanders:marshallese:micronesians:hawaiians> to @<Destination language:english:french:german:chinese:japanese:spanish:italian:russian:portuguese:swedish:danish:dutch:norwegian:slovak:czech:hungarian:polish:ukrainian:bulgarian:latvian:lithuanian:estonian:maltese:irish:galician:basque:welsh:breton:georgian:turkmen:kazakh:uzbek:tajik:afghan:sri-lankan:filipino:vietnamese:lao:cambodian:thai:burmese:kenyan:botswanan:zimbabwean:malawian:mozambican:angolan:namibian:south-african:madagascan:seychellois:mauritian:haitian:peruvian:ecuadorian:bolivian:paraguayan:chilean:argentinean:uruguayan:brazilian:colombian:venezuelan:puerto-rican:cuban:dominican:honduran:nicaraguan:salvadorean:guatemalan:el-salvadoran:belizean:panamanian:costa-rican:antiguan:barbudan:dominica's:grenada's:st-lucia's:st-vincent's:gibraltarian:faroe-islander:greenlandic:icelandic:jamaican:trinidadian:tobagonian:barbadian:anguillan:british-virgin-islander:us-virgin-islander:turkish:israeli:palestinian:lebanese:egyptian:libyan:tunisian:algerian:moroccan:bahraini:kuwaiti:saudi-arabian:yemeni:omani:irani:iraqi:afghanistan's:pakistani:indian:nepalese:sri-lankan:maldivan:burmese:thai:lao:vietnamese:kampuchean:malaysian:bruneian:indonesian:australian:new-zealanders:fijians:tongans:samoans:vanuatuans:wallisians:kiribatians:tuvaluans:solomon-islanders:marshallese:micronesians:hawaiians>.\nSession 1:\n```yaml language=english\n# This is a comment\nparameter_1: this is parameter 1\nparameter_2: this is parameter 2\nparameter_3: 25\nparameter_4: |\n This is a multi\n line parameter\n```\n```yaml language=french\n# Ceci est un commentaire\nparameter_1: ceci est le param\u00e8tre 1\nparameter_2: ceci est le param\u00e8tre 2\nparameter_3: 25\nparameter_4: |\n Ceci est une multiligne\n ligne de param\u00e8tre\n```\nSession 2:\n```yaml language=english\n@<Put your yaml data here>@\n```\n```yaml language=french",
"Translate text": "```@<Source language:english:french:german:chinese:japanese:spanish:italian:russian:portuguese:swedish:danish:dutch:norwegian:slovak:czech:hungarian:polish:ukrainian:bulgarian:latvian:lithuanian:estonian:maltese:irish:galician:basque:welsh:breton:georgian:turkmen:kazakh:uzbek:tajik:afghan:sri-lankan:filipino:vietnamese:lao:cambodian:thai:burmese:kenyan:botswanan:zimbabwean:malawian:mozambican:angolan:namibian:south-african:madagascan:seychellois:mauritian:haitian:peruvian:ecuadorian:bolivian:paraguayan:chilean:argentinean:uruguayan:brazilian:colombian:venezuelan:puerto-rican:cuban:dominican:honduran:nicaraguan:salvadorean:guatemalan:el-salvadoran:belizean:panamanian:costa-rican:antiguan:barbudan:dominica's:grenada's:st-lucia's:st-vincent's:gibraltarian:faroe-islander:greenlandic:icelandic:jamaican:trinidadian:tobagonian:barbadian:anguillan:british-virgin-islander:us-virgin-islander:turkish:israeli:palestinian:lebanese:egyptian:libyan:tunisian:algerian:moroccan:bahraini:kuwaiti:saudi-arabian:yemeni:omani:irani:iraqi:afghanistan's:pakistani:indian:nepalese:sri-lankan:maldivan:burmese:thai:lao:vietnamese:kampuchean:malaysian:bruneian:indonesian:australian:new-zealanders:fijians:tongans:samoans:vanuatuans:wallisians:kiribatians:tuvaluans:solomon-islanders:marshallese:micronesians:hawaiians>@\n@<Text to translate>@\n```\n```@<Destination language:english:french:german:chinese:japanese:spanish:italian:russian:portuguese:swedish:danish:dutch:norwegian:slovak:czech:hungarian:polish:ukrainian:bulgarian:latvian:lithuanian:estonian:maltese:irish:galician:basque:welsh:breton:georgian:turkmen:kazakh:uzbek:tajik:afghan:sri-lankan:filipino:vietnamese:lao:cambodian:thai:burmese:kenyan:botswanan:zimbabwean:malawian:mozambican:angolan:namibian:south-african:madagascan:seychellois:mauritian:haitian:peruvian:ecuadorian:bolivian:paraguayan:chilean:argentinean:uruguayan:brazilian:colombian:venezuelan:puerto-rican:cuban:dominican:honduran:nicaraguan:salvadorean:guatemalan:el-salvadoran:belizean:panamanian:costa-rican:antiguan:barbudan:dominica's:grenada's:st-lucia's:st-vincent's:gibraltarian:faroe-islander:greenlandic:icelandic:jamaican:trinidadian:tobagonian:barbadian:anguillan:british-virgin-islander:us-virgin-islander:turkish:israeli:palestinian:lebanese:egyptian:libyan:tunisian:algerian:moroccan:bahraini:kuwaiti:saudi-arabian:yemeni:omani:irani:iraqi:afghanistan's:pakistani:indian:nepalese:sri-lankan:maldivan:burmese:thai:lao:vietnamese:kampuchean:malaysian:bruneian:indonesian:australian:new-zealanders:fijians:tongans:samoans:vanuatuans:wallisians:kiribatians:tuvaluans:solomon-islanders:marshallese:micronesians:hawaiians>@\n@<Remove this block and place the cursor here to make the AI generate the translation>@\n```\n"
"Make a function": "Here is a @<Language:all_programming_language_options>@ function that @<describe the function you want lollms to build>@:\n```@<Language:all_programming_language_options>@\n@<generation_placeholder>@",
"Fix a code": "Here is a @<Language:all_programming_language_options>@ code:\n```@<Language:all_programming_language_options>@\n@<Input your code>@\n```\nInstruction:Check this code and fix any errors if there are any.\nAI:@<generation_placeholder>@",
"Make programming project": "```@<Language:all_programming_language_options>@\n# project: @<Project name>@ \n# author: @<Author name>@\n# description: @<The description of the code>@\n\n@<generation_placeholder>@\n```\n---------\nExtra information:\nLicence: apache 2.0\nProgram type: Stand alone.\nDocumentation:\nMake README.md with the following table of contents:\n## Description\n## Installation\n## Usage\n## Licence\n## Contribute\n## Ethical guidelines\nInstructions:\nWrite a user side README.md\nStick to the provided code content and do not invent extra information.\nMake sure all sections of the table of contents are present in the file.\n----\nREADME.md:\n```markdown\n@<generation_placeholder>@\n```",
"Explain code": "```@<Language:all_programming_language_options>@\n@<put your code here>@\n```\nHere is an explanation of the previous method:",
"Translate code file strings": "Instruction: Translate the comments and values of the @<File type:yaml:json:all_programming_language_options>@ file from @<Source language:all_language_options>@ to @<Destination language:all_language_options>@.\nSession 1:\n```yaml language=english\n# This is a comment\nparameter_1: this is parameter 1\nparameter_2: this is parameter 2\nparameter_3: 25\nparameter_4: |\n This is a multi\n line parameter\n```\n```yaml language=french\n# Ceci est un commentaire\nparameter_1: ceci est le param\u00e8tre 1\nparameter_2: ceci est le param\u00e8tre 2\nparameter_3: 25\nparameter_4: |\n Ceci est une multiligne\n ligne de param\u00e8tre\n```\nSession 2:\n```yaml language=english\n@<Put your yaml data here>@\n```\n```yaml language=french",
"Translate text": "```@<Source language:all_language_options>@\n@<Text to translate>@\n```\n```@<Destination language:all_language_options>@\n@<generation_placeholder>@\n```\n"
}

View File

@ -457,7 +457,11 @@ table {
border-collapse: collapse;
}
h1,
h1 {
font-size: 36px;
font-weight: bold;
}
h2,
h3,
h4,

View File

@ -70,7 +70,11 @@ abbr:where([title]) {
Remove the default font size and weight for headings.
*/
h1,
h1 {
font-size: 36px;
font-weight: bold;
}
h2,
h3,
h4,
@ -300,6 +304,7 @@ menu {
padding: 0;
}
/*
Prevent resizing textareas horizontally by default.
*/
@ -785,4 +790,16 @@ video {
top: 12px;
height: 18px;
}
}
}
li {
text-shadow: #0000;
}
ul {
list-style-type: disc;
}
ol {
list-style-type: decimal;
}

File diff suppressed because one or more lines are too long

8
web/dist/assets/index-3540572d.css vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
web/dist/index.html vendored
View File

@ -6,8 +6,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI - Welcome</title>
<script type="module" crossorigin src="/assets/index-c2c8591c.js"></script>
<link rel="stylesheet" href="/assets/index-39c6717e.css">
<script type="module" crossorigin src="/assets/index-0d84a618.js"></script>
<link rel="stylesheet" href="/assets/index-3540572d.css">
</head>
<body>
<div id="app"></div>

View File

@ -31,3 +31,36 @@
.display-none {
@apply hidden;
}
h1 {
font-size: 36px;
font-weight: bold;
}
h2 {
font-size: 24px;
font-weight: bold;
}
h3 {
font-size: 18px;
font-weight: bold;
}
h4 {
font-size: 18px;
font-style: italic;
}
/* Include any additional styles you need */
ul {
list-style-type: disc;
margin-left: 5px;
}
ol {
list-style-type: decimal;
}

View File

@ -5,8 +5,8 @@
</button>
<transition name="slide">
<div v-if="isMenuOpen" class="menu-list flex-grow" :style="menuPosition" ref="menu">
<ul class="flex-grow">
<li v-for="(command, index) in commands" :key="index" @click="executeCommand(command)" class="menu-command flex-grow hover:bg-blue-400 ">
<ul class="flex-grow menu-ul">
<li v-for="(command, index) in commands" :key="index" @click="executeCommand(command)" class="menu-command menu-li flex-grow hover:bg-blue-400 ">
<img v-if="command.icon && !command.is_file" :src="command.icon" :alt="command.name" class="menu-icon">
<span v-else class="menu-icon"></span>
<span>{{ command.name }}</span>
@ -133,13 +133,13 @@ handleClickOutside(event) {
transform: translateY(-10px);
}
ul {
.menu-ul {
list-style: none;
padding: 0;
margin: 0;
}
li {
.menu-li {
cursor: pointer;
display: flex;
align-items: center;

View File

@ -148,32 +148,6 @@ markdownIt.renderer.rules.link_open = (tokens, idx, options, env, self) => {
};
// Define a custom rendering function for lists
const renderList = (tokens, idx, options, env, self) => {
const token = tokens[idx];
const listType = token.attrGet('type') || 'ul'; // Default to unordered list
// Custom handling for unordered lists
if (listType === 'ul') {
// Add Tailwind CSS classes for unordered lists
return '<ul class="list-disc ml-4">' + self.renderToken(tokens, idx, options) + '</ul>';
}
// Custom handling for ordered lists
if (listType === 'ol') {
// Add Tailwind CSS classes for ordered lists
return '<ol class="list-decimal ml-4">' + self.renderToken(tokens, idx, options) + '</ol>';
}
// Fallback to the default renderer for other list types
return self.renderToken(tokens, idx, options);
};
// Override the default list renderer with the custom function
markdownIt.renderer.rules.bullet_list_open = renderList;
markdownIt.renderer.rules.ordered_list_open = renderList;
export default {
name: 'MarkdownRenderer',
@ -256,14 +230,3 @@ export default {
},
};
</script>
<style>
/* Include any additional styles you need */
ul {
list-style-type: disc;
}
ol {
list-style-type: decimal;
}
</style>

View File

@ -1,38 +1,38 @@
<template>
<div v-if="$store.state.ready" class="container flex flex-col sm:flex-row items-center">
<div class="w-full">
<ul class="flex flex-row font-medium">
<li>
<ul class="flex flex-row font-medium nav-ul">
<li class="nav-li">
<RouterLink :to="{ name: 'discussions' }" class="link-item dark:link-item-dark">
Discussions
</RouterLink>
</li>
<li>
<li class="nav-li">
<RouterLink :to="{ name: 'playground' }" class="link-item dark:link-item-dark">
Playground
</RouterLink>
</li>
<li>
<li class="nav-li">
<RouterLink :to="{ name: 'settings' }" class="link-item dark:link-item-dark">
Settings
</RouterLink>
</li>
<li>
<li class="nav-li">
<RouterLink :to="{ name: 'extensions' }" class="link-item dark:link-item-dark">
Extensions
</RouterLink>
</li>
<li>
<li class="nav-li">
<RouterLink :to="{ name: 'training' }" class="link-item dark:link-item-dark">
Training
</RouterLink>
</li>
<li>
<li class="nav-li">
<RouterLink :to="{ name: 'quantizing' }" class="link-item dark:link-item-dark">
Quantizing
</RouterLink>
</li>
<li>
<li class="nav-li">
<RouterLink :to="{ name: 'help' }" class="link-item dark:link-item-dark">
Help
</RouterLink>
@ -126,10 +126,21 @@
/* Ensure each li extends to the bottom of its container */
ul {
.nav-ul {
list-style: none;
padding: 0;
margin: 0;
display: flex;
flex-direction: column;
height: 100%;
}
.nav-li {
cursor: pointer;
display: flex;
align-items: center;
padding: 5px;
}
</style>

View File

@ -115,7 +115,7 @@ async function showInputPanel(name, default_value="", options=[]) {
if(options.length===0){
panel.innerHTML = `
<div class="bg-white p-6 rounded-md shadow-md w-80">
<h2 class="text-lg font-semibold mb-3">"${name}"</h2>
<h2 class="text-lg font-semibold mb-3">${name}</h2>
<textarea id="replacementInput" class="w-full h-32 border rounded p-2 mb-3">${default_value}</textarea>
<div class="flex justify-end">
<button id="cancelButton" class="mr-2 px-4 py-2 border rounded">Cancel</button>
@ -127,7 +127,7 @@ async function showInputPanel(name, default_value="", options=[]) {
else{
panel.innerHTML = `
<div class="bg-white p-6 rounded-md shadow-md w-80">
<h2 class="text-lg font-semibold mb-3">"${name}"</h2>
<h2 class="text-lg font-semibold mb-3">${name}</h2>
<select id="options_selector" class="form-control w-full h-25 border rounded p-2 mb-3">
${options.map(option => `<option value="${option}">${option}</option>`)}
</select>
@ -186,6 +186,23 @@ function replaceInText(text, callback) {
let placeholder = match.toLowerCase().substring(2,match.length-2);
if (placeholder !== "generation_placeholder") {
if (placeholder.includes(":")) {
// Special key words
let key_words_dict={
"all_language_options":"english:french:german:chinese:japanese:spanish:italian:russian:portuguese:swedish:danish:dutch:norwegian:slovak:czech:hungarian:polish:ukrainian:bulgarian:latvian:lithuanian:estonian:maltese:irish:galician:basque:welsh:breton:georgian:turkmen:kazakh:uzbek:tajik:afghan:sri-lankan:filipino:vietnamese:lao:cambodian:thai:burmese:kenyan:botswanan:zimbabwean:malawian:mozambican:angolan:namibian:south-african:madagascan:seychellois:mauritian:haitian:peruvian:ecuadorian:bolivian:paraguayan:chilean:argentinean:uruguayan:brazilian:colombian:venezuelan:puerto-rican:cuban:dominican:honduran:nicaraguan:salvadorean:guatemalan:el-salvadoran:belizean:panamanian:costa-rican:antiguan:barbudan:dominica's:grenada's:st-lucia's:st-vincent's:gibraltarian:faroe-islander:greenlandic:icelandic:jamaican:trinidadian:tobagonian:barbadian:anguillan:british-virgin-islander:us-virgin-islander:turkish:israeli:palestinian:lebanese:egyptian:libyan:tunisian:algerian:moroccan:bahraini:kuwaiti:saudi-arabian:yemeni:omani:irani:iraqi:afghanistan's:pakistani:indian:nepalese:sri-lankan:maldivan:burmese:thai:lao:vietnamese:kampuchean:malaysian:bruneian:indonesian:australian:new-zealanders:fijians:tongans:samoans:vanuatuans:wallisians:kiribatians:tuvaluans:solomon-islanders:marshallese:micronesians:hawaiians",
"all_programming_language_options":"python:c:c++:java:javascript:php:ruby:go:swift:kotlin:rust:haskell:erlang:lisp:scheme:prolog:cobol:fortran:pascal:delphi:d:eiffel:h:basic:visual_basic:smalltalk:objective-c:html5:node.js:vue.js:svelte:react:angular:ember:clipper:stex:arduino:brainfuck:r:assembly:mason:lepton:seacat:bbc_microbit:raspberry_pi_gpio:raspberry_pi_spi:raspberry_pi_i2c:raspberry_pi_uart:raspberry_pi_adc:raspberry_pi_ddio"
}
Object.entries(key_words_dict).forEach(([key, value]) => {
console.log(`Key: ${key}, Value: ${value}`);
function escapeRegExp(string) {
return string.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); // Escape special characters
}
const escapedKey = escapeRegExp(key);
const regex = new RegExp(escapedKey, 'g');
placeholder = placeholder.replace(regex, value);
//text = text.replace(new RegExp(key, 'g'), value);
});
let splitResult = placeholder.split(":");
let name = splitResult[0];
let defaultValue = splitResult[1] || "";

View File

@ -5,6 +5,7 @@ module.exports = {
'./src/**/*.{vue,js,ts,jsx,tsx}',
'node_modules/flowbite-vue/**/*.{js,jsx,ts,tsx}'
],
darkMode: 'class',
theme: {
extend: {
@ -35,5 +36,10 @@ module.exports = {
}
}
},
plugins: [require('flowbite/plugin'), require('tailwind-scrollbar')]
plugins: [require('flowbite/plugin'), require('tailwind-scrollbar')],
variants: {
h1: {
fontWeight: 'bold'
}
}
}