Fixed a continue prompt error

This commit is contained in:
Saifeddine ALOUI 2024-11-24 18:27:28 +01:00
parent d93e2afb2a
commit bc56a67b97
7 changed files with 152 additions and 152 deletions

View File

@ -47,7 +47,7 @@ use_continue_message: true
seed: -1
ctx_size: 4084
max_n_predict: 4096
max_n_predict: None
min_n_predict: 1024
temperature: 0.9
top_k: 50

View File

@ -27,9 +27,9 @@ class LollmsClient {
constructor(
host_address = null,
model_name = null,
ctx_size = 4096,
ctx_size = null,
personality = -1,
n_predict = 4096,
n_predict = null,
temperature = 0.1,
top_k = 50,
top_p = 0.95,
@ -46,7 +46,7 @@ class LollmsClient {
this.host_address = host_address;
this.model_name = model_name;
this.ctx_size = ctx_size;
this.n_predict = n_predict?n_predict:4096;
this.n_predict = n_predict?n_predict:null;
this.personality = personality;
this.temperature = temperature;
this.top_k = top_k;
@ -597,7 +597,7 @@ async generateCode(prompt, images = [], {
while (!codes[0].is_complete) {
console.warn("The AI did not finish the code, let's ask it to continue")
const continuePrompt = prompt + code + this.userFullHeader + "continue the code. Rewrite last line and continue the code. Don't forget to put the code inside a markdown code tag." + this.separatorTemplate() + this.aiFullHeader;
response = await this.generate(fullPrompt, {
response = await this.generate(continuePrompt, {
n_predict: n_predict,
temperature: temperature,
top_k: top_k,

View File

@ -1330,7 +1330,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
self.discussion_messages,
self.current_message,
context_details=context_details,
n_predict = min(self.config.ctx_size-len(tokens)-1,self.config.max_n_predict),
n_predict = min(self.config.ctx_size-len(tokens)-1,self.config.max_n_predict if self.config.max_n_predict else self.config.ctx_size-len(tokens)-1),
client_id=client_id,
callback=partial(self.process_data,client_id = client_id)
)
@ -1544,7 +1544,7 @@ class LOLLMSWebUI(LOLLMSElfServer):
)
client.generated_text = ""
ASCIIColors.info(f"prompt has {self.config.ctx_size-context_details['available_space']} tokens")
ASCIIColors.info(f"warmup for generating up to {min(context_details['available_space'],self.config.max_n_predict)} tokens")
self.generate(discussion_messages, current_message, context_details, min(self.config.ctx_size-len(tokens)-1, self.config.max_n_predict), client.client_id, callback if callback else partial(self.process_data, client_id=client.client_id))
ASCIIColors.info(f"warmup for generating up to {min(context_details['available_space'],self.config.max_n_predict if self.config.max_n_predict else self.config.ctx_size)} tokens")
self.generate(discussion_messages, current_message, context_details, min(self.config.ctx_size-len(tokens)-1,self.config.max_n_predict if self.config.max_n_predict else self.config.ctx_size-len(tokens)-1), client.client_id, callback if callback else partial(self.process_data, client_id=client.client_id))
self.close_message(client.client_id)
return client.generated_text

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 @@
<script src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>LoLLMS WebUI</title>
<script type="module" crossorigin src="/assets/index-BuUbNjYz.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-Da3KZyx_.css">
<script type="module" crossorigin src="/assets/index-CMcKC3ij.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CgEQAUVL.css">
</head>
<body>
<div id="app"></div>

View File

@ -142,11 +142,11 @@
<div v-else class="text-2xl svg-button w-6 hover:text-primary duration-150 cursor-pointer ml-2" title="Switch to Dark theme" @click="themeSwitch()">
<i data-feather="moon"></i>
</div>
<div class="language-selector relative ml-2">
<div class="relative ml-2">
<button @click="toggleLanguageMenu" class="bg-transparent svg-button py-1 px-1 rounded font-bold uppercase transition-colors duration-300 hover:bg-blue-500">
{{ $store.state.language.slice(0, 2) }}
</button>
<div v-if="isLanguageMenuVisible" ref="languageMenu" class="container context-menu absolute left-0 mt-1 rounded shadow-lg z-10 overflow-y-auto scrollbar-thin scrollbar-track-bg-light-tone scrollbar-thumb-bg-light-tone-panel hover:scrollbar-thumb-primary dark:scrollbar-track-bg-dark-tone dark:scrollbar-thumb-bg-dark-tone-panel dark:hover:scrollbar-thumb-primary active:scrollbar-thumb-secondary" style="position: absolute; top: 100%; width: 200px; max-height: 300px; overflow-y: auto;">
<div v-if="isLanguageMenuVisible" ref="languageMenu" class="container context-menu absolute left-0 mt-1 rounded shadow-lg z-10 overflow-y-auto scrollbar-thin" style="position: absolute; top: 100%; width: 200px; max-height: 300px; overflow-y: auto;">
<ul style="list-style-type: none; padding-left: 0; margin-left: 0;">
<li v-for="language in languages" :key="language" class="relative flex items-center" style="padding-left: 0; margin-left: 0;">
<button @click="deleteLanguage(language)" class="mr-2 text-red-500 hover:text-white hover:bg-red-700 focus:outline-none focus:ring-2 focus:ring-red-500 focus:ring-opacity-50 rounded-full"></button>