From 09294365a9d7a2b786584d59525b034622c3ed81 Mon Sep 17 00:00:00 2001 From: JusteLeo Date: Sat, 2 May 2026 15:28:50 +0200 Subject: [PATCH 01/10] ggml-virtgpu: fix circular dependency in headers (#22557) --- ggml/src/ggml-virtgpu/virtgpu-shm.cpp | 1 + ggml/src/ggml-virtgpu/virtgpu.cpp | 1 + ggml/src/ggml-virtgpu/virtgpu.h | 2 -- 3 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ggml/src/ggml-virtgpu/virtgpu-shm.cpp b/ggml/src/ggml-virtgpu/virtgpu-shm.cpp index ce6b3b3e6..7f2c2322d 100644 --- a/ggml/src/ggml-virtgpu/virtgpu-shm.cpp +++ b/ggml/src/ggml-virtgpu/virtgpu-shm.cpp @@ -1,6 +1,7 @@ #include "virtgpu-shm.h" #include "virtgpu.h" +#include "ggml-remoting.h" #include diff --git a/ggml/src/ggml-virtgpu/virtgpu.cpp b/ggml/src/ggml-virtgpu/virtgpu.cpp index a84a77399..e3ae1cc75 100644 --- a/ggml/src/ggml-virtgpu/virtgpu.cpp +++ b/ggml/src/ggml-virtgpu/virtgpu.cpp @@ -1,4 +1,5 @@ #include "virtgpu.h" +#include "ggml-remoting.h" #include #include diff --git a/ggml/src/ggml-virtgpu/virtgpu.h b/ggml/src/ggml-virtgpu/virtgpu.h index f82d8fb50..6b8de5838 100644 --- a/ggml/src/ggml-virtgpu/virtgpu.h +++ b/ggml/src/ggml-virtgpu/virtgpu.h @@ -18,8 +18,6 @@ #include -#include "ggml-remoting.h" - #define VIRGL_RENDERER_UNSTABLE_APIS 1 #include "apir_hw.h" #include From 0754b7b6fe6109909786bdaa763111167b7410c8 Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Sat, 2 May 2026 18:03:25 +0300 Subject: [PATCH 02/10] server : avoid checkpoint data host copies (#22558) * server : avoid checkpoint data host copies * llama : refactor llama_io_read_i --- src/llama-context.cpp | 76 ++++++++++++++++++++++++++++----- src/llama-io.cpp | 9 +++- src/llama-io.h | 4 +- src/llama-kv-cache.cpp | 53 +++++++++++------------ src/llama-memory-recurrent.cpp | 36 ++++++++-------- tools/server/server-context.cpp | 26 +++++------ 6 files changed, 132 insertions(+), 72 deletions(-) diff --git a/src/llama-context.cpp b/src/llama-context.cpp index 8126249e1..d584415ee 100644 --- a/src/llama-context.cpp +++ b/src/llama-context.cpp @@ -2253,6 +2253,28 @@ public: llama_io_write_buffer( uint8_t * p, size_t len) : ptr(p), buf_size(len) {} + ~llama_io_write_buffer() { +#if 1 + // TODO: add backend support to batch tensor_get? or some other way to speed this up + for (const auto & info : winfos) { + ggml_backend_tensor_get(info.tensor, info.ptr, info.offset, info.size); + } +#else + // flush the writes asynchronously + // this helps on Macs, but on other devices - it does not. just an example + std::vector> futures; + futures.reserve(winfos.size()); + for (const auto & info : winfos) { + futures.push_back(std::async(std::launch::async, [info]() { + ggml_backend_tensor_get(info.tensor, info.ptr, info.offset, info.size); + })); + } + for (auto & f : futures) { + f.wait(); + } +#endif + } + void write(const void * src, size_t size) override { if (size > buf_size) { throw std::runtime_error("unexpectedly reached end of buffer"); @@ -2267,7 +2289,10 @@ public: if (size > buf_size) { throw std::runtime_error("unexpectedly reached end of buffer"); } - ggml_backend_tensor_get(tensor, ptr, offset, size); + + // save the write for later during destruction + winfos.push_back({tensor, ptr, size, offset}); + ptr += size; size_written += size; buf_size -= size; @@ -2281,25 +2306,48 @@ private: uint8_t * ptr; size_t buf_size = 0; size_t size_written = 0; + + struct write_info { + const ggml_tensor * tensor; + uint8_t * ptr; + size_t size; + size_t offset; + }; + std::vector winfos; }; class llama_io_read_buffer : public llama_io_read_i { public: llama_io_read_buffer(const uint8_t * p, size_t len) : ptr(p), buf_size(len) {} - const uint8_t * read(size_t size) override { - const uint8_t * base_ptr = ptr; + ~llama_io_read_buffer() { + // flush the reads + for (const auto & info : rinfos) { + ggml_backend_tensor_set(info.tensor, info.ptr, info.offset, info.size); + } + } + + void read(void * dst, size_t size) override { if (size > buf_size) { throw std::runtime_error("unexpectedly reached end of buffer"); } + memcpy(dst, ptr, size); ptr += size; size_read += size; buf_size -= size; - return base_ptr; } - void read_to(void * dst, size_t size) override { - memcpy(dst, read(size), size); + void read_tensor(ggml_tensor * tensor, size_t offset, size_t size) override { + if (size > buf_size) { + throw std::runtime_error("unexpectedly reached end of buffer"); + } + + // save for later during destruction + rinfos.push_back({tensor, ptr, size, offset}); + + ptr += size; + size_read += size; + buf_size -= size; } size_t n_bytes() override { @@ -2310,6 +2358,14 @@ private: const uint8_t * ptr; size_t buf_size = 0; size_t size_read = 0; + + struct read_info { + ggml_tensor * tensor; + const uint8_t * ptr; + size_t size; + size_t offset; + }; + std::vector rinfos; }; class llama_io_write_file : public llama_io_write_i { @@ -2341,15 +2397,15 @@ class llama_io_read_file : public llama_io_read_i { public: llama_io_read_file(llama_file * f) : file(f) {} - void read_to(void * dst, size_t size) override { + void read(void * dst, size_t size) override { file->read_raw(dst, size); size_read += size; } - const uint8_t * read(size_t size) override { + void read_tensor(ggml_tensor * tensor, size_t offset, size_t size) override { temp_buffer.resize(size); - read_to(temp_buffer.data(), size); - return temp_buffer.data(); + read(temp_buffer.data(), size); + ggml_backend_tensor_set(tensor, temp_buffer.data(), offset, size); } size_t n_bytes() override { diff --git a/src/llama-io.cpp b/src/llama-io.cpp index 7ad70d163..5ec463494 100644 --- a/src/llama-io.cpp +++ b/src/llama-io.cpp @@ -1,5 +1,7 @@ #include "llama-io.h" +#include + void llama_io_write_i::write_string(const std::string & str) { uint32_t str_size = str.size(); @@ -9,7 +11,10 @@ void llama_io_write_i::write_string(const std::string & str) { void llama_io_read_i::read_string(std::string & str) { uint32_t str_size; - read_to(&str_size, sizeof(str_size)); + read(&str_size, sizeof(str_size)); - str.assign((const char *) read(str_size), str_size); + std::vector buf(str_size); + read(buf.data(), str_size); + + str.assign(buf.data(), str_size); } diff --git a/src/llama-io.h b/src/llama-io.h index ce9216b83..1e77a2578 100644 --- a/src/llama-io.h +++ b/src/llama-io.h @@ -25,8 +25,8 @@ public: llama_io_read_i() = default; virtual ~llama_io_read_i() = default; - virtual const uint8_t * read(size_t size) = 0; - virtual void read_to(void * dst, size_t size) = 0; + virtual void read(void * dst, size_t size) = 0; + virtual void read_tensor(ggml_tensor * tensor, size_t offset, size_t size) = 0; // bytes read so far virtual size_t n_bytes() = 0; diff --git a/src/llama-kv-cache.cpp b/src/llama-kv-cache.cpp index 09102f549..666cca12f 100644 --- a/src/llama-kv-cache.cpp +++ b/src/llama-kv-cache.cpp @@ -1900,14 +1900,14 @@ void llama_kv_cache::state_read(llama_io_read_i & io, llama_seq_id seq_id, llama GGML_ASSERT(seq_id == -1 || (seq_id >= 0 && (size_t) seq_id < seq_to_stream.size())); uint32_t n_stream_cur; - io.read_to(&n_stream_cur, sizeof(n_stream_cur)); + io.read(&n_stream_cur, sizeof(n_stream_cur)); if (n_stream_cur != n_stream) { throw std::runtime_error("n_stream mismatch"); } for (uint32_t s = 0; s < n_stream; ++s) { uint32_t cell_count; - io.read_to(&cell_count, sizeof(cell_count)); + io.read(&cell_count, sizeof(cell_count)); if (cell_count == 0) { continue; @@ -2082,8 +2082,8 @@ bool llama_kv_cache::state_read_meta(llama_io_read_i & io, uint32_t strm, uint32 llama_pos pos; uint32_t n_seq_id; - io.read_to(&pos, sizeof(pos)); - io.read_to(&n_seq_id, sizeof(n_seq_id)); + io.read(&pos, sizeof(pos)); + io.read(&n_seq_id, sizeof(n_seq_id)); if (n_seq_id != 1) { LLAMA_LOG_ERROR("%s: invalid seq_id-agnostic kv cell\n", __func__); @@ -2092,7 +2092,7 @@ bool llama_kv_cache::state_read_meta(llama_io_read_i & io, uint32_t strm, uint32 if (hparams.n_pos_per_embd() > 1) { llama_kv_cell_ext ext; - io.read_to(&ext, sizeof(ext)); + io.read(&ext, sizeof(ext)); ubatch.pos[i + ubatch.n_tokens] = ext.y; ubatch.pos[i + ubatch.n_tokens*2] = ext.x; @@ -2101,7 +2101,7 @@ bool llama_kv_cache::state_read_meta(llama_io_read_i & io, uint32_t strm, uint32 // read the sequence id, but directly discard it - we will use dest_seq_id instead { llama_seq_id seq_id; - io.read_to(&seq_id, sizeof(seq_id)); + io.read(&seq_id, sizeof(seq_id)); } ubatch.pos[i] = pos; @@ -2143,20 +2143,20 @@ bool llama_kv_cache::state_read_meta(llama_io_read_i & io, uint32_t strm, uint32 llama_pos pos; uint32_t n_seq_id; - io.read_to(&pos, sizeof(pos)); - io.read_to(&n_seq_id, sizeof(n_seq_id)); + io.read(&pos, sizeof(pos)); + io.read(&n_seq_id, sizeof(n_seq_id)); cells.pos_set(i, pos); if (hparams.n_pos_per_embd() > 1) { llama_kv_cell_ext ext; - io.read_to(&ext, sizeof(ext)); + io.read(&ext, sizeof(ext)); cells.ext_set(i, ext); } for (uint32_t j = 0; j < n_seq_id; ++j) { llama_seq_id seq_id; - io.read_to(&seq_id, sizeof(seq_id)); + io.read(&seq_id, sizeof(seq_id)); if (seq_id < 0 || (uint32_t) seq_id >= n_seq_max) { LLAMA_LOG_ERROR("%s: invalid seq_id, %d is out of range [0, %u)\n", __func__, seq_id, n_seq_max); @@ -2189,8 +2189,8 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 uint32_t v_trans; uint32_t n_layer; - io.read_to(&v_trans, sizeof(v_trans)); - io.read_to(&n_layer, sizeof(n_layer)); + io.read(&v_trans, sizeof(v_trans)); + io.read(&n_layer, sizeof(n_layer)); if (n_layer != layers.size()) { LLAMA_LOG_ERROR("%s: mismatched layer count (%u instead of %u)\n", __func__, n_layer, (uint32_t) layers.size()); @@ -2217,7 +2217,7 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 // Read type of key int32_t k_type_i_ref; - io.read_to(&k_type_i_ref, sizeof(k_type_i_ref)); + io.read(&k_type_i_ref, sizeof(k_type_i_ref)); const int32_t k_type_i = (int32_t) k->type; if (k_type_i != k_type_i_ref) { LLAMA_LOG_ERROR("%s: mismatched key type (%d != %d, layer %d)\n", __func__, k_type_i, k_type_i_ref, il); @@ -2226,7 +2226,7 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 // Read row size of key uint64_t k_size_row_ref; - io.read_to(&k_size_row_ref, sizeof(k_size_row_ref)); + io.read(&k_size_row_ref, sizeof(k_size_row_ref)); const size_t k_size_row = ggml_row_size(k->type, n_embd_k_gqa); if (k_size_row != k_size_row_ref) { LLAMA_LOG_ERROR("%s: mismatched key row size (%zu != %zu, layer %d)\n", __func__, k_size_row, (size_t) k_size_row_ref, il); @@ -2236,13 +2236,12 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 if (cell_count) { if (sinfo.is_contiguous()) { // Fast path: contiguous cells, single memcpy - ggml_backend_tensor_set(k, io.read(cell_count * k_size_row), sinfo.head() * k_size_row, cell_count * k_size_row); + io.read_tensor(k, sinfo.head() * k_size_row, cell_count * k_size_row); } else { // Slow path: scatter to non-contiguous positions - const void * src = io.read(cell_count * k_size_row); for (uint32_t i = 0; i < cell_count; ++i) { const size_t dst_offset = sinfo.idxs[0][i] * k_size_row; - ggml_backend_tensor_set(k, (const char*)src + i * k_size_row, dst_offset, k_size_row); + io.read_tensor(k, dst_offset, k_size_row); } } } @@ -2261,7 +2260,7 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 // Read type of value int32_t v_type_i_ref; - io.read_to(&v_type_i_ref, sizeof(v_type_i_ref)); + io.read(&v_type_i_ref, sizeof(v_type_i_ref)); const int32_t v_type_i = (int32_t) v->type; if (v_type_i != v_type_i_ref) { LLAMA_LOG_ERROR("%s: mismatched value type (%d != %d, layer %d)\n", __func__, v_type_i, v_type_i_ref, il); @@ -2270,7 +2269,7 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 // Read row size of value uint64_t v_size_row_ref; - io.read_to(&v_size_row_ref, sizeof(v_size_row_ref)); + io.read(&v_size_row_ref, sizeof(v_size_row_ref)); const size_t v_size_row = ggml_row_size(v->type, n_embd_v_gqa); if (v_size_row != v_size_row_ref) { LLAMA_LOG_ERROR("%s: mismatched value row size (%zu != %zu, layer %d)\n", __func__, v_size_row, (size_t) v_size_row_ref, il); @@ -2280,13 +2279,12 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 if (cell_count) { if (sinfo.is_contiguous()) { // Fast path: contiguous cells, single memcpy - ggml_backend_tensor_set(v, io.read(cell_count * v_size_row), sinfo.head() * v_size_row, cell_count * v_size_row); + io.read_tensor(v, sinfo.head() * v_size_row, cell_count * v_size_row); } else { // Slow path: scatter to non-contiguous positions - const void * src = io.read(cell_count * v_size_row); for (uint32_t i = 0; i < cell_count; ++i) { const size_t dst_offset = sinfo.idxs[0][i] * v_size_row; - ggml_backend_tensor_set(v, (const char*)src + i * v_size_row, dst_offset, v_size_row); + io.read_tensor(v, dst_offset, v_size_row); } } } @@ -2305,7 +2303,7 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 // Read type of value int32_t v_type_i_ref; - io.read_to(&v_type_i_ref, sizeof(v_type_i_ref)); + io.read(&v_type_i_ref, sizeof(v_type_i_ref)); const int32_t v_type_i = (int32_t) v->type; if (v_type_i != v_type_i_ref) { LLAMA_LOG_ERROR("%s: mismatched value type (%d != %d, layer %d)\n", __func__, v_type_i, v_type_i_ref, il); @@ -2314,7 +2312,7 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 // Read element size of value uint32_t v_size_el_ref; - io.read_to(&v_size_el_ref, sizeof(v_size_el_ref)); + io.read(&v_size_el_ref, sizeof(v_size_el_ref)); const size_t v_size_el = ggml_type_size(v->type); if (v_size_el != v_size_el_ref) { LLAMA_LOG_ERROR("%s: mismatched value element size (%zu != %zu, layer %d)\n", __func__, v_size_el, (size_t) v_size_el_ref, il); @@ -2323,7 +2321,7 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 // Read GQA embedding size uint32_t n_embd_v_gqa_ref; - io.read_to(&n_embd_v_gqa_ref, sizeof(n_embd_v_gqa_ref)); + io.read(&n_embd_v_gqa_ref, sizeof(n_embd_v_gqa_ref)); if (n_embd_v_gqa != n_embd_v_gqa_ref) { LLAMA_LOG_ERROR("%s: mismatched GQA embedding size (%u != %u, layer %d)\n", __func__, n_embd_v_gqa, n_embd_v_gqa_ref, il); return false; @@ -2335,15 +2333,14 @@ bool llama_kv_cache::state_read_data(llama_io_read_i & io, uint32_t strm, uint32 const uint32_t h = sinfo.head(); for (uint32_t j = 0; j < n_embd_v_gqa; ++j) { const size_t dst_offset = (h + j * cells.size()) * v_size_el; - ggml_backend_tensor_set(v, io.read(cell_count * v_size_el), dst_offset, cell_count * v_size_el); + io.read_tensor(v, dst_offset, cell_count * v_size_el); } } else { // Slow path: scatter to non-contiguous positions for (uint32_t j = 0; j < n_embd_v_gqa; ++j) { - const void * src = io.read(cell_count * v_size_el); for (uint32_t i = 0; i < cell_count; ++i) { const size_t dst_offset = (sinfo.idxs[0][i] + j * cells.size()) * v_size_el; - ggml_backend_tensor_set(v, (const char*)src + i * v_size_el, dst_offset, v_size_el); + io.read_tensor(v, dst_offset, v_size_el); } } } diff --git a/src/llama-memory-recurrent.cpp b/src/llama-memory-recurrent.cpp index 9287fe45e..4b4fdeb6d 100644 --- a/src/llama-memory-recurrent.cpp +++ b/src/llama-memory-recurrent.cpp @@ -743,7 +743,7 @@ void llama_memory_recurrent::state_read(llama_io_read_i & io, llama_seq_id seq_i GGML_UNUSED(flags); uint32_t cell_count; - io.read_to(&cell_count, sizeof(cell_count)); + io.read(&cell_count, sizeof(cell_count)); bool res = true; @@ -879,8 +879,8 @@ bool llama_memory_recurrent::state_read_meta(llama_io_read_i & io, uint32_t cell llama_pos pos; uint32_t n_seq_id; - io.read_to(&pos, sizeof(pos)); - io.read_to(&n_seq_id, sizeof(n_seq_id)); + io.read(&pos, sizeof(pos)); + io.read(&n_seq_id, sizeof(n_seq_id)); if (n_seq_id != 0) { LLAMA_LOG_ERROR("%s: invalid seq_id-agnostic kv cell\n", __func__); @@ -920,14 +920,14 @@ bool llama_memory_recurrent::state_read_meta(llama_io_read_i & io, uint32_t cell llama_pos pos; uint32_t n_seq_id; - io.read_to(&pos, sizeof(pos)); - io.read_to(&n_seq_id, sizeof(n_seq_id)); + io.read(&pos, sizeof(pos)); + io.read(&n_seq_id, sizeof(n_seq_id)); cell.pos = pos; for (uint32_t j = 0; j < n_seq_id; ++j) { llama_seq_id seq_id; - io.read_to(&seq_id, sizeof(seq_id)); + io.read(&seq_id, sizeof(seq_id)); if (seq_id < 0 || (uint32_t) seq_id >= this->n_seq_max) { LLAMA_LOG_ERROR("%s: invalid seq_id, %d is out of range [0, %u)\n", __func__, seq_id, this->n_seq_max); @@ -961,8 +961,8 @@ bool llama_memory_recurrent::state_read_meta(llama_io_read_i & io, uint32_t cell bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell_count) { uint32_t s_trans; uint32_t n_layer; - io.read_to(&s_trans, sizeof(s_trans)); - io.read_to(&n_layer, sizeof(n_layer)); + io.read(&s_trans, sizeof(s_trans)); + io.read(&n_layer, sizeof(n_layer)); if (n_layer != hparams.n_layer) { LLAMA_LOG_ERROR("%s: mismatched layer count (%u instead of %u)\n", __func__, n_layer, hparams.n_layer); @@ -984,7 +984,7 @@ bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell // Read type of key int32_t r_type_i_ref; - io.read_to(&r_type_i_ref, sizeof(r_type_i_ref)); + io.read(&r_type_i_ref, sizeof(r_type_i_ref)); const int32_t r_type_i = (int32_t) r_l[il]->type; if (r_type_i != r_type_i_ref) { LLAMA_LOG_ERROR("%s: mismatched r type (%d != %d, layer %d)\n", __func__, r_type_i, r_type_i_ref, il); @@ -993,7 +993,7 @@ bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell // Read row size of key uint64_t r_size_row_ref; - io.read_to(&r_size_row_ref, sizeof(r_size_row_ref)); + io.read(&r_size_row_ref, sizeof(r_size_row_ref)); const size_t r_size_row = ggml_row_size(r_l[il]->type, hparams.n_embd_r()); if (r_size_row != r_size_row_ref) { LLAMA_LOG_ERROR("%s: mismatched r row size (%zu != %zu, layer %d)\n", __func__, r_size_row, (size_t) r_size_row_ref, il); @@ -1002,7 +1002,7 @@ bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell if (cell_count) { // Read and set the keys for the whole cell range - ggml_backend_tensor_set(r_l[il], io.read(cell_count * r_size_row), head * r_size_row, cell_count * r_size_row); + io.read_tensor(r_l[il], head * r_size_row, cell_count * r_size_row); } } @@ -1013,7 +1013,7 @@ bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell // Read type of value int32_t s_type_i_ref; - io.read_to(&s_type_i_ref, sizeof(s_type_i_ref)); + io.read(&s_type_i_ref, sizeof(s_type_i_ref)); const int32_t s_type_i = (int32_t)s_l[il]->type; if (s_type_i != s_type_i_ref) { @@ -1023,7 +1023,7 @@ bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell // Read row size of value uint64_t s_size_row_ref; - io.read_to(&s_size_row_ref, sizeof(s_size_row_ref)); + io.read(&s_size_row_ref, sizeof(s_size_row_ref)); const size_t s_size_row = ggml_row_size(s_l[il]->type, hparams.n_embd_s()); if (s_size_row != s_size_row_ref) { LLAMA_LOG_ERROR("%s: mismatched s row size (%zu != %zu, layer %d)\n", __func__, s_size_row, (size_t) s_size_row_ref, il); @@ -1032,7 +1032,7 @@ bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell if (cell_count) { // Read and set the values for the whole cell range - ggml_backend_tensor_set(s_l[il], io.read(cell_count * s_size_row), head * s_size_row, cell_count * s_size_row); + io.read_tensor(s_l[il], head * s_size_row, cell_count * s_size_row); } } } else { @@ -1045,7 +1045,7 @@ bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell // Read type of value int32_t s_type_i_ref; - io.read_to(&s_type_i_ref, sizeof(s_type_i_ref)); + io.read(&s_type_i_ref, sizeof(s_type_i_ref)); const int32_t s_type_i = (int32_t)s_l[il]->type; if (s_type_i != s_type_i_ref) { LLAMA_LOG_ERROR("%s: mismatched s type (%d != %d, layer %d)\n", __func__, s_type_i, s_type_i_ref, il); @@ -1054,7 +1054,7 @@ bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell // Read element size of value uint32_t s_size_el_ref; - io.read_to(&s_size_el_ref, sizeof(s_size_el_ref)); + io.read(&s_size_el_ref, sizeof(s_size_el_ref)); const size_t s_size_el = ggml_type_size(s_l[il]->type); if (s_size_el != s_size_el_ref) { LLAMA_LOG_ERROR("%s: mismatched s element size (%zu != %zu, layer %d)\n", __func__, s_size_el, (size_t) s_size_el_ref, il); @@ -1063,7 +1063,7 @@ bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell // Read state embedding size uint32_t n_embd_s_ref; - io.read_to(&n_embd_s_ref, sizeof(n_embd_s_ref)); + io.read(&n_embd_s_ref, sizeof(n_embd_s_ref)); if (n_embd_s != n_embd_s_ref) { LLAMA_LOG_ERROR("%s: mismatched s embedding size (%u != %u, layer %d)\n", __func__, n_embd_s, n_embd_s_ref, il); return false; @@ -1073,7 +1073,7 @@ bool llama_memory_recurrent::state_read_data(llama_io_read_i & io, uint32_t cell // For each row in the transposed matrix, read the values for the whole cell range for (uint32_t j = 0; j < n_embd_s; ++j) { const size_t dst_offset = (head + j * size) * s_size_el; - ggml_backend_tensor_set(s_l[il], io.read(cell_count * s_size_el), dst_offset, cell_count * s_size_el); + io.read_tensor(s_l[il], dst_offset, cell_count * s_size_el); } } } diff --git a/tools/server/server-context.cpp b/tools/server/server-context.cpp index 2d3003f03..d21e9c2ee 100644 --- a/tools/server/server-context.cpp +++ b/tools/server/server-context.cpp @@ -36,7 +36,7 @@ using json = nlohmann::ordered_json; constexpr int HTTP_POLLING_SECONDS = 1; -static server_prompt_checkpoint server_get_checkpoint(llama_context * ctx, int id, int64_t n_tokens, llama_pos pos_min = -1, llama_pos pos_max = -1) { +static void server_prompt_checkpoint_update(server_prompt_checkpoint & ckpt, llama_context * ctx, int id, int64_t n_tokens, llama_pos pos_min = -1, llama_pos pos_max = -1) { if (pos_min == -1) { pos_min = llama_memory_seq_pos_min(llama_get_memory(ctx), id); } @@ -46,19 +46,15 @@ static server_prompt_checkpoint server_get_checkpoint(llama_context * ctx, int i const size_t checkpoint_size = llama_state_seq_get_size_ext(ctx, id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY); - auto cur = server_prompt_checkpoint { - /*.pos_min = */ pos_min, - /*.pos_max = */ pos_max, - /*.n_tokens = */ n_tokens, - /*.data = */ std::vector(checkpoint_size), - }; + ckpt.pos_min = pos_min; + ckpt.pos_max = pos_max; + ckpt.n_tokens = n_tokens; + ckpt.data.resize(checkpoint_size); - const size_t n = llama_state_seq_get_data_ext(ctx, cur.data.data(), checkpoint_size, id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY); + const size_t n = llama_state_seq_get_data_ext(ctx, ckpt.data.data(), checkpoint_size, id, LLAMA_STATE_SEQ_FLAGS_PARTIAL_ONLY); if (n != checkpoint_size) { GGML_ABORT("checkpoint size mismatch: expected %zu, got %zu\n", checkpoint_size, n); } - - return cur; } // state diagram: https://github.com/ggml-org/llama.cpp/pull/9283 @@ -364,7 +360,12 @@ struct server_slot { if (!spec_draft.empty() && ctx_seq_rm_type == COMMON_CONTEXT_SEQ_RM_TYPE_FULL) { const auto n_tokens = prompt.tokens.size(); - spec_ckpt = server_get_checkpoint(ctx, this->id, n_tokens); + //const int64_t t_start = ggml_time_us(); + + server_prompt_checkpoint_update(spec_ckpt, ctx, this->id, n_tokens); + + //const int64_t t_total = ggml_time_us() - t_start; + //printf("checkpoint total: %f ms\n", t_total / 1000.0); SLT_DBG(*this, "created speculative checkpoint (pos_min = %d, pos_max = %d, n_tokens = %zu, size = %.3f MiB)\n", spec_ckpt.pos_min, spec_ckpt.pos_max, n_tokens, (float) spec_ckpt.data.size() / 1024 / 1024); @@ -1836,7 +1837,8 @@ private: slot.prompt.checkpoints.erase(slot.prompt.checkpoints.begin()); } - const auto & cur = slot.prompt.checkpoints.emplace_back(server_get_checkpoint(ctx, slot.id, slot.prompt.n_tokens() - n_tokens_cur, pos_min, pos_max)); + auto & cur = slot.prompt.checkpoints.emplace_back(); + server_prompt_checkpoint_update(cur, ctx, slot.id, slot.prompt.n_tokens() - n_tokens_cur, pos_min, pos_max); SLT_WRN(slot, "created context checkpoint %d of %d (pos_min = %d, pos_max = %d, n_tokens = %" PRId64 ", size = %.3f MiB)\n", From d05fe1d7dadbf8943c8f1903fcf65b935ddab839 Mon Sep 17 00:00:00 2001 From: lucy <154630366+lucyknada@users.noreply.github.com> Date: Sat, 2 May 2026 16:19:25 -0400 Subject: [PATCH 03/10] fix: CUDA device PCI bus ID de-dupe OOMing (ignoring other 3 gpus entirely) (#22533) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: CUDA device PCI bus ID detection for multi-GPU de-dupe * HIP, MUSA macros --------- Co-authored-by: Johannes Gäßler --- ggml/src/ggml-cuda/ggml-cuda.cu | 4 ++-- ggml/src/ggml-cuda/vendors/hip.h | 1 + ggml/src/ggml-cuda/vendors/musa.h | 1 + 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/ggml/src/ggml-cuda/ggml-cuda.cu b/ggml/src/ggml-cuda/ggml-cuda.cu index fbe0fa062..8d21b2267 100644 --- a/ggml/src/ggml-cuda/ggml-cuda.cu +++ b/ggml/src/ggml-cuda/ggml-cuda.cu @@ -5431,8 +5431,8 @@ ggml_backend_reg_t ggml_backend_cuda_reg() { CUDA_CHECK(cudaGetDeviceProperties(&prop, i)); dev_ctx->description = prop.name; - char pci_bus_id[16] = {}; - snprintf(pci_bus_id, sizeof(pci_bus_id), "%04x:%02x:%02x.0", prop.pciDomainID, prop.pciBusID, prop.pciDeviceID); + char pci_bus_id[32] = {}; + CUDA_CHECK(cudaDeviceGetPCIBusId(pci_bus_id, sizeof(pci_bus_id), i)); dev_ctx->pci_bus_id = pci_bus_id; dev_ctx->op_offload_min_batch_size = min_batch_size; diff --git a/ggml/src/ggml-cuda/vendors/hip.h b/ggml/src/ggml-cuda/vendors/hip.h index 78ca364d3..e5d363c65 100644 --- a/ggml/src/ggml-cuda/vendors/hip.h +++ b/ggml/src/ggml-cuda/vendors/hip.h @@ -55,6 +55,7 @@ #define cudaDeviceDisablePeerAccess hipDeviceDisablePeerAccess #define cudaDeviceEnablePeerAccess hipDeviceEnablePeerAccess #define cudaDeviceGetAttribute hipDeviceGetAttribute +#define cudaDeviceGetPCIBusId hipDeviceGetPCIBusId #define cudaDeviceProp hipDeviceProp_t #define cudaDeviceSynchronize hipDeviceSynchronize #define cudaError_t hipError_t diff --git a/ggml/src/ggml-cuda/vendors/musa.h b/ggml/src/ggml-cuda/vendors/musa.h index 8aa056e91..940c34a9f 100644 --- a/ggml/src/ggml-cuda/vendors/musa.h +++ b/ggml/src/ggml-cuda/vendors/musa.h @@ -39,6 +39,7 @@ #define cudaDeviceCanAccessPeer musaDeviceCanAccessPeer #define cudaDeviceDisablePeerAccess musaDeviceDisablePeerAccess #define cudaDeviceEnablePeerAccess musaDeviceEnablePeerAccess +#define cudaDeviceGetPCIBusId musaDeviceGetPCIBusId #define cudaDeviceProp musaDeviceProp #define cudaDeviceSynchronize musaDeviceSynchronize #define cudaError_t musaError_t From db44417b027cff147f7de85e7da22bc6a3a804fb Mon Sep 17 00:00:00 2001 From: JM Robles Date: Sun, 3 May 2026 17:22:00 +0200 Subject: [PATCH 04/10] convert : apply Q/K RoPE permutation in NVFP4 repack path (#22611) Llama-architecture q_proj/k_proj weights need an axis-0 row permutation to match GGML's RoPE convention. The BF16 path applies this in LlamaModel.modify_tensors via LlamaModel.permute, but the NVFP4 path bypasses modify_tensors and writes weights directly through ModelBase._repack_nvfp4. Without the permutation, attention heads end up scrambled at inference and the model produces gibberish. This change overrides _repack_nvfp4 on LlamaModel and applies the same permutation to both the nibble-packed weight and the per-block scale before delegating to ModelBase._repack_nvfp4 via super(). Reuses the existing LlamaModel.permute static helper and respects the existing undo_permute flag, so subclasses (Mistral, Granite, Llama4, etc.) inherit the fix automatically. Verified on TinyLlama-1.1B reproducer: perplexity drops from 4419 (gibberish) to 43.9, matching the BF16-dequantized baseline (44.0). Also verified end-to-end on ALIA-40b-instruct-2601 (BSC, Llama architecture) with multilingual generation in Spanish/Catalan/Basque/ Galician all coherent with the fix applied. Co-authored-by: Chema --- convert_hf_to_gguf.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py index 1f0860a6c..af3c4bad7 100755 --- a/convert_hf_to_gguf.py +++ b/convert_hf_to_gguf.py @@ -2889,6 +2889,20 @@ class LlamaModel(TextModel): .swapaxes(1, 2) .reshape(weights.shape)) + def _repack_nvfp4(self, name: str, weight: Tensor, scale: Tensor, scale2: Tensor, input_scale: Tensor): + # Mirror the BF16 Q/K RoPE permutation site in modify_tensors; the NVFP4 path bypasses it. + if self.undo_permute: + n_head = self.find_hparam(["n_heads", "num_attention_heads"], optional=True) + n_kv_head = self.find_hparam(["n_kv_heads", "num_key_value_heads"], optional=True) + if n_head is not None: + if name.endswith("q_proj.weight"): + weight = LlamaModel.permute(weight, n_head, n_head) + scale = LlamaModel.permute(scale, n_head, n_head) + elif name.endswith("k_proj.weight"): + weight = LlamaModel.permute(weight, n_head, n_kv_head) + scale = LlamaModel.permute(scale, n_head, n_kv_head) + super()._repack_nvfp4(name, weight, scale, scale2, input_scale) + _experts: list[dict[str, Tensor]] | None = None def modify_tensors(self, data_torch: Tensor, name: str, bid: int | None) -> Iterable[tuple[str, Tensor]]: From 048a490f763708b84f186078559c0929ed3fcd9c Mon Sep 17 00:00:00 2001 From: Julien Denize <40604584+juliendenize@users.noreply.github.com> Date: Sun, 3 May 2026 21:51:21 +0200 Subject: [PATCH 05/10] convert : Mistral format yarn apply_scale support (#22612) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [BUGFIX] Mistral format apply_scale support. * Update convert_hf_to_gguf.py Co-authored-by: Sigbjørn Skjæret * fix misunderstood boolean parameters --------- Co-authored-by: Sigbjørn Skjæret --- convert_hf_to_gguf.py | 3 ++- src/llama-model.cpp | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/convert_hf_to_gguf.py b/convert_hf_to_gguf.py index af3c4bad7..7f4a4018f 100755 --- a/convert_hf_to_gguf.py +++ b/convert_hf_to_gguf.py @@ -12716,11 +12716,12 @@ class MistralModel(LlamaModel): def set_mistral_config(gguf_writer: gguf.GGUFWriter, hparams: dict): if "yarn" in hparams: yarn_params = hparams["yarn"] + mscale_all_dim = 1.0 if not yarn_params["apply_scale"] else 0.0 gguf_writer.add_rope_scaling_type(gguf.RopeScalingType.YARN) gguf_writer.add_rope_scaling_factor(yarn_params["factor"]) gguf_writer.add_rope_scaling_yarn_beta_fast(yarn_params["beta"]) gguf_writer.add_rope_scaling_yarn_beta_slow(yarn_params["alpha"]) - gguf_writer.add_rope_scaling_yarn_log_mul(1.0) # mscale_all_dim + gguf_writer.add_rope_scaling_yarn_log_mul(mscale_all_dim) gguf_writer.add_rope_scaling_orig_ctx_len(yarn_params["original_max_position_embeddings"]) if "llama_4_scaling" in hparams: diff --git a/src/llama-model.cpp b/src/llama-model.cpp index 9e2a13cbd..54caff987 100644 --- a/src/llama-model.cpp +++ b/src/llama-model.cpp @@ -1994,7 +1994,7 @@ void llama_model::load_hparams(llama_model_loader & ml) { } } - if (ml.get_key(LLM_KV_ROPE_SCALING_YARN_LOG_MUL, hparams.rope_yarn_log_mul, 0.0f)) { + if (ml.get_key(LLM_KV_ROPE_SCALING_YARN_LOG_MUL, hparams.rope_yarn_log_mul, false)) { // [TAG_DEEPSEEK2_YARN_LOG_MUL_FIX] // cancel the factor from the convert script hparams.rope_yarn_log_mul /= 0.1f; @@ -2868,7 +2868,7 @@ void llama_model::load_hparams(llama_model_loader & ml) { ml.get_key(LLM_KV_ROPE_SCALING_YARN_BETA_FAST, hparams.yarn_beta_fast, false); ml.get_key(LLM_KV_ROPE_SCALING_YARN_BETA_SLOW, hparams.yarn_beta_slow, false); - ml.get_key(LLM_KV_ROPE_SCALING_YARN_LOG_MUL, hparams.rope_yarn_log_mul, 0.0f); + ml.get_key(LLM_KV_ROPE_SCALING_YARN_LOG_MUL, hparams.rope_yarn_log_mul, false); hparams.f_attn_temp_offset = 0.0f; From e48034dfc9e5705248fd39dc437ca887dc55a528 Mon Sep 17 00:00:00 2001 From: Aldehir Rojas Date: Sun, 3 May 2026 17:18:23 -0500 Subject: [PATCH 06/10] common : determine generation prompt using longest common prefix (#22657) --- common/chat.cpp | 45 +++++++++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 18 deletions(-) diff --git a/common/chat.cpp b/common/chat.cpp index 159d625de..ade142c5c 100644 --- a/common/chat.cpp +++ b/common/chat.cpp @@ -2116,22 +2116,38 @@ std::optional common_chat_try_specialized_template( return std::nullopt; } +static std::string common_chat_templates_generation_prompt(const common_chat_template & tmpl, const autoparser::generation_params & inputs) { + autoparser::generation_params params = inputs; + params.add_generation_prompt = false; + std::string no_gen_prompt = common_chat_template_direct_apply_impl(tmpl, params); + params.add_generation_prompt = true; + std::string gen_prompt = common_chat_template_direct_apply_impl(tmpl, params); + + size_t prefix_len = 0; + size_t min_size = std::min(no_gen_prompt.size(), gen_prompt.size()); + while (prefix_len < min_size && no_gen_prompt[prefix_len] == gen_prompt[prefix_len]) { + prefix_len++; + } + return gen_prompt.substr(prefix_len); +} + static common_chat_params common_chat_templates_apply_jinja(const struct common_chat_templates * tmpls, const struct common_chat_templates_inputs & inputs) { autoparser::generation_params params; params.tools = common_chat_tools_to_json_oaicompat(inputs.tools); const auto & tmpl = params.tools.is_array() && tmpls->template_tool_use ? *tmpls->template_tool_use : *tmpls->template_default; - const auto & src = tmpl.source(); - const auto & caps = tmpl.original_caps(); - params.messages = render_message_to_json(inputs.messages, tmpl.original_caps()); - params.tool_choice = inputs.tool_choice; - params.reasoning_format = inputs.reasoning_format; - params.enable_thinking = inputs.enable_thinking; - params.grammar = inputs.grammar; - params.now = inputs.now; - params.add_bos = tmpls->add_bos; - params.add_eos = tmpls->add_eos; + const auto & src = tmpl.source(); + const auto & caps = tmpl.original_caps(); + params.messages = render_message_to_json(inputs.messages, tmpl.original_caps()); + params.tool_choice = inputs.tool_choice; + params.reasoning_format = inputs.reasoning_format; + params.enable_thinking = inputs.enable_thinking; + params.grammar = inputs.grammar; + params.now = inputs.now; + params.add_generation_prompt = inputs.add_generation_prompt; + params.add_bos = tmpls->add_bos; + params.add_eos = tmpls->add_eos; if (src.find("<|channel|>") == std::string::npos) { // map developer to system for all models except for GPT-OSS @@ -2153,14 +2169,7 @@ static common_chat_params common_chat_templates_apply_jinja(const struct common_ workaround::func_args_not_string(params.messages); } - params.add_generation_prompt = false; - std::string no_gen_prompt = common_chat_template_direct_apply_impl(tmpl, params); - params.add_generation_prompt = true; - std::string gen_prompt = common_chat_template_direct_apply_impl(tmpl, params); - auto diff = calculate_diff_split(no_gen_prompt, gen_prompt); - params.generation_prompt = diff.right + diff.suffix; - - params.add_generation_prompt = inputs.add_generation_prompt; + params.generation_prompt = common_chat_templates_generation_prompt(tmpl, params); params.extra_context = common_chat_extra_context(); for (auto el : inputs.chat_template_kwargs) { From d4b0c22f9e67f0295e91dc1ab4f17c0fb2557fa4 Mon Sep 17 00:00:00 2001 From: Chen Yuan Date: Sun, 3 May 2026 23:52:53 -0400 Subject: [PATCH 07/10] ggml-webgpu: add layer norm ops (#22406) * shader(norm): add layer norm ops * shader(norm): stablize floating point computation with Kahan summation and handle mixed types * shader(norm): remove the non-contiguous strides * shader(norm): use the original implementation rather than the kahan summation --- .../ggml-webgpu/ggml-webgpu-shader-lib.hpp | 32 +++++- ggml/src/ggml-webgpu/ggml-webgpu.cpp | 2 + .../ggml-webgpu/wgsl-shaders/row_norm.wgsl | 97 +++++++++++++++---- 3 files changed, 107 insertions(+), 24 deletions(-) diff --git a/ggml/src/ggml-webgpu/ggml-webgpu-shader-lib.hpp b/ggml/src/ggml-webgpu/ggml-webgpu-shader-lib.hpp index cff93b8d1..c6dc2c211 100644 --- a/ggml/src/ggml-webgpu/ggml-webgpu-shader-lib.hpp +++ b/ggml/src/ggml-webgpu/ggml-webgpu-shader-lib.hpp @@ -228,11 +228,13 @@ struct ggml_webgpu_get_rows_pipeline_key_hash { /** Row Norm **/ struct ggml_webgpu_row_norm_pipeline_key { - ggml_op op; - bool inplace; + ggml_op op; + ggml_type src_type; + ggml_type dst_type; + bool inplace; bool operator==(const ggml_webgpu_row_norm_pipeline_key & other) const { - return op == other.op && inplace == other.inplace; + return op == other.op && src_type == other.src_type && dst_type == other.dst_type && inplace == other.inplace; } }; @@ -240,6 +242,8 @@ struct ggml_webgpu_row_norm_pipeline_key_hash { size_t operator()(const ggml_webgpu_row_norm_pipeline_key & key) const { size_t seed = 0; ggml_webgpu_hash_combine(seed, key.op); + ggml_webgpu_hash_combine(seed, key.src_type); + ggml_webgpu_hash_combine(seed, key.dst_type); ggml_webgpu_hash_combine(seed, key.inplace); return seed; } @@ -1097,6 +1101,8 @@ class ggml_webgpu_shader_lib { webgpu_pipeline get_row_norm_pipeline(const ggml_webgpu_shader_lib_context & context) { ggml_webgpu_row_norm_pipeline_key key = {}; key.op = context.dst->op; + key.src_type = context.src0->type; + key.dst_type = context.dst->type; key.inplace = ggml_webgpu_tensor_equal(context.src0, context.dst); auto it = row_norm_pipelines.find(key); @@ -1111,6 +1117,10 @@ class ggml_webgpu_shader_lib { defines.push_back("RMS_NORM"); variant = "rms_norm"; break; + case GGML_OP_NORM: + defines.push_back("NORM"); + variant = "norm"; + break; case GGML_OP_L2_NORM: defines.push_back("L2_NORM"); variant = "l2_norm"; @@ -1124,6 +1134,22 @@ class ggml_webgpu_shader_lib { variant += "_inplace"; } + if (key.src_type == GGML_TYPE_F32) { + defines.push_back("SRC_F32"); + variant += "_src_f32"; + } else if (key.src_type == GGML_TYPE_F16) { + defines.push_back("SRC_F16"); + variant += "_src_f16"; + } + + if (key.dst_type == GGML_TYPE_F32) { + defines.push_back("DST_F32"); + variant += "_dst_f32"; + } else if (key.dst_type == GGML_TYPE_F16) { + defines.push_back("DST_F16"); + variant += "_dst_f16"; + } + const uint32_t row_norm_wg_size = 128u; uint32_t wg_size = std::min(context.max_wg_size, row_norm_wg_size); defines.push_back(std::string("WG_SIZE=") + std::to_string(wg_size)); diff --git a/ggml/src/ggml-webgpu/ggml-webgpu.cpp b/ggml/src/ggml-webgpu/ggml-webgpu.cpp index cab0aead1..12f60a990 100644 --- a/ggml/src/ggml-webgpu/ggml-webgpu.cpp +++ b/ggml/src/ggml-webgpu/ggml-webgpu.cpp @@ -2927,6 +2927,7 @@ static std::optional ggml_webgpu_encode(webgpu_context ctx, } else { return ggml_webgpu_row_norm(ctx, src0, node); } + case GGML_OP_NORM: case GGML_OP_L2_NORM: return ggml_webgpu_row_norm(ctx, src0, node); case GGML_OP_ROPE: @@ -4071,6 +4072,7 @@ static bool ggml_backend_webgpu_device_supports_op(ggml_backend_dev_t dev, const break; } case GGML_OP_RMS_NORM: + case GGML_OP_NORM: case GGML_OP_L2_NORM: supports_op = op->type == GGML_TYPE_F32 && src0->type == GGML_TYPE_F32; break; diff --git a/ggml/src/ggml-webgpu/wgsl-shaders/row_norm.wgsl b/ggml/src/ggml-webgpu/wgsl-shaders/row_norm.wgsl index bd8d32bde..5eaf5e7bb 100644 --- a/ggml/src/ggml-webgpu/wgsl-shaders/row_norm.wgsl +++ b/ggml/src/ggml-webgpu/wgsl-shaders/row_norm.wgsl @@ -1,20 +1,17 @@ -#ifdef INPLACE -fn update(src_offset: u32, dst_offset: u32, scale: f32) { - src[dst_offset] = scale * src[src_offset]; -} +#if defined(SRC_F16) || defined(DST_F16) +enable f16; +#endif -@group(0) @binding(1) -var params: Params; +#ifdef SRC_F16 +#define SRC_TYPE f16 #else -fn update(src_offset: u32, dst_offset: u32, scale: f32) { - dst[dst_offset] = scale * src[src_offset]; -} +#define SRC_TYPE f32 +#endif -@group(0) @binding(1) -var dst: array; - -@group(0) @binding(2) -var params: Params; +#ifdef DST_F16 +#define DST_TYPE f16 +#else +#define DST_TYPE f32 #endif struct Params { @@ -40,9 +37,20 @@ struct Params { }; @group(0) @binding(0) -var src: array; +var src: array; -var scratch: array; +#ifdef INPLACE +@group(0) @binding(1) +var params: Params; +#else +@group(0) @binding(1) +var dst: array; + +@group(0) @binding(2) +var params: Params; +#endif + +var scratch: array; @compute @workgroup_size(WG_SIZE) fn main(@builtin(workgroup_id) wid: vec3, @@ -65,34 +73,81 @@ fn main(@builtin(workgroup_id) wid: vec3, if (col >= params.ne0) { break; } - sum += pow(src[i_src_row + col], 2.0); + let v = f32(src[i_src_row + col]); +#ifdef NORM + sum += v; +#else + sum += v * v; +#endif col += WG_SIZE; } scratch[lid.x] = sum; workgroupBarrier(); - var offset: u32 = WG_SIZE / 2; + + var offset: u32 = WG_SIZE / 2u; while (offset > 0) { if (lid.x < offset) { scratch[lid.x] += scratch[lid.x + offset]; } - offset = offset / 2; + offset /= 2u; workgroupBarrier(); } sum = scratch[0]; -#ifdef RMS_NORM +#ifdef NORM + let mean = sum / f32(params.ne0); + var sq_sum = 0.0f; + col = lid.x; + for (var j: u32 = 0; j < elems; j++) { + if (col >= params.ne0) { + break; + } + let v = f32(src[i_src_row + col]); + let d = v - mean; + sq_sum += d * d; + col += WG_SIZE; + } + + workgroupBarrier(); + scratch[lid.x] = sq_sum; + workgroupBarrier(); + offset = WG_SIZE / 2u; + while (offset > 0) { + if (lid.x < offset) { + scratch[lid.x] += scratch[lid.x + offset]; + } + offset /= 2u; + workgroupBarrier(); + } + + let variance = scratch[0] / f32(params.ne0); + let scale = 1.0 / sqrt(variance + params.eps); +#elif defined(RMS_NORM) let scale = 1.0/sqrt(sum/f32(params.ne0) + params.eps); #elif defined(L2_NORM) let scale = 1.0/max(sqrt(sum), params.eps); #endif +#ifdef NORM + let mean_val = mean; +#else + let mean_val = 0.0f; +#endif + col = lid.x; for (var j: u32 = 0; j < elems; j++) { if (col >= params.ne0) { break; } - update(i_src_row + col, i_dst_row + col, scale); + let i_src = i_src_row + col; + let i_dst = i_dst_row + col; + let v = src[i_src]; +#ifdef INPLACE + src[i_dst] = scale * (v - mean_val); +#else + dst[i_dst] = scale * (v - mean_val); +#endif col += WG_SIZE; } } From 6dcd824fce51e4b03ba2064f83990ff5fee85aeb Mon Sep 17 00:00:00 2001 From: Atomic-Germ <97569476+Atomic-Germ@users.noreply.github.com> Date: Sun, 3 May 2026 22:49:29 -0700 Subject: [PATCH 08/10] vulkan: delete dead GGML_VK_MAX_NODES def (#22621) --- ggml/src/ggml-vulkan/ggml-vulkan.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/ggml/src/ggml-vulkan/ggml-vulkan.cpp b/ggml/src/ggml-vulkan/ggml-vulkan.cpp index c2f188332..423e01dbf 100644 --- a/ggml/src/ggml-vulkan/ggml-vulkan.cpp +++ b/ggml/src/ggml-vulkan/ggml-vulkan.cpp @@ -111,8 +111,6 @@ static bool is_pow2(uint32_t x) { return x > 1 && (x & (x-1)) == 0; } #define VK_DEVICE_DESCRIPTOR_POOL_SIZE 256 -#define GGML_VK_MAX_NODES 8192 - #define VK_CHECK(err, msg) \ do { \ vk::Result err_ = (err); \ From 846262d7875dcabf502a150fa3d7b9c770dde7eb Mon Sep 17 00:00:00 2001 From: Georgi Gerganov Date: Mon, 4 May 2026 08:52:07 +0300 Subject: [PATCH 09/10] docs : update speculative decoding parameters after refactor (#22397) (#22539) * docs : update speculative decoding parameters after refactor (#22397) Update docs/speculative.md to reflect the new parameter naming scheme introduced in PR #22397: - Replace --draft-max/--draft-min with --spec-draft-n-max/--spec-draft-n-min - Replace --spec-ngram-size-n/m with per-implementation variants - Add documentation for all new --spec-ngram-*- parameters - Update all example commands Assisted-by: llama.cpp:local pi * pi : add rule to use gh CLI for GitHub resources Assisted-by: llama.cpp:local pi * docs : run llama-gen-docs * arg : fix typo --- .pi/gg/SYSTEM.md | 1 + common/arg.cpp | 2 +- docs/speculative.md | 129 +++++++++++++++++++++++++++++++------ tools/cli/README.md | 64 ++++++++++++------ tools/completion/README.md | 13 ++-- tools/server/README.md | 69 +++++++++++++------- 6 files changed, 209 insertions(+), 69 deletions(-) diff --git a/.pi/gg/SYSTEM.md b/.pi/gg/SYSTEM.md index 5de6fe4eb..727a850b1 100644 --- a/.pi/gg/SYSTEM.md +++ b/.pi/gg/SYSTEM.md @@ -4,6 +4,7 @@ General: - By very precise and concise when writing code, comments, explanations, etc. - PR and commit titles format: ` : `. Lookup recents for examples - Don't try to build or run the code unless you are explicitly asked to do so +- Use the `gh` CLI tool when querying PRs, issues, or other GitHub resources Coding: - When in doubt, always refer to the CONTRIBUTING.md file of the project diff --git a/common/arg.cpp b/common/arg.cpp index c21598e76..dd8ce40a6 100644 --- a/common/arg.cpp +++ b/common/arg.cpp @@ -3380,7 +3380,7 @@ common_params_context common_params_parser_init(common_params & params, llama_ex ).set_spec().set_examples({LLAMA_EXAMPLE_SPECULATIVE, LLAMA_EXAMPLE_SERVER, LLAMA_EXAMPLE_CLI})); add_opt(common_arg( {"--spec-draft-poll", "--poll-draft"}, "<0|1>", - "Use polling to wait for draft model work (default: same as --poll])", + "Use polling to wait for draft model work (default: same as --poll)", [](common_params & params, int value) { params.speculative.draft.cpuparams.poll = value; } diff --git a/docs/speculative.md b/docs/speculative.md index 29da33287..fb6ef0306 100644 --- a/docs/speculative.md +++ b/docs/speculative.md @@ -33,18 +33,18 @@ An example to use this approach can be the rewriting of source code by a LLM. This implementation looks for the last n-gram in history that matches the current n-gram and creates a draft using the m tokens following the matched n-gram. It is the simplest self-speculative approach with minimal overhead. ``` -llama-server [...] --spec-type ngram-simple --draft-max 64 +llama-server [...] --spec-type ngram-simple --spec-draft-n-max 64 ``` #### n-gram Map Key (`ngram-map-k`) -This implementation looks for the current n-gram of size n (called the _key_) in the token history. If the key n-gram is followed by the same m tokens (called the _mgram_) multiple times, it creates a draft using these m tokens. This approach requires a minimum number of occurrences (argument `--spec-ngram-min-hits`, default is 1) before generating drafts. +This implementation looks for the current n-gram of size n (called the _key_) in the token history. If the key n-gram is followed by the same m tokens (called the _mgram_) multiple times, it creates a draft using these m tokens. This approach requires a minimum number of occurrences (argument `--spec-ngram-map-k-min-hits`, default is 1) before generating drafts. The number of accepted tokens is stored for each used n-gram. **Example:** ``` -llama-server [...] --spec-type ngram-map-k --draft-max 64 +llama-server [...] --spec-type ngram-map-k --spec-draft-n-max 64 ``` #### n-gram Map Key-4-Values (`ngram-map-k4v`) @@ -55,7 +55,7 @@ The number of accepted tokens is stored for each used n-gram. **Example:** Server options to be used if there are a lot of longer repetitions. ``` -llama-server [...] --spec-type ngram-map-k4v --spec-ngram-size-n 8 --spec-ngram-size-m 8 --spec-ngram-min-hits 2 --draft-max 64 +llama-server [...] --spec-type ngram-map-k4v --spec-ngram-map-k4v-size-n 8 --spec-ngram-map-k4v-size-m 8 --spec-ngram-map-k4v-min-hits 2 --spec-draft-n-max 64 ``` ### n-gram Mod (`ngram-mod`) @@ -80,9 +80,9 @@ Currently, a single hash pool is shared across all server slots, so different re # notes: # - small `n` are not recommended # - MoEs require long drafts -# - dense models: can reduce `--draft-min` and `--draft-max` +# - dense models: can reduce `--spec-ngram-mod-n-min` and `--spec-ngram-mod-n-max` -llama-server ... --spec-type ngram-mod --spec-ngram-size-n 24 --draft-min 48 --draft-max 64 +llama-server ... --spec-type ngram-mod --spec-ngram-mod-n-match 24 --spec-ngram-mod-n-min 48 --spec-ngram-mod-n-max 64 ``` Applications: @@ -105,21 +105,90 @@ Example Video: If a draft model is combined with a draftless decoding the draftless decoding has higher precedence. +### General Speculative Parameters + ``` ---draft, --draft-n, --draft-max N number of tokens to draft for speculative decoding (default: 16) - (env: LLAMA_ARG_DRAFT_MAX) ---draft-min, --draft-n-min N minimum number of draft tokens to use for speculative decoding - (default: 0) - (env: LLAMA_ARG_DRAFT_MIN) -[...] --spec-type [none|ngram-cache|ngram-simple|ngram-map-k|ngram-map-k4v|ngram-mod] type of speculative decoding to use when no draft model is provided (default: none) ---spec-ngram-size-n N ngram size N for ngram-simple/ngram-map speculative decoding, length - of lookup n-gram (default: 12) ---spec-ngram-size-m N ngram size M for ngram-simple/ngram-map speculative decoding, length - of draft m-gram (default: 48) ---spec-ngram-min-hits N minimum hits for ngram-map speculative decoding (default: 1) + (env: LLAMA_ARG_SPEC_TYPE) +--spec-default use default speculative decoding +``` + +### Draft Model Parameters + +``` +--spec-draft-model, -md, --model-draft FNAME + draft model for speculative decoding (default: unused) + (env: LLAMA_ARG_SPEC_DRAFT_MODEL) +--spec-draft-hf, -hfd, -hfrd, --hf-repo-draft <user>/<model>[:quant] + HuggingFace repository for the draft model +--spec-draft-n-max N + number of tokens to draft for speculative decoding (default: 16) + (env: LLAMA_ARG_SPEC_DRAFT_N_MAX) +--spec-draft-n-min N + minimum number of draft tokens to use for speculative decoding (default: 0) + (env: LLAMA_ARG_SPEC_DRAFT_N_MIN) +--spec-draft-p-split, --draft-p-split P + speculative decoding split probability (default: 0.10) + (env: LLAMA_ARG_SPEC_DRAFT_P_SPLIT) +--spec-draft-p-min, --draft-p-min P + minimum speculative decoding probability (greedy) (default: 0.75) + (env: LLAMA_ARG_SPEC_DRAFT_P_MIN) +--spec-draft-ctx-size, -cd, --ctx-size-draft N + size of the prompt context for the draft model (default: 0, 0 = loaded from model) + (env: LLAMA_ARG_SPEC_DRAFT_CTX_SIZE) +--spec-draft-ngl, -ngld, --gpu-layers-draft, --n-gpu-layers-draft N + max. number of draft model layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto) + (env: LLAMA_ARG_N_GPU_LAYERS_DRAFT) +--spec-draft-device, -devd, --device-draft <dev1,dev2,..> + comma-separated list of devices to use for offloading the draft model +--spec-draft-replace, --spec-replace TARGET DRAFT + translate the string in TARGET into DRAFT if the draft model and main model are not compatible +``` + +### n-gram Mod Parameters + +``` +--spec-ngram-mod-n-match N + ngram-mod lookup length (default: 24) +--spec-ngram-mod-n-min N + minimum number of ngram tokens to use for ngram-based speculative decoding (default: 48) +--spec-ngram-mod-n-max N + maximum number of ngram tokens to use for ngram-based speculative decoding (default: 64) +``` + +### n-gram Simple Parameters + +``` +--spec-ngram-simple-size-n N + ngram size N for ngram-simple speculative decoding, length of lookup n-gram (default: 12) +--spec-ngram-simple-size-m N + ngram size M for ngram-simple speculative decoding, length of draft m-gram (default: 48) +--spec-ngram-simple-min-hits N + minimum hits for ngram-simple speculative decoding (default: 1) +``` + +### n-gram Map Key Parameters + +``` +--spec-ngram-map-k-size-n N + ngram size N for ngram-map-k speculative decoding, length of lookup n-gram (default: 12) +--spec-ngram-map-k-size-m N + ngram size M for ngram-map-k speculative decoding, length of draft m-gram (default: 48) +--spec-ngram-map-k-min-hits N + minimum hits for ngram-map-k speculative decoding (default: 1) +``` + +### n-gram Map Key-4-Values Parameters + +``` +--spec-ngram-map-k4v-size-n N + ngram size N for ngram-map-k4v speculative decoding, length of lookup n-gram (default: 12) +--spec-ngram-map-k4v-size-m N + ngram size M for ngram-map-k4v speculative decoding, length of draft m-gram (default: 48) +--spec-ngram-map-k4v-min-hits N + minimum hits for ngram-map-k4v speculative decoding (default: 1) ``` ### `--spec-type TYPE` @@ -140,21 +209,40 @@ Specifies a type of speculative decoding without draft model. ./llama-server [...] --spec-type ngram-simple ``` -### `--spec-ngram-size-n N` +### `--spec-ngram-*-size-n N` Sets the size N of the lookup n-gram for n-gram map based speculative decoding. The n-gram size N determines how many tokens in a row to look back when searching for matching patterns. -### `--spec-ngram-size-m M` +Each n-gram implementation has its own parameter: + +- `--spec-ngram-simple-size-n` for `ngram-simple` +- `--spec-ngram-map-k-size-n` for `ngram-map-k` +- `--spec-ngram-map-k4v-size-n` for `ngram-map-k4v` +- `--spec-ngram-mod-n-match` for `ngram-mod` + +### `--spec-ngram-*-size-m M` Sets the size M of the draft m-gram for n-gram map based speculative decoding. The m-gram size determines how many tokens to draft when a match is found. Larger values can provide more speedup but may reduce acceptance rate. -### `--spec-ngram-min-hits H` +Each n-gram implementation has its own parameter: + +- `--spec-ngram-simple-size-m` for `ngram-simple` +- `--spec-ngram-map-k-size-m` for `ngram-map-k` +- `--spec-ngram-map-k4v-size-m` for `ngram-map-k4v` + +### `--spec-ngram-*-min-hits H` This option defines how often a key has to appear in the token history to be used as a draft (default is 1). +Each n-gram implementation has its own parameter: + +- `--spec-ngram-simple-min-hits` for `ngram-simple` +- `--spec-ngram-map-k-min-hits` for `ngram-map-k` +- `--spec-ngram-map-k4v-min-hits` for `ngram-map-k4v` + ## Statistics Each speculative decoding implementation prints statistics. @@ -180,4 +268,3 @@ statistics ngram_map_k: #calls(b,g,a) = 6 1690 26, #gen drafts = 26, #acc drafts - `#gen tokens`: number of tokens generated by this implementation (including rejected tokens) - `#acc tokens`: number of tokens accepted by the main model - `dur(b,g,a): durations of begin (new prompt), generation and accumulation (process acceptance). - diff --git a/tools/cli/README.md b/tools/cli/README.md index de0b78040..bca4da7ef 100644 --- a/tools/cli/README.md +++ b/tools/cli/README.md @@ -15,7 +15,6 @@ | `--license` | show source code license and dependencies | | `-cl, --cache-list` | show list of models in cache | | `--completion-bash` | print source-able bash completion script for llama.cpp | -| `--verbose-prompt` | print a verbose prompt before generation (default: false) | | `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) | | `-tb, --threads-batch N` | number of threads to use during batch and prompt processing (default: same as --threads) | | `-C, --cpu-mask M` | CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: "") | @@ -66,7 +65,7 @@ | `-cmoe, --cpu-moe` | keep all Mixture of Experts (MoE) weights in the CPU<br/>(env: LLAMA_ARG_CPU_MOE) | | `-ncmoe, --n-cpu-moe N` | keep the Mixture of Experts (MoE) weights of the first N layers in the CPU<br/>(env: LLAMA_ARG_N_CPU_MOE) | | `-ngl, --gpu-layers, --n-gpu-layers N` | max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)<br/>(env: LLAMA_ARG_N_GPU_LAYERS) | -| `-sm, --split-mode {none,layer,row}` | how to split the model across multiple GPUs, one of:<br/>- none: use one GPU only<br/>- layer (default): split layers and KV across GPUs<br/>- row: split rows across GPUs<br/>(env: LLAMA_ARG_SPLIT_MODE) | +| `-sm, --split-mode {none,layer,row,tensor}` | how to split the model across multiple GPUs, one of:<br/>- none: use one GPU only<br/>- layer (default): split layers and KV across GPUs (pipelined)<br/>- row: split weight across GPUs by rows (parallelized)<br/>- tensor: split weights and KV across GPUs (parallelized, EXPERIMENTAL)<br/>(env: LLAMA_ARG_SPLIT_MODE) | | `-ts, --tensor-split N0,N1,N2,...` | fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1<br/>(env: LLAMA_ARG_TENSOR_SPLIT) | | `-mg, --main-gpu INDEX` | the GPU to use for the model (with split-mode = none), or for intermediate results and KV (with split-mode = row) (default: 0)<br/>(env: LLAMA_ARG_MAIN_GPU) | | `-fit, --fit [on\|off]` | whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')<br/>(env: LLAMA_ARG_FIT) | @@ -84,7 +83,6 @@ | `-mu, --model-url MODEL_URL` | model download url (default: unused)<br/>(env: LLAMA_ARG_MODEL_URL) | | `-dr, --docker-repo [<repo>/]<model>[:quant]` | Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.<br/>example: gemma3<br/>(default: unused)<br/>(env: LLAMA_ARG_DOCKER_REPO) | | `-hf, -hfr, --hf-repo <user>/<model>[:quant]` | Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.<br/>mmproj is also downloaded automatically if available. to disable, add --no-mmproj<br/>example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M<br/>(default: unused)<br/>(env: LLAMA_ARG_HF_REPO) | -| `-hfd, -hfrd, --hf-repo-draft <user>/<model>[:quant]` | Same as --hf-repo, but for the draft model (default: unused)<br/>(env: LLAMA_ARG_HFD_REPO) | | `-hff, --hf-file FILE` | Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)<br/>(env: LLAMA_ARG_HF_FILE) | | `-hfv, -hfrv, --hf-repo-v <user>/<model>[:quant]` | Hugging Face model repository for the vocoder model (default: unused)<br/>(env: LLAMA_ARG_HF_REPO_V) | | `-hffv, --hf-file-v FILE` | Hugging Face model file for the vocoder model (default: unused)<br/>(env: LLAMA_ARG_HF_FILE_V) | @@ -97,8 +95,8 @@ | `-lv, --verbosity, --log-verbosity N` | Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:<br/> - 0: generic output<br/> - 1: error<br/> - 2: warning<br/> - 3: info<br/> - 4: debug<br/>(default: 3)<br/><br/>(env: LLAMA_LOG_VERBOSITY) | | `--log-prefix` | Enable prefix in log messages<br/>(env: LLAMA_LOG_PREFIX) | | `--log-timestamps` | Enable timestamps in log messages<br/>(env: LLAMA_LOG_TIMESTAMPS) | -| `-ctkd, --cache-type-k-draft TYPE` | KV cache data type for K for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_CACHE_TYPE_K_DRAFT) | -| `-ctvd, --cache-type-v-draft TYPE` | KV cache data type for V for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_CACHE_TYPE_V_DRAFT) | +| `--spec-draft-type-k, -ctkd, --cache-type-k-draft TYPE` | KV cache data type for K for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_SPEC_DRAFT_CACHE_TYPE_K) | +| `--spec-draft-type-v, -ctvd, --cache-type-v-draft TYPE` | KV cache data type for V for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_SPEC_DRAFT_CACHE_TYPE_V) | ### Sampling params @@ -145,6 +143,7 @@ | Argument | Explanation | | -------- | ----------- | +| `--verbose-prompt` | print a verbose prompt before generation (default: false) | | `--display-prompt, --no-display-prompt` | whether to print prompt at generation (default: true) | | `-co, --color [on\|off\|auto]` | Colorize output to distinguish prompt and user input from generations ('on', 'off', or 'auto', default: 'auto')<br/>'auto' enables colors when output is to a terminal | | `-ctxcp, --ctx-checkpoints, --swa-checkpoints N` | max number of context checkpoints to create per slot (default: 32)[(more info)](https://github.com/ggml-org/llama.cpp/pull/15293)<br/>(env: LLAMA_ARG_CTX_CHECKPOINTS) | @@ -167,30 +166,59 @@ | `--image, --audio FILE` | path to an image or audio file. use with multimodal models, use comma-separated values for multiple files | | `--image-min-tokens N` | minimum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)<br/>(env: LLAMA_ARG_IMAGE_MIN_TOKENS) | | `--image-max-tokens N` | maximum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)<br/>(env: LLAMA_ARG_IMAGE_MAX_TOKENS) | -| `-otd, --override-tensor-draft <tensor name pattern>=<buffer type>,...` | override tensor buffer type for draft model | -| `-cmoed, --cpu-moe-draft` | keep all Mixture of Experts (MoE) weights in the CPU for the draft model<br/>(env: LLAMA_ARG_CPU_MOE_DRAFT) | -| `-ncmoed, --n-cpu-moe-draft N` | keep the Mixture of Experts (MoE) weights of the first N layers in the CPU for the draft model<br/>(env: LLAMA_ARG_N_CPU_MOE_DRAFT) | | `--chat-template-kwargs STRING` | sets additional params for the json template parser, must be a valid json object string, e.g. '{"key1":"value1","key2":"value2"}'<br/>(env: LLAMA_CHAT_TEMPLATE_KWARGS) | | `--jinja, --no-jinja` | whether to use jinja template engine for chat (default: enabled)<br/>(env: LLAMA_ARG_JINJA) | | `--reasoning-format FORMAT` | controls whether thought tags are allowed and/or extracted from the response, and in which format they're returned; one of:<br/>- none: leaves thoughts unparsed in `message.content`<br/>- deepseek: puts thoughts in `message.reasoning_content`<br/>- deepseek-legacy: keeps `<think>` tags in `message.content` while also populating `message.reasoning_content`<br/>(default: auto)<br/>(env: LLAMA_ARG_THINK) | | `-rea, --reasoning [on\|off\|auto]` | Use reasoning/thinking in the chat ('on', 'off', or 'auto', default: 'auto' (detect from template))<br/>(env: LLAMA_ARG_REASONING) | | `--reasoning-budget N` | token budget for thinking: -1 for unrestricted, 0 for immediate end, N>0 for token budget (default: -1)<br/>(env: LLAMA_ARG_THINK_BUDGET) | | `--reasoning-budget-message MESSAGE` | message injected before the end-of-thinking tag when reasoning budget is exhausted (default: none)<br/>(env: LLAMA_ARG_THINK_BUDGET_MESSAGE) | -| `--chat-template JINJA_TEMPLATE` | set custom jinja chat template (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, grok-2, hunyuan-dense, hunyuan-moe, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE) | -| `--chat-template-file JINJA_TEMPLATE_FILE` | set custom jinja chat template file (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, grok-2, hunyuan-dense, hunyuan-moe, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE_FILE) | +| `--chat-template JINJA_TEMPLATE` | set custom jinja chat template (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-ocr, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE) | +| `--chat-template-file JINJA_TEMPLATE_FILE` | set custom jinja chat template file (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-ocr, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE_FILE) | | `--skip-chat-parsing, --no-skip-chat-parsing` | force a pure content parser, even if a Jinja template is specified; model will output everything in the content section, including any reasoning and/or tool calls (default: disabled)<br/>(env: LLAMA_ARG_SKIP_CHAT_PARSING) | | `--simple-io` | use basic IO for better compatibility in subprocesses and limited consoles | -| `--draft, --draft-n, --draft-max N` | number of tokens to draft for speculative decoding (default: 16)<br/>(env: LLAMA_ARG_DRAFT_MAX) | -| `--draft-min, --draft-n-min N` | minimum number of draft tokens to use for speculative decoding (default: 0)<br/>(env: LLAMA_ARG_DRAFT_MIN) | -| `--draft-p-min P` | minimum speculative decoding probability (greedy) (default: 0.75)<br/>(env: LLAMA_ARG_DRAFT_P_MIN) | -| `-cd, --ctx-size-draft N` | size of the prompt context for the draft model (default: 0, 0 = loaded from model)<br/>(env: LLAMA_ARG_CTX_SIZE_DRAFT) | -| `-devd, --device-draft <dev1,dev2,..>` | comma-separated list of devices to use for offloading the draft model (none = don't offload)<br/>use --list-devices to see a list of available devices | -| `-ngld, --gpu-layers-draft, --n-gpu-layers-draft N` | max. number of draft model layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)<br/>(env: LLAMA_ARG_N_GPU_LAYERS_DRAFT) | -| `-md, --model-draft FNAME` | draft model for speculative decoding (default: unused)<br/>(env: LLAMA_ARG_MODEL_DRAFT) | -| `--spec-replace TARGET DRAFT` | translate the string in TARGET into DRAFT if the draft model and main model are not compatible | +| `--spec-draft-hf, -hfd, -hfrd, --hf-repo-draft <user>/<model>[:quant]` | Same as --hf-repo, but for the draft model (default: unused)<br/>(env: LLAMA_ARG_SPEC_DRAFT_HF_REPO) | +| `--spec-draft-threads, -td, --threads-draft N` | number of threads to use during generation (default: same as --threads) | +| `--spec-draft-threads-batch, -tbd, --threads-batch-draft N` | number of threads to use during batch and prompt processing (default: same as --threads-draft) | +| `--spec-draft-cpu-mask, -Cd, --cpu-mask-draft M` | Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask) | +| `--spec-draft-cpu-range, -Crd, --cpu-range-draft lo-hi` | Ranges of CPUs for affinity. Complements --cpu-mask-draft | +| `--spec-draft-cpu-strict, --cpu-strict-draft <0\|1>` | Use strict CPU placement for draft model (default: same as --cpu-strict) | +| `--spec-draft-prio, --prio-draft N` | set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0) | +| `--spec-draft-poll, --poll-draft <0\|1>` | Use polling to wait for draft model work (default: same as --poll) | +| `--spec-draft-cpu-mask-batch, -Cbd, --cpu-mask-batch-draft M` | Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask) | +| `--spec-draft-cpu-strict-batch, --cpu-strict-batch-draft <0\|1>` | Use strict CPU placement for draft model (default: --cpu-strict-draft) | +| `--spec-draft-prio-batch, --prio-batch-draft N` | set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0) | +| `--spec-draft-poll-batch, --poll-batch-draft <0\|1>` | Use polling to wait for draft model work (default: --poll-draft) | +| `--spec-draft-override-tensor, -otd, --override-tensor-draft <tensor name pattern>=<buffer type>,...` | override tensor buffer type for draft model | +| `--spec-draft-cpu-moe, -cmoed, --cpu-moe-draft` | keep all Mixture of Experts (MoE) weights in the CPU for the draft model<br/>(env: LLAMA_ARG_SPEC_DRAFT_CPU_MOE) | +| `--spec-draft-n-cpu-moe, --spec-draft-ncmoe, -ncmoed, --n-cpu-moe-draft N` | keep the Mixture of Experts (MoE) weights of the first N layers in the CPU for the draft model<br/>(env: LLAMA_ARG_SPEC_DRAFT_N_CPU_MOE) | +| `--spec-draft-n-max N` | number of tokens to draft for speculative decoding (default: 16)<br/>(env: LLAMA_ARG_SPEC_DRAFT_N_MAX) | +| `--spec-draft-n-min N` | minimum number of draft tokens to use for speculative decoding (default: 0)<br/>(env: LLAMA_ARG_SPEC_DRAFT_N_MIN) | +| `--spec-draft-p-split, --draft-p-split P` | speculative decoding split probability (default: 0.10)<br/>(env: LLAMA_ARG_SPEC_DRAFT_P_SPLIT) | +| `--spec-draft-p-min, --draft-p-min P` | minimum speculative decoding probability (greedy) (default: 0.75)<br/>(env: LLAMA_ARG_SPEC_DRAFT_P_MIN) | +| `--spec-draft-ctx-size, -cd, --ctx-size-draft N` | size of the prompt context for the draft model (default: 0, 0 = loaded from model)<br/>(env: LLAMA_ARG_SPEC_DRAFT_CTX_SIZE) | +| `--spec-draft-device, -devd, --device-draft <dev1,dev2,..>` | comma-separated list of devices to use for offloading the draft model (none = don't offload)<br/>use --list-devices to see a list of available devices | +| `--spec-draft-ngl, -ngld, --gpu-layers-draft, --n-gpu-layers-draft N` | max. number of draft model layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)<br/>(env: LLAMA_ARG_N_GPU_LAYERS_DRAFT) | +| `--spec-draft-model, -md, --model-draft FNAME` | draft model for speculative decoding (default: unused)<br/>(env: LLAMA_ARG_SPEC_DRAFT_MODEL) | +| `--spec-draft-replace, --spec-replace TARGET DRAFT` | translate the string in TARGET into DRAFT if the draft model and main model are not compatible | +| `--spec-type [none\|ngram-cache\|ngram-simple\|ngram-map-k\|ngram-map-k4v\|ngram-mod]` | type of speculative decoding to use when no draft model is provided (default: none)<br/><br/>(env: LLAMA_ARG_SPEC_TYPE) | +| `--spec-ngram-mod-n-min N` | minimum number of ngram tokens to use for ngram-based speculative decoding (default: 48) | +| `--spec-ngram-mod-n-max N` | maximum number of ngram tokens to use for ngram-based speculative decoding (default: 64) | +| `--spec-ngram-mod-n-match N` | ngram-mod lookup length (default: 24) | +| `--spec-ngram-simple-size-n N` | ngram size N for ngram-simple speculative decoding, length of lookup n-gram (default: 12) | +| `--spec-ngram-simple-size-m N` | ngram size M for ngram-simple speculative decoding, length of draft m-gram (default: 48) | +| `--spec-ngram-simple-min-hits N` | minimum hits for ngram-simple speculative decoding (default: 1) | +| `--spec-ngram-map-k-size-n N` | ngram size N for ngram-map-k speculative decoding, length of lookup n-gram (default: 12) | +| `--spec-ngram-map-k-size-m N` | ngram size M for ngram-map-k speculative decoding, length of draft m-gram (default: 48) | +| `--spec-ngram-map-k-min-hits N` | minimum hits for ngram-map-k speculative decoding (default: 1) | +| `--spec-ngram-map-k4v-size-n N` | ngram size N for ngram-map-k4v speculative decoding, length of lookup n-gram (default: 12) | +| `--spec-ngram-map-k4v-size-m N` | ngram size M for ngram-map-k4v speculative decoding, length of draft m-gram (default: 48) | +| `--spec-ngram-map-k4v-min-hits N` | minimum hits for ngram-map-k4v speculative decoding (default: 1) | +| `--draft, --draft-n, --draft-max N` | the argument has been removed. use --spec-draft-n-max or --spec-ngram-mod-n-max<br/>(env: LLAMA_ARG_DRAFT_MAX) | +| `--draft-min, --draft-n-min N` | the argument has been removed. use --spec-draft-n-min or --spec-ngram-mod-n-min<br/>(env: LLAMA_ARG_DRAFT_MIN) | | `--gpt-oss-20b-default` | use gpt-oss-20b (note: can download weights from the internet) | | `--gpt-oss-120b-default` | use gpt-oss-120b (note: can download weights from the internet) | | `--vision-gemma-4b-default` | use Gemma 3 4B QAT (note: can download weights from the internet) | | `--vision-gemma-12b-default` | use Gemma 3 12B QAT (note: can download weights from the internet) | +| `--spec-default` | enable default speculative decoding config | <!-- HELP_END --> diff --git a/tools/completion/README.md b/tools/completion/README.md index fe1a036a3..7042889db 100644 --- a/tools/completion/README.md +++ b/tools/completion/README.md @@ -98,7 +98,6 @@ llama-completion.exe -m models\gemma-1.1-7b-it.Q4_K_M.gguf --ignore-eos -n -1 | `--license` | show source code license and dependencies | | `-cl, --cache-list` | show list of models in cache | | `--completion-bash` | print source-able bash completion script for llama.cpp | -| `--verbose-prompt` | print a verbose prompt before generation (default: false) | | `-t, --threads N` | number of CPU threads to use during generation (default: -1)<br/>(env: LLAMA_ARG_THREADS) | | `-tb, --threads-batch N` | number of threads to use during batch and prompt processing (default: same as --threads) | | `-C, --cpu-mask M` | CPU affinity mask: arbitrarily long hex. Complements cpu-range (default: "") | @@ -149,7 +148,7 @@ llama-completion.exe -m models\gemma-1.1-7b-it.Q4_K_M.gguf --ignore-eos -n -1 | `-cmoe, --cpu-moe` | keep all Mixture of Experts (MoE) weights in the CPU<br/>(env: LLAMA_ARG_CPU_MOE) | | `-ncmoe, --n-cpu-moe N` | keep the Mixture of Experts (MoE) weights of the first N layers in the CPU<br/>(env: LLAMA_ARG_N_CPU_MOE) | | `-ngl, --gpu-layers, --n-gpu-layers N` | max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)<br/>(env: LLAMA_ARG_N_GPU_LAYERS) | -| `-sm, --split-mode {none,layer,row}` | how to split the model across multiple GPUs, one of:<br/>- none: use one GPU only<br/>- layer (default): split layers and KV across GPUs<br/>- row: split rows across GPUs<br/>(env: LLAMA_ARG_SPLIT_MODE) | +| `-sm, --split-mode {none,layer,row,tensor}` | how to split the model across multiple GPUs, one of:<br/>- none: use one GPU only<br/>- layer (default): split layers and KV across GPUs (pipelined)<br/>- row: split weight across GPUs by rows (parallelized)<br/>- tensor: split weights and KV across GPUs (parallelized, EXPERIMENTAL)<br/>(env: LLAMA_ARG_SPLIT_MODE) | | `-ts, --tensor-split N0,N1,N2,...` | fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1<br/>(env: LLAMA_ARG_TENSOR_SPLIT) | | `-mg, --main-gpu INDEX` | the GPU to use for the model (with split-mode = none), or for intermediate results and KV (with split-mode = row) (default: 0)<br/>(env: LLAMA_ARG_MAIN_GPU) | | `-fit, --fit [on\|off]` | whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')<br/>(env: LLAMA_ARG_FIT) | @@ -167,7 +166,6 @@ llama-completion.exe -m models\gemma-1.1-7b-it.Q4_K_M.gguf --ignore-eos -n -1 | `-mu, --model-url MODEL_URL` | model download url (default: unused)<br/>(env: LLAMA_ARG_MODEL_URL) | | `-dr, --docker-repo [<repo>/]<model>[:quant]` | Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.<br/>example: gemma3<br/>(default: unused)<br/>(env: LLAMA_ARG_DOCKER_REPO) | | `-hf, -hfr, --hf-repo <user>/<model>[:quant]` | Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.<br/>mmproj is also downloaded automatically if available. to disable, add --no-mmproj<br/>example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M<br/>(default: unused)<br/>(env: LLAMA_ARG_HF_REPO) | -| `-hfd, -hfrd, --hf-repo-draft <user>/<model>[:quant]` | Same as --hf-repo, but for the draft model (default: unused)<br/>(env: LLAMA_ARG_HFD_REPO) | | `-hff, --hf-file FILE` | Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)<br/>(env: LLAMA_ARG_HF_FILE) | | `-hfv, -hfrv, --hf-repo-v <user>/<model>[:quant]` | Hugging Face model repository for the vocoder model (default: unused)<br/>(env: LLAMA_ARG_HF_REPO_V) | | `-hffv, --hf-file-v FILE` | Hugging Face model file for the vocoder model (default: unused)<br/>(env: LLAMA_ARG_HF_FILE_V) | @@ -180,8 +178,8 @@ llama-completion.exe -m models\gemma-1.1-7b-it.Q4_K_M.gguf --ignore-eos -n -1 | `-lv, --verbosity, --log-verbosity N` | Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:<br/> - 0: generic output<br/> - 1: error<br/> - 2: warning<br/> - 3: info<br/> - 4: debug<br/>(default: 3)<br/><br/>(env: LLAMA_LOG_VERBOSITY) | | `--log-prefix` | Enable prefix in log messages<br/>(env: LLAMA_LOG_PREFIX) | | `--log-timestamps` | Enable timestamps in log messages<br/>(env: LLAMA_LOG_TIMESTAMPS) | -| `-ctkd, --cache-type-k-draft TYPE` | KV cache data type for K for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_CACHE_TYPE_K_DRAFT) | -| `-ctvd, --cache-type-v-draft TYPE` | KV cache data type for V for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_CACHE_TYPE_V_DRAFT) | +| `--spec-draft-type-k, -ctkd, --cache-type-k-draft TYPE` | KV cache data type for K for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_SPEC_DRAFT_CACHE_TYPE_K) | +| `--spec-draft-type-v, -ctvd, --cache-type-v-draft TYPE` | KV cache data type for V for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_SPEC_DRAFT_CACHE_TYPE_V) | ### Sampling params @@ -228,6 +226,7 @@ llama-completion.exe -m models\gemma-1.1-7b-it.Q4_K_M.gguf --ignore-eos -n -1 | Argument | Explanation | | -------- | ----------- | +| `--verbose-prompt` | print a verbose prompt before generation (default: false) | | `--display-prompt, --no-display-prompt` | whether to print prompt at generation (default: true) | | `-co, --color [on\|off\|auto]` | Colorize output to distinguish prompt and user input from generations ('on', 'off', or 'auto', default: 'auto')<br/>'auto' enables colors when output is to a terminal | | `--context-shift, --no-context-shift` | whether to use context shift on infinite text generation (default: disabled)<br/>(env: LLAMA_ARG_CONTEXT_SHIFT) | @@ -255,8 +254,8 @@ llama-completion.exe -m models\gemma-1.1-7b-it.Q4_K_M.gguf --ignore-eos -n -1 | `-rea, --reasoning [on\|off\|auto]` | Use reasoning/thinking in the chat ('on', 'off', or 'auto', default: 'auto' (detect from template))<br/>(env: LLAMA_ARG_REASONING) | | `--reasoning-budget N` | token budget for thinking: -1 for unrestricted, 0 for immediate end, N>0 for token budget (default: -1)<br/>(env: LLAMA_ARG_THINK_BUDGET) | | `--reasoning-budget-message MESSAGE` | message injected before the end-of-thinking tag when reasoning budget is exhausted (default: none)<br/>(env: LLAMA_ARG_THINK_BUDGET_MESSAGE) | -| `--chat-template JINJA_TEMPLATE` | set custom jinja chat template (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, grok-2, hunyuan-dense, hunyuan-moe, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE) | -| `--chat-template-file JINJA_TEMPLATE_FILE` | set custom jinja chat template file (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, grok-2, hunyuan-dense, hunyuan-moe, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE_FILE) | +| `--chat-template JINJA_TEMPLATE` | set custom jinja chat template (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-ocr, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE) | +| `--chat-template-file JINJA_TEMPLATE_FILE` | set custom jinja chat template file (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-ocr, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE_FILE) | | `--skip-chat-parsing, --no-skip-chat-parsing` | force a pure content parser, even if a Jinja template is specified; model will output everything in the content section, including any reasoning and/or tool calls (default: disabled)<br/>(env: LLAMA_ARG_SKIP_CHAT_PARSING) | | `--simple-io` | use basic IO for better compatibility in subprocesses and limited consoles | diff --git a/tools/server/README.md b/tools/server/README.md index db1f27039..eda875951 100644 --- a/tools/server/README.md +++ b/tools/server/README.md @@ -82,7 +82,7 @@ For the full list of features, please refer to [server's changelog](https://gith | `-cmoe, --cpu-moe` | keep all Mixture of Experts (MoE) weights in the CPU<br/>(env: LLAMA_ARG_CPU_MOE) | | `-ncmoe, --n-cpu-moe N` | keep the Mixture of Experts (MoE) weights of the first N layers in the CPU<br/>(env: LLAMA_ARG_N_CPU_MOE) | | `-ngl, --gpu-layers, --n-gpu-layers N` | max. number of layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)<br/>(env: LLAMA_ARG_N_GPU_LAYERS) | -| `-sm, --split-mode {none,layer,row}` | how to split the model across multiple GPUs, one of:<br/>- none: use one GPU only<br/>- layer (default): split layers and KV across GPUs<br/>- row: split rows across GPUs<br/>(env: LLAMA_ARG_SPLIT_MODE) | +| `-sm, --split-mode {none,layer,row,tensor}` | how to split the model across multiple GPUs, one of:<br/>- none: use one GPU only<br/>- layer (default): split layers and KV across GPUs (pipelined)<br/>- row: split weight across GPUs by rows (parallelized)<br/>- tensor: split weights and KV across GPUs (parallelized, EXPERIMENTAL)<br/>(env: LLAMA_ARG_SPLIT_MODE) | | `-ts, --tensor-split N0,N1,N2,...` | fraction of the model to offload to each GPU, comma-separated list of proportions, e.g. 3,1<br/>(env: LLAMA_ARG_TENSOR_SPLIT) | | `-mg, --main-gpu INDEX` | the GPU to use for the model (with split-mode = none), or for intermediate results and KV (with split-mode = row) (default: 0)<br/>(env: LLAMA_ARG_MAIN_GPU) | | `-fit, --fit [on\|off]` | whether to adjust unset arguments to fit in device memory ('on' or 'off', default: 'on')<br/>(env: LLAMA_ARG_FIT) | @@ -100,7 +100,6 @@ For the full list of features, please refer to [server's changelog](https://gith | `-mu, --model-url MODEL_URL` | model download url (default: unused)<br/>(env: LLAMA_ARG_MODEL_URL) | | `-dr, --docker-repo [<repo>/]<model>[:quant]` | Docker Hub model repository. repo is optional, default to ai/. quant is optional, default to :latest.<br/>example: gemma3<br/>(default: unused)<br/>(env: LLAMA_ARG_DOCKER_REPO) | | `-hf, -hfr, --hf-repo <user>/<model>[:quant]` | Hugging Face model repository; quant is optional, case-insensitive, default to Q4_K_M, or falls back to the first file in the repo if Q4_K_M doesn't exist.<br/>mmproj is also downloaded automatically if available. to disable, add --no-mmproj<br/>example: ggml-org/GLM-4.7-Flash-GGUF:Q4_K_M<br/>(default: unused)<br/>(env: LLAMA_ARG_HF_REPO) | -| `-hfd, -hfrd, --hf-repo-draft <user>/<model>[:quant]` | Same as --hf-repo, but for the draft model (default: unused)<br/>(env: LLAMA_ARG_HFD_REPO) | | `-hff, --hf-file FILE` | Hugging Face model file. If specified, it will override the quant in --hf-repo (default: unused)<br/>(env: LLAMA_ARG_HF_FILE) | | `-hfv, -hfrv, --hf-repo-v <user>/<model>[:quant]` | Hugging Face model repository for the vocoder model (default: unused)<br/>(env: LLAMA_ARG_HF_REPO_V) | | `-hffv, --hf-file-v FILE` | Hugging Face model file for the vocoder model (default: unused)<br/>(env: LLAMA_ARG_HF_FILE_V) | @@ -113,8 +112,8 @@ For the full list of features, please refer to [server's changelog](https://gith | `-lv, --verbosity, --log-verbosity N` | Set the verbosity threshold. Messages with a higher verbosity will be ignored. Values:<br/> - 0: generic output<br/> - 1: error<br/> - 2: warning<br/> - 3: info<br/> - 4: debug<br/>(default: 3)<br/><br/>(env: LLAMA_LOG_VERBOSITY) | | `--log-prefix` | Enable prefix in log messages<br/>(env: LLAMA_LOG_PREFIX) | | `--log-timestamps` | Enable timestamps in log messages<br/>(env: LLAMA_LOG_TIMESTAMPS) | -| `-ctkd, --cache-type-k-draft TYPE` | KV cache data type for K for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_CACHE_TYPE_K_DRAFT) | -| `-ctvd, --cache-type-v-draft TYPE` | KV cache data type for V for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_CACHE_TYPE_V_DRAFT) | +| `--spec-draft-type-k, -ctkd, --cache-type-k-draft TYPE` | KV cache data type for K for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_SPEC_DRAFT_CACHE_TYPE_K) | +| `--spec-draft-type-v, -ctvd, --cache-type-v-draft TYPE` | KV cache data type for V for the draft model<br/>allowed values: f32, f16, bf16, q8_0, q4_0, q4_1, iq4_nl, q5_0, q5_1<br/>(default: f16)<br/>(env: LLAMA_ARG_SPEC_DRAFT_CACHE_TYPE_V) | ### Sampling params @@ -182,9 +181,6 @@ For the full list of features, please refer to [server's changelog](https://gith | `--mmproj-offload, --no-mmproj-offload` | whether to enable GPU offloading for multimodal projector (default: enabled)<br/>(env: LLAMA_ARG_MMPROJ_OFFLOAD) | | `--image-min-tokens N` | minimum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)<br/>(env: LLAMA_ARG_IMAGE_MIN_TOKENS) | | `--image-max-tokens N` | maximum number of tokens each image can take, only used by vision models with dynamic resolution (default: read from model)<br/>(env: LLAMA_ARG_IMAGE_MAX_TOKENS) | -| `-otd, --override-tensor-draft <tensor name pattern>=<buffer type>,...` | override tensor buffer type for draft model | -| `-cmoed, --cpu-moe-draft` | keep all Mixture of Experts (MoE) weights in the CPU for the draft model<br/>(env: LLAMA_ARG_CPU_MOE_DRAFT) | -| `-ncmoed, --n-cpu-moe-draft N` | keep the Mixture of Experts (MoE) weights of the first N layers in the CPU for the draft model<br/>(env: LLAMA_ARG_N_CPU_MOE_DRAFT) | | `-a, --alias STRING` | set model name aliases, comma-separated (to be used by API)<br/>(env: LLAMA_ARG_ALIAS) | | `--tags STRING` | set model tags, comma-separated (informational, not used for routing)<br/>(env: LLAMA_ARG_TAGS) | | `--host HOST` | ip address to listen, or bind to an UNIX socket if the address ends with .sock (default: 127.0.0.1)<br/>(env: LLAMA_ARG_HOST) | @@ -222,27 +218,55 @@ For the full list of features, please refer to [server's changelog](https://gith | `-rea, --reasoning [on\|off\|auto]` | Use reasoning/thinking in the chat ('on', 'off', or 'auto', default: 'auto' (detect from template))<br/>(env: LLAMA_ARG_REASONING) | | `--reasoning-budget N` | token budget for thinking: -1 for unrestricted, 0 for immediate end, N>0 for token budget (default: -1)<br/>(env: LLAMA_ARG_THINK_BUDGET) | | `--reasoning-budget-message MESSAGE` | message injected before the end-of-thinking tag when reasoning budget is exhausted (default: none)<br/>(env: LLAMA_ARG_THINK_BUDGET_MESSAGE) | -| `--chat-template JINJA_TEMPLATE` | set custom jinja chat template (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, grok-2, hunyuan-dense, hunyuan-moe, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE) | -| `--chat-template-file JINJA_TEMPLATE_FILE` | set custom jinja chat template file (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, grok-2, hunyuan-dense, hunyuan-moe, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE_FILE) | +| `--chat-template JINJA_TEMPLATE` | set custom jinja chat template (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-ocr, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE) | +| `--chat-template-file JINJA_TEMPLATE_FILE` | set custom jinja chat template file (default: template taken from model's metadata)<br/>if suffix/prefix are specified, template will be disabled<br/>only commonly used templates are accepted (unless --jinja is set before this flag):<br/>list of built-in templates:<br/>bailing, bailing-think, bailing2, chatglm3, chatglm4, chatml, command-r, deepseek, deepseek-ocr, deepseek2, deepseek3, exaone-moe, exaone3, exaone4, falcon3, gemma, gigachat, glmedge, gpt-oss, granite, granite-4.0, grok-2, hunyuan-dense, hunyuan-moe, hunyuan-ocr, kimi-k2, llama2, llama2-sys, llama2-sys-bos, llama2-sys-strip, llama3, llama4, megrez, minicpm, mistral-v1, mistral-v3, mistral-v3-tekken, mistral-v7, mistral-v7-tekken, monarch, openchat, orion, pangu-embedded, phi3, phi4, rwkv-world, seed_oss, smolvlm, solar-open, vicuna, vicuna-orca, yandex, zephyr<br/>(env: LLAMA_ARG_CHAT_TEMPLATE_FILE) | | `--skip-chat-parsing, --no-skip-chat-parsing` | force a pure content parser, even if a Jinja template is specified; model will output everything in the content section, including any reasoning and/or tool calls (default: disabled)<br/>(env: LLAMA_ARG_SKIP_CHAT_PARSING) | | `--prefill-assistant, --no-prefill-assistant` | whether to prefill the assistant's response if the last message is an assistant message (default: prefill enabled)<br/>when this flag is set, if the last message is an assistant message then it will be treated as a full message and not prefilled<br/><br/>(env: LLAMA_ARG_PREFILL_ASSISTANT) | | `-sps, --slot-prompt-similarity SIMILARITY` | how much the prompt of a request must match the prompt of a slot in order to use that slot (default: 0.10, 0.0 = disabled) | | `--lora-init-without-apply` | load LoRA adapters without applying them (apply later via POST /lora-adapters) (default: disabled) | | `--sleep-idle-seconds SECONDS` | number of seconds of idleness after which the server will sleep (default: -1; -1 = disabled) | -| `-td, --threads-draft N` | number of threads to use during generation (default: same as --threads) | -| `-tbd, --threads-batch-draft N` | number of threads to use during batch and prompt processing (default: same as --threads-draft) | -| `--draft, --draft-n, --draft-max N` | number of tokens to draft for speculative decoding (default: 16)<br/>(env: LLAMA_ARG_DRAFT_MAX) | -| `--draft-min, --draft-n-min N` | minimum number of draft tokens to use for speculative decoding (default: 0)<br/>(env: LLAMA_ARG_DRAFT_MIN) | -| `--draft-p-min P` | minimum speculative decoding probability (greedy) (default: 0.75)<br/>(env: LLAMA_ARG_DRAFT_P_MIN) | -| `-cd, --ctx-size-draft N` | size of the prompt context for the draft model (default: 0, 0 = loaded from model)<br/>(env: LLAMA_ARG_CTX_SIZE_DRAFT) | -| `-devd, --device-draft <dev1,dev2,..>` | comma-separated list of devices to use for offloading the draft model (none = don't offload)<br/>use --list-devices to see a list of available devices | -| `-ngld, --gpu-layers-draft, --n-gpu-layers-draft N` | max. number of draft model layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)<br/>(env: LLAMA_ARG_N_GPU_LAYERS_DRAFT) | -| `-md, --model-draft FNAME` | draft model for speculative decoding (default: unused)<br/>(env: LLAMA_ARG_MODEL_DRAFT) | -| `--spec-replace TARGET DRAFT` | translate the string in TARGET into DRAFT if the draft model and main model are not compatible | +| `--spec-draft-hf, -hfd, -hfrd, --hf-repo-draft <user>/<model>[:quant]` | Same as --hf-repo, but for the draft model (default: unused)<br/>(env: LLAMA_ARG_SPEC_DRAFT_HF_REPO) | +| `--spec-draft-threads, -td, --threads-draft N` | number of threads to use during generation (default: same as --threads) | +| `--spec-draft-threads-batch, -tbd, --threads-batch-draft N` | number of threads to use during batch and prompt processing (default: same as --threads-draft) | +| `--spec-draft-cpu-mask, -Cd, --cpu-mask-draft M` | Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask) | +| `--spec-draft-cpu-range, -Crd, --cpu-range-draft lo-hi` | Ranges of CPUs for affinity. Complements --cpu-mask-draft | +| `--spec-draft-cpu-strict, --cpu-strict-draft <0\|1>` | Use strict CPU placement for draft model (default: same as --cpu-strict) | +| `--spec-draft-prio, --prio-draft N` | set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0) | +| `--spec-draft-poll, --poll-draft <0\|1>` | Use polling to wait for draft model work (default: same as --poll) | +| `--spec-draft-cpu-mask-batch, -Cbd, --cpu-mask-batch-draft M` | Draft model CPU affinity mask. Complements cpu-range-draft (default: same as --cpu-mask) | +| `--spec-draft-cpu-strict-batch, --cpu-strict-batch-draft <0\|1>` | Use strict CPU placement for draft model (default: --cpu-strict-draft) | +| `--spec-draft-prio-batch, --prio-batch-draft N` | set draft process/thread priority : 0-normal, 1-medium, 2-high, 3-realtime (default: 0) | +| `--spec-draft-poll-batch, --poll-batch-draft <0\|1>` | Use polling to wait for draft model work (default: --poll-draft) | +| `--spec-draft-override-tensor, -otd, --override-tensor-draft <tensor name pattern>=<buffer type>,...` | override tensor buffer type for draft model | +| `--spec-draft-cpu-moe, -cmoed, --cpu-moe-draft` | keep all Mixture of Experts (MoE) weights in the CPU for the draft model<br/>(env: LLAMA_ARG_SPEC_DRAFT_CPU_MOE) | +| `--spec-draft-n-cpu-moe, --spec-draft-ncmoe, -ncmoed, --n-cpu-moe-draft N` | keep the Mixture of Experts (MoE) weights of the first N layers in the CPU for the draft model<br/>(env: LLAMA_ARG_SPEC_DRAFT_N_CPU_MOE) | +| `--spec-draft-n-max N` | number of tokens to draft for speculative decoding (default: 16)<br/>(env: LLAMA_ARG_SPEC_DRAFT_N_MAX) | +| `--spec-draft-n-min N` | minimum number of draft tokens to use for speculative decoding (default: 0)<br/>(env: LLAMA_ARG_SPEC_DRAFT_N_MIN) | +| `--spec-draft-p-split, --draft-p-split P` | speculative decoding split probability (default: 0.10)<br/>(env: LLAMA_ARG_SPEC_DRAFT_P_SPLIT) | +| `--spec-draft-p-min, --draft-p-min P` | minimum speculative decoding probability (greedy) (default: 0.75)<br/>(env: LLAMA_ARG_SPEC_DRAFT_P_MIN) | +| `--spec-draft-ctx-size, -cd, --ctx-size-draft N` | size of the prompt context for the draft model (default: 0, 0 = loaded from model)<br/>(env: LLAMA_ARG_SPEC_DRAFT_CTX_SIZE) | +| `--spec-draft-device, -devd, --device-draft <dev1,dev2,..>` | comma-separated list of devices to use for offloading the draft model (none = don't offload)<br/>use --list-devices to see a list of available devices | +| `--spec-draft-ngl, -ngld, --gpu-layers-draft, --n-gpu-layers-draft N` | max. number of draft model layers to store in VRAM, either an exact number, 'auto', or 'all' (default: auto)<br/>(env: LLAMA_ARG_N_GPU_LAYERS_DRAFT) | +| `--spec-draft-model, -md, --model-draft FNAME` | draft model for speculative decoding (default: unused)<br/>(env: LLAMA_ARG_SPEC_DRAFT_MODEL) | +| `--spec-draft-replace, --spec-replace TARGET DRAFT` | translate the string in TARGET into DRAFT if the draft model and main model are not compatible | | `--spec-type [none\|ngram-cache\|ngram-simple\|ngram-map-k\|ngram-map-k4v\|ngram-mod]` | type of speculative decoding to use when no draft model is provided (default: none)<br/><br/>(env: LLAMA_ARG_SPEC_TYPE) | -| `--spec-ngram-size-n N` | ngram size N for ngram-simple/ngram-map speculative decoding, length of lookup n-gram (default: 12) | -| `--spec-ngram-size-m N` | ngram size M for ngram-simple/ngram-map speculative decoding, length of draft m-gram (default: 48) | -| `--spec-ngram-min-hits N` | minimum hits for ngram-map speculative decoding (default: 1) | +| `--spec-ngram-mod-n-min N` | minimum number of ngram tokens to use for ngram-based speculative decoding (default: 48) | +| `--spec-ngram-mod-n-max N` | maximum number of ngram tokens to use for ngram-based speculative decoding (default: 64) | +| `--spec-ngram-mod-n-match N` | ngram-mod lookup length (default: 24) | +| `--spec-ngram-simple-size-n N` | ngram size N for ngram-simple speculative decoding, length of lookup n-gram (default: 12) | +| `--spec-ngram-simple-size-m N` | ngram size M for ngram-simple speculative decoding, length of draft m-gram (default: 48) | +| `--spec-ngram-simple-min-hits N` | minimum hits for ngram-simple speculative decoding (default: 1) | +| `--spec-ngram-map-k-size-n N` | ngram size N for ngram-map-k speculative decoding, length of lookup n-gram (default: 12) | +| `--spec-ngram-map-k-size-m N` | ngram size M for ngram-map-k speculative decoding, length of draft m-gram (default: 48) | +| `--spec-ngram-map-k-min-hits N` | minimum hits for ngram-map-k speculative decoding (default: 1) | +| `--spec-ngram-map-k4v-size-n N` | ngram size N for ngram-map-k4v speculative decoding, length of lookup n-gram (default: 12) | +| `--spec-ngram-map-k4v-size-m N` | ngram size M for ngram-map-k4v speculative decoding, length of draft m-gram (default: 48) | +| `--spec-ngram-map-k4v-min-hits N` | minimum hits for ngram-map-k4v speculative decoding (default: 1) | +| `--draft, --draft-n, --draft-max N` | the argument has been removed. use --spec-draft-n-max or --spec-ngram-mod-n-max<br/>(env: LLAMA_ARG_DRAFT_MAX) | +| `--draft-min, --draft-n-min N` | the argument has been removed. use --spec-draft-n-min or --spec-ngram-mod-n-min<br/>(env: LLAMA_ARG_DRAFT_MIN) | +| `--spec-ngram-size-n N` | the argument has been removed. use the respective --spec-ngram-*-size-n or --spec-ngram-mod-n-match | +| `--spec-ngram-size-m N` | the argument has been removed. use the respective --spec-ngram-*-size-m | +| `--spec-ngram-min-hits N` | the argument has been removed. use the respective --spec-ngram-*-min-hits | | `-mv, --model-vocoder FNAME` | vocoder model for audio generation (default: unused) | | `--tts-use-guide-tokens` | Use guide tokens to improve TTS word recall | | `--embd-gemma-default` | use default EmbeddingGemma model (note: can download weights from the internet) | @@ -256,6 +280,7 @@ For the full list of features, please refer to [server's changelog](https://gith | `--gpt-oss-120b-default` | use gpt-oss-120b (note: can download weights from the internet) | | `--vision-gemma-4b-default` | use Gemma 3 4B QAT (note: can download weights from the internet) | | `--vision-gemma-12b-default` | use Gemma 3 12B QAT (note: can download weights from the internet) | +| `--spec-default` | enable default speculative decoding config | <!-- HELP_END --> From fa8feaed34ee89f246bc46e3f487a97fdd6e9ac7 Mon Sep 17 00:00:00 2001 From: Nick Towle <ntowle@gmail.com> Date: Mon, 4 May 2026 00:04:07 -0700 Subject: [PATCH 10/10] webui: restore missing settings (#22666) --- tools/server/public/bundle.js | 372 +++++++++--------- .../src/lib/constants/settings-sections.ts | 15 + 2 files changed, 202 insertions(+), 185 deletions(-) diff --git a/tools/server/public/bundle.js b/tools/server/public/bundle.js index cb792c619..03c1feda2 100644 --- a/tools/server/public/bundle.js +++ b/tools/server/public/bundle.js @@ -810,77 +810,78 @@ return getSideAndAlignFromPlacement(placement)[1]}function Floating_layer($$anch getWindow}),this.handleTypeaheadSearch=this.handleTypeaheadSearch.bind(this),this.resetTypeahead=this.resetTypeahead.bind(this)}handleTypeaheadSearch(key2){if(!this.#opts.enabled()||!get$3(this.#candidateValues).length)return;this.#search.current=this.#search.current+key2;const currentItem=this.#opts.getCurrentItem(),currentMatch=get$3(this.#candidateValues).find(item=>item===currentItem)??"",values=get$3(this.#candidateValues).map(item=>item??""),nextMatch=getNextMatch(values,this.#search.current, currentMatch),newItem=get$3(this.#candidateValues).find(item=>item===nextMatch);return newItem&&this.#opts.onMatch(newItem),newItem}resetTypeahead(){this.#search.current=""}}const FIRST_KEYS=[ARROW_DOWN,PAGE_UP,HOME],LAST_KEYS=[ARROW_UP,PAGE_DOWN,END],FIRST_LAST_KEYS=[...FIRST_KEYS,...LAST_KEYS],selectAttrs=createBitsAttrs({component:"select",parts:["trigger","content","item","viewport","scroll-up-button","scroll-down-button","group","group-label","separator","arrow","input","content-wrapper","i\ tem-text","value"]}),SelectRootContext=new Context$1("Select.Root | Combobox.Root"),SelectContentContext=new Context$1("Select.Content | Combobox.Content");class SelectBaseRootState{opts;#touchedInput=state$1(!1);get touchedInput(){return get$3(this.#touchedInput)}set touchedInput(value){set$1(this.#touchedInput,value,!0)}#inputNode=state$1(null);get inputNode(){return get$3(this.#inputNode)}set inputNode(value){set$1(this.#inputNode,value,!0)}#contentNode=state$1(null);get contentNode(){return get$3( -this.#contentNode)}set contentNode(value){set$1(this.#contentNode,value,!0)}contentPresence;#viewportNode=state$1(null);get viewportNode(){return get$3(this.#viewportNode)}set viewportNode(value){set$1(this.#viewportNode,value,!0)}#triggerNode=state$1(null);get triggerNode(){return get$3(this.#triggerNode)}set triggerNode(value){set$1(this.#triggerNode,value,!0)}#valueId=state$1("");get valueId(){return get$3(this.#valueId)}set valueId(value){set$1(this.#valueId,value,!0)}#highlightedNode=state$1( -null);get highlightedNode(){return get$3(this.#highlightedNode)}set highlightedNode(value){set$1(this.#highlightedNode,value,!0)}#highlightedValue=user_derived(()=>this.highlightedNode?this.highlightedNode.getAttribute("data-value"):null);get highlightedValue(){return get$3(this.#highlightedValue)}set highlightedValue(value){set$1(this.#highlightedValue,value)}#highlightedId=user_derived(()=>{if(this.highlightedNode)return this.highlightedNode.id});get highlightedId(){return get$3(this.#highlightedId)}set highlightedId(value){ -set$1(this.#highlightedId,value)}#highlightedLabel=user_derived(()=>this.highlightedNode?this.highlightedNode.getAttribute("data-label"):null);get highlightedLabel(){return get$3(this.#highlightedLabel)}set highlightedLabel(value){set$1(this.#highlightedLabel,value)}#contentIsPositioned=state$1(!1);get contentIsPositioned(){return get$3(this.#contentIsPositioned)}set contentIsPositioned(value){set$1(this.#contentIsPositioned,value,!0)}isUsingKeyboard=!1;isCombobox=!1;domContext=new DOMContext(()=>null);constructor(opts){ -this.opts=opts,this.isCombobox=opts.isCombobox,this.contentPresence=new PresenceManager({ref:boxWith$1(()=>this.contentNode),open:this.opts.open,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),user_pre_effect(()=>{this.opts.open.current||this.setHighlightedNode(null)})}setHighlightedNode(node2,initial=!1){this.highlightedNode=node2,node2&&(this.isUsingKeyboard||initial)&&this.scrollHighlightedNodeIntoView(node2)}scrollHighlightedNodeIntoView(node2){!this.viewportNode|| -!this.contentIsPositioned||node2.scrollIntoView({block:this.opts.scrollAlignment.current})}getCandidateNodes(){const node2=this.contentNode;return node2?Array.from(node2.querySelectorAll(`[${this.getBitsAttr("item")}]:not([data-disabled])`)):[]}setHighlightedToFirstCandidate(initial=!1){this.setHighlightedNode(null);let nodes2=this.getCandidateNodes();if(nodes2.length){if(this.viewportNode){const viewportRect=this.viewportNode.getBoundingClientRect();nodes2=nodes2.filter(node2=>{if(!this.viewportNode) -return!1;const nodeRect=node2.getBoundingClientRect();return nodeRect.right<=viewportRect.right&&nodeRect.left>=viewportRect.left&&nodeRect.bottom<=viewportRect.bottom&&nodeRect.top>=viewportRect.top})}this.setHighlightedNode(nodes2[0],initial)}}getNodeByValue(value){return this.getCandidateNodes().find(node2=>node2.dataset.value===value)??null}setOpen(open2){this.opts.open.current=open2}toggleOpen(){this.opts.open.current=!this.opts.open.current}handleOpen(){this.setOpen(!0)}handleClose(){this. -setHighlightedNode(null),this.setOpen(!1)}toggleMenu(){this.toggleOpen()}getBitsAttr=part=>selectAttrs.getAttr(part,this.isCombobox?"combobox":void 0)}class SelectSingleRootState extends SelectBaseRootState{opts;isMulti=!1;#hasValue=user_derived(()=>this.opts.value.current!=="");get hasValue(){return get$3(this.#hasValue)}set hasValue(value){set$1(this.#hasValue,value)}#currentLabel=user_derived(()=>this.opts.items.current.length?this.opts.items.current.find(item=>item.value===this.opts.value.current)?. -label??"":"");get currentLabel(){return get$3(this.#currentLabel)}set currentLabel(value){set$1(this.#currentLabel,value)}#candidateLabels=user_derived(()=>this.opts.items.current.length?this.opts.items.current.filter(item=>!item.disabled).map(item=>item.label):[]);get candidateLabels(){return get$3(this.#candidateLabels)}set candidateLabels(value){set$1(this.#candidateLabels,value)}#dataTypeaheadEnabled=user_derived(()=>!(this.isMulti||this.opts.items.current.length===0));get dataTypeaheadEnabled(){ -return get$3(this.#dataTypeaheadEnabled)}set dataTypeaheadEnabled(value){set$1(this.#dataTypeaheadEnabled,value)}constructor(opts){super(opts),this.opts=opts,user_effect(()=>{!this.opts.open.current&&this.highlightedNode&&this.setHighlightedNode(null)}),watch$1(()=>this.opts.open.current,()=>{this.opts.open.current&&this.setInitialHighlightedNode()})}includesItem(itemValue){return this.opts.value.current===itemValue}toggleItem(itemValue,itemLabel=itemValue){const newValue=this.includesItem(itemValue)? -"":itemValue;this.opts.value.current=newValue,newValue!==""&&(this.opts.inputValue.current=itemLabel)}setInitialHighlightedNode(){afterTick(()=>{if(!(this.highlightedNode&&this.domContext.getDocument().contains(this.highlightedNode))){if(this.opts.value.current!==""){const node2=this.getNodeByValue(this.opts.value.current);if(node2){this.setHighlightedNode(node2,!0);return}}this.setHighlightedToFirstCandidate(!0)}})}}class SelectMultipleRootState extends SelectBaseRootState{opts;isMulti=!0;#hasValue=user_derived( -()=>this.opts.value.current.length>0);get hasValue(){return get$3(this.#hasValue)}set hasValue(value){set$1(this.#hasValue,value)}constructor(opts){super(opts),this.opts=opts,user_effect(()=>{!this.opts.open.current&&this.highlightedNode&&this.setHighlightedNode(null)}),watch$1(()=>this.opts.open.current,()=>{this.opts.open.current&&this.setInitialHighlightedNode()})}includesItem(itemValue){return this.opts.value.current.includes(itemValue)}toggleItem(itemValue,itemLabel=itemValue){this.includesItem( -itemValue)?this.opts.value.current=this.opts.value.current.filter(v=>v!==itemValue):this.opts.value.current=[...this.opts.value.current,itemValue],this.opts.inputValue.current=itemLabel}setInitialHighlightedNode(){afterTick(()=>{if(this.domContext&&!(this.highlightedNode&&this.domContext.getDocument().contains(this.highlightedNode))){if(this.opts.value.current.length&&this.opts.value.current[0]!==""){const node2=this.getNodeByValue(this.opts.value.current[0]);if(node2){this.setHighlightedNode(node2, -!0);return}}this.setHighlightedToFirstCandidate(!0)}})}}class SelectRootState{static create(props){const{type:type2,...rest}=props,rootState=type2==="single"?new SelectSingleRootState(rest):new SelectMultipleRootState(rest);return SelectRootContext.set(rootState)}}class SelectTriggerState{static create(opts){return new SelectTriggerState(opts,SelectRootContext.get())}opts;root;attachment;#domTypeahead;#dataTypeahead;constructor(opts,root2){this.opts=opts,this.root=root2,this.attachment=attachRef( -opts.ref,v=>this.root.triggerNode=v),this.root.domContext=new DOMContext(opts.ref),this.#domTypeahead=new DOMTypeahead({getCurrentItem:()=>this.root.highlightedNode,onMatch:node2=>{this.root.setHighlightedNode(node2)},getActiveElement:()=>this.root.domContext.getActiveElement(),getWindow:()=>this.root.domContext.getWindow()}),this.#dataTypeahead=new DataTypeahead({getCurrentItem:()=>this.root.isMulti?"":this.root.currentLabel,onMatch:label=>{if(this.root.isMulti||!this.root.opts.items.current)return; -const matchedItem=this.root.opts.items.current.find(item=>item.label===label);matchedItem&&(this.root.opts.value.current=matchedItem.value)},enabled:()=>!this.root.isMulti&&this.root.dataTypeaheadEnabled,candidateValues:()=>this.root.isMulti?[]:this.root.candidateLabels,getWindow:()=>this.root.domContext.getWindow()}),this.onkeydown=this.onkeydown.bind(this),this.onpointerdown=this.onpointerdown.bind(this),this.onpointerup=this.onpointerup.bind(this),this.onclick=this.onclick.bind(this)}#handleOpen(){ -this.root.opts.open.current=!0,this.#dataTypeahead.resetTypeahead(),this.#domTypeahead.resetTypeahead()}#handlePointerOpen(_){this.#handleOpen()}#handleKeyboardSelection(){const isCurrentSelectedValue=this.root.highlightedValue===this.root.opts.value.current;return!this.root.opts.allowDeselect.current&&isCurrentSelectedValue&&!this.root.isMulti?(this.root.handleClose(),!0):(this.root.highlightedValue!==null&&this.root.toggleItem(this.root.highlightedValue,this.root.highlightedLabel??void 0),!this. -root.isMulti&&!isCurrentSelectedValue?(this.root.handleClose(),!0):!1)}onkeydown(e){if(this.root.isUsingKeyboard=!0,(e.key===ARROW_UP||e.key===ARROW_DOWN)&&e.preventDefault(),!this.root.opts.open.current){if(e.key===ENTER||e.key===SPACE||e.key===ARROW_DOWN||e.key===ARROW_UP)e.preventDefault(),this.root.handleOpen();else if(!this.root.isMulti&&this.root.dataTypeaheadEnabled){this.#dataTypeahead.handleTypeaheadSearch(e.key);return}if(this.root.hasValue)return;const candidateNodes2=this.root.getCandidateNodes(); -if(!candidateNodes2.length)return;if(e.key===ARROW_DOWN){const firstCandidate=candidateNodes2[0];this.root.setHighlightedNode(firstCandidate)}else if(e.key===ARROW_UP){const lastCandidate=candidateNodes2[candidateNodes2.length-1];this.root.setHighlightedNode(lastCandidate)}return}if(e.key===TAB){this.root.handleClose();return}if((e.key===ENTER||e.key===SPACE&&this.#domTypeahead.search==="")&&!e.isComposing&&(e.preventDefault(),this.#handleKeyboardSelection()))return;if(e.key===ARROW_UP&&e.altKey&& -this.root.handleClose(),FIRST_LAST_KEYS.includes(e.key)){e.preventDefault();const candidateNodes2=this.root.getCandidateNodes(),currHighlightedNode=this.root.highlightedNode,currIndex=currHighlightedNode?candidateNodes2.indexOf(currHighlightedNode):-1,loop2=this.root.opts.loop.current;let nextItem;if(e.key===ARROW_DOWN?nextItem=next(candidateNodes2,currIndex,loop2):e.key===ARROW_UP?nextItem=prev(candidateNodes2,currIndex,loop2):e.key===PAGE_DOWN?nextItem=forward(candidateNodes2,currIndex,10,loop2): -e.key===PAGE_UP?nextItem=backward(candidateNodes2,currIndex,10,loop2):e.key===HOME?nextItem=candidateNodes2[0]:e.key===END&&(nextItem=candidateNodes2[candidateNodes2.length-1]),!nextItem)return;this.root.setHighlightedNode(nextItem);return}const isModifierKey=e.ctrlKey||e.altKey||e.metaKey,isCharacterKey=e.key.length===1,isSpaceKey=e.key===SPACE,candidateNodes=this.root.getCandidateNodes();if(e.key!==TAB){if(!isModifierKey&&(isCharacterKey||isSpaceKey)){!this.#domTypeahead.handleTypeaheadSearch( -e.key,candidateNodes)&&isSpaceKey&&(e.preventDefault(),this.#handleKeyboardSelection());return}this.root.highlightedNode||this.root.setHighlightedToFirstCandidate()}}onclick(e){e.currentTarget.focus()}onpointerdown(e){if(this.root.opts.disabled.current)return;if(e.pointerType==="touch")return e.preventDefault();const target2=e.target;target2?.hasPointerCapture(e.pointerId)&&target2?.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&(this.root.opts.open.current===!1?this.#handlePointerOpen( -e):this.root.handleClose())}onpointerup(e){this.root.opts.disabled.current||(e.preventDefault(),e.pointerType==="touch"&&(this.root.opts.open.current===!1?this.#handlePointerOpen(e):this.root.handleClose()))}#props=user_derived(()=>({id:this.opts.id.current,disabled:this.root.opts.disabled.current?!0:void 0,"aria-haspopup":"listbox","aria-expanded":boolToStr(this.root.opts.open.current),"aria-activedescendant":this.root.highlightedId,"data-state":getDataOpenClosed(this.root.opts.open.current),"d\ -ata-disabled":boolToEmptyStrOrUndef(this.root.opts.disabled.current),"data-placeholder":this.root.hasValue?void 0:"",[this.root.getBitsAttr("trigger")]:"",onpointerdown:this.onpointerdown,onkeydown:this.onkeydown,onclick:this.onclick,onpointerup:this.onpointerup,...this.attachment}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}}class SelectContentState{static create(opts){return SelectContentContext.set(new SelectContentState(opts,SelectRootContext.get()))}opts;root;attachment;#isPositioned=state$1( -!1);get isPositioned(){return get$3(this.#isPositioned)}set isPositioned(value){set$1(this.#isPositioned,value,!0)}domContext;constructor(opts,root2){this.opts=opts,this.root=root2,this.attachment=attachRef(opts.ref,v=>this.root.contentNode=v),this.domContext=new DOMContext(this.opts.ref),this.root.domContext===null&&(this.root.domContext=this.domContext),onDestroyEffect(()=>{this.root.contentNode=null,this.root.contentIsPositioned=!1,this.isPositioned=!1}),watch$1(()=>this.root.opts.open.current, -()=>{this.root.opts.open.current||(this.root.contentIsPositioned=!1,this.isPositioned=!1)}),watch$1([()=>this.isPositioned,()=>this.root.highlightedNode],()=>{!this.isPositioned||!this.root.highlightedNode||this.root.scrollHighlightedNodeIntoView(this.root.highlightedNode)}),this.onpointermove=this.onpointermove.bind(this)}onpointermove(_){this.root.isUsingKeyboard=!1}#styles=user_derived(()=>getFloatingContentCSSVars(this.root.isCombobox?"combobox":"select"));onInteractOutside=e=>{if(e.target=== -this.root.triggerNode||e.target===this.root.inputNode){e.preventDefault();return}this.opts.onInteractOutside.current(e),!e.defaultPrevented&&this.root.handleClose()};onEscapeKeydown=e=>{this.opts.onEscapeKeydown.current(e),!e.defaultPrevented&&this.root.handleClose()};onOpenAutoFocus=e=>{e.preventDefault()};onCloseAutoFocus=e=>{e.preventDefault()};get shouldRender(){return this.root.contentPresence.shouldRender}#snippetProps=user_derived(()=>({open:this.root.opts.open.current}));get snippetProps(){ -return get$3(this.#snippetProps)}set snippetProps(value){set$1(this.#snippetProps,value)}#props=user_derived(()=>({id:this.opts.id.current,role:"listbox","aria-multiselectable":this.root.isMulti?"true":void 0,"data-state":getDataOpenClosed(this.root.opts.open.current),...getDataTransitionAttrs(this.root.contentPresence.transitionStatus),[this.root.getBitsAttr("content")]:"",style:{display:"flex",flexDirection:"column",outline:"none",boxSizing:"border-box",pointerEvents:"auto",...get$3(this.#styles)}, -onpointermove:this.onpointermove,...this.attachment}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}popperProps={onInteractOutside:this.onInteractOutside,onEscapeKeydown:this.onEscapeKeydown,onOpenAutoFocus:this.onOpenAutoFocus,onCloseAutoFocus:this.onCloseAutoFocus,trapFocus:!1,loop:!1,onPlaced:()=>{this.root.opts.open.current&&(this.root.contentIsPositioned=!0,this.isPositioned=!0)}}}class SelectItemState{static create(opts){return new SelectItemState(opts,SelectRootContext. -get())}opts;root;attachment;#isSelected=user_derived(()=>this.root.includesItem(this.opts.value.current));get isSelected(){return get$3(this.#isSelected)}set isSelected(value){set$1(this.#isSelected,value)}#isHighlighted=user_derived(()=>this.root.highlightedValue===this.opts.value.current);get isHighlighted(){return get$3(this.#isHighlighted)}set isHighlighted(value){set$1(this.#isHighlighted,value)}prevHighlighted=new Previous(()=>this.isHighlighted);#mounted=state$1(!1);get mounted(){return get$3( -this.#mounted)}set mounted(value){set$1(this.#mounted,value,!0)}constructor(opts,root2){this.opts=opts,this.root=root2,this.attachment=attachRef(opts.ref),watch$1([()=>this.isHighlighted,()=>this.prevHighlighted.current],()=>{this.isHighlighted?this.opts.onHighlight.current():this.prevHighlighted.current&&this.opts.onUnhighlight.current()}),watch$1(()=>this.mounted,()=>{this.mounted&&this.root.setInitialHighlightedNode()}),this.onpointerdown=this.onpointerdown.bind(this),this.onpointerup=this.onpointerup. -bind(this),this.onpointermove=this.onpointermove.bind(this)}handleSelect(){if(this.opts.disabled.current)return;const isCurrentSelectedValue=this.opts.value.current===this.root.opts.value.current;if(!this.root.opts.allowDeselect.current&&isCurrentSelectedValue&&!this.root.isMulti){this.root.handleClose();return}this.root.toggleItem(this.opts.value.current,this.opts.label.current),!this.root.isMulti&&!isCurrentSelectedValue&&this.root.handleClose()}#snippetProps=user_derived(()=>({selected:this.isSelected, -highlighted:this.isHighlighted}));get snippetProps(){return get$3(this.#snippetProps)}set snippetProps(value){set$1(this.#snippetProps,value)}onpointerdown(e){e.preventDefault()}onpointerup(e){if(!(e.defaultPrevented||!this.opts.ref.current)){if(e.pointerType==="touch"&&!isIOS){on(this.opts.ref.current,"click",()=>{this.handleSelect(),this.root.setHighlightedNode(this.opts.ref.current)},{once:!0});return}e.preventDefault(),this.handleSelect(),e.pointerType==="touch"&&this.root.setHighlightedNode( -this.opts.ref.current)}}onpointermove(e){e.pointerType!=="touch"&&this.root.highlightedNode!==this.opts.ref.current&&this.root.setHighlightedNode(this.opts.ref.current)}#props=user_derived(()=>({id:this.opts.id.current,role:"option","aria-selected":this.root.includesItem(this.opts.value.current)?"true":void 0,"data-value":this.opts.value.current,"data-disabled":boolToEmptyStrOrUndef(this.opts.disabled.current),"data-highlighted":this.root.highlightedValue===this.opts.value.current&&!this.opts.disabled. -current?"":void 0,"data-selected":this.root.includesItem(this.opts.value.current)?"":void 0,"data-label":this.opts.label.current,[this.root.getBitsAttr("item")]:"",onpointermove:this.onpointermove,onpointerdown:this.onpointerdown,onpointerup:this.onpointerup,...this.attachment}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}}class SelectHiddenInputState{static create(opts){return new SelectHiddenInputState(opts,SelectRootContext.get())}opts;root;#shouldRender=user_derived( -()=>this.root.opts.name.current!=="");get shouldRender(){return get$3(this.#shouldRender)}set shouldRender(value){set$1(this.#shouldRender,value)}constructor(opts,root2){this.opts=opts,this.root=root2,this.onfocus=this.onfocus.bind(this)}onfocus(e){e.preventDefault(),this.root.isCombobox?this.root.inputNode?.focus():this.root.triggerNode?.focus()}#props=user_derived(()=>({disabled:boolToTrueOrUndef(this.root.opts.disabled.current),required:boolToTrueOrUndef(this.root.opts.required.current),name:this. -root.opts.name.current,value:this.opts.value.current,onfocus:this.onfocus}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}}class SelectViewportState{static create(opts){return new SelectViewportState(opts,SelectContentContext.get())}opts;content;root;attachment;#prevScrollTop=state$1(0);get prevScrollTop(){return get$3(this.#prevScrollTop)}set prevScrollTop(value){set$1(this.#prevScrollTop,value,!0)}constructor(opts,content2){this.opts=opts,this.content=content2, -this.root=content2.root,this.attachment=attachRef(opts.ref,v=>{this.root.viewportNode=v})}#props=user_derived(()=>({id:this.opts.id.current,role:"presentation",[this.root.getBitsAttr("viewport")]:"",style:{position:"relative",flex:1,overflow:"auto"},...this.attachment}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}}class SelectScrollButtonImplState{opts;content;root;attachment;autoScrollTimer=null;userScrollTimer=-1;isUserScrolling=!1;onAutoScroll=noop$1;#mounted=state$1( -!1);get mounted(){return get$3(this.#mounted)}set mounted(value){set$1(this.#mounted,value,!0)}constructor(opts,content2){this.opts=opts,this.content=content2,this.root=content2.root,this.attachment=attachRef(opts.ref),watch$1([()=>this.mounted],()=>{if(!this.mounted){this.isUserScrolling=!1;return}this.isUserScrolling}),user_effect(()=>{this.mounted||this.clearAutoScrollInterval()}),this.onpointerdown=this.onpointerdown.bind(this),this.onpointermove=this.onpointermove.bind(this),this.onpointerleave= -this.onpointerleave.bind(this)}handleUserScroll(){this.content.domContext.clearTimeout(this.userScrollTimer),this.isUserScrolling=!0,this.userScrollTimer=this.content.domContext.setTimeout(()=>{this.isUserScrolling=!1},200)}clearAutoScrollInterval(){this.autoScrollTimer!==null&&(this.content.domContext.clearTimeout(this.autoScrollTimer),this.autoScrollTimer=null)}onpointerdown(_){if(this.autoScrollTimer!==null)return;const autoScroll=tick2=>{this.onAutoScroll(),this.autoScrollTimer=this.content. -domContext.setTimeout(()=>autoScroll(tick2+1),this.opts.delay.current(tick2))};this.autoScrollTimer=this.content.domContext.setTimeout(()=>autoScroll(1),this.opts.delay.current(0))}onpointermove(e){this.onpointerdown(e)}onpointerleave(_){this.clearAutoScrollInterval()}#props=user_derived(()=>({id:this.opts.id.current,"aria-hidden":boolToStrTrueOrUndef(!0),style:{flexShrink:0},onpointerdown:this.onpointerdown,onpointermove:this.onpointermove,onpointerleave:this.onpointerleave,...this.attachment}));get props(){ -return get$3(this.#props)}set props(value){set$1(this.#props,value)}}class SelectScrollDownButtonState{static create(opts){return new SelectScrollDownButtonState(new SelectScrollButtonImplState(opts,SelectContentContext.get()))}scrollButtonState;content;root;#canScrollDown=state$1(!1);get canScrollDown(){return get$3(this.#canScrollDown)}set canScrollDown(value){set$1(this.#canScrollDown,value,!0)}scrollIntoViewTimer=null;constructor(scrollButtonState){this.scrollButtonState=scrollButtonState,this. -content=scrollButtonState.content,this.root=scrollButtonState.root,this.scrollButtonState.onAutoScroll=this.handleAutoScroll,watch$1([()=>this.root.viewportNode,()=>this.content.isPositioned],()=>{if(!(!this.root.viewportNode||!this.content.isPositioned))return this.handleScroll(!0),on(this.root.viewportNode,"scroll",()=>this.handleScroll())}),watch$1([()=>this.root.opts.inputValue.current,()=>this.root.viewportNode,()=>this.content.isPositioned],()=>{!this.root.viewportNode||!this.content.isPositioned|| -this.handleScroll(!0)}),watch$1(()=>this.scrollButtonState.mounted,()=>{this.scrollButtonState.mounted&&(this.scrollIntoViewTimer&&clearTimeout(this.scrollIntoViewTimer),this.scrollIntoViewTimer=afterSleep(5,()=>{const activeItem=this.root.highlightedNode;activeItem&&this.root.scrollHighlightedNodeIntoView(activeItem)}))})}handleScroll=(manual=!1)=>{if(manual||this.scrollButtonState.handleUserScroll(),!this.root.viewportNode)return;const maxScroll=this.root.viewportNode.scrollHeight-this.root.viewportNode. -clientHeight,paddingTop=Number.parseInt(getComputedStyle(this.root.viewportNode).paddingTop,10);this.canScrollDown=Math.ceil(this.root.viewportNode.scrollTop)<maxScroll-paddingTop};handleAutoScroll=()=>{const viewport=this.root.viewportNode,selectedItem=this.root.highlightedNode;!viewport||!selectedItem||(viewport.scrollTop=viewport.scrollTop+selectedItem.offsetHeight)};#props=user_derived(()=>({...this.scrollButtonState.props,[this.root.getBitsAttr("scroll-down-button")]:""}));get props(){return get$3( -this.#props)}set props(value){set$1(this.#props,value)}}class SelectScrollUpButtonState{static create(opts){return new SelectScrollUpButtonState(new SelectScrollButtonImplState(opts,SelectContentContext.get()))}scrollButtonState;content;root;#canScrollUp=state$1(!1);get canScrollUp(){return get$3(this.#canScrollUp)}set canScrollUp(value){set$1(this.#canScrollUp,value,!0)}constructor(scrollButtonState){this.scrollButtonState=scrollButtonState,this.content=scrollButtonState.content,this.root=scrollButtonState. -root,this.scrollButtonState.onAutoScroll=this.handleAutoScroll,watch$1([()=>this.root.viewportNode,()=>this.content.isPositioned],()=>{if(!(!this.root.viewportNode||!this.content.isPositioned))return this.handleScroll(!0),on(this.root.viewportNode,"scroll",()=>this.handleScroll())})}handleScroll=(manual=!1)=>{if(manual||this.scrollButtonState.handleUserScroll(),!this.root.viewportNode)return;const paddingTop=Number.parseInt(getComputedStyle(this.root.viewportNode).paddingTop,10);this.canScrollUp= -this.root.viewportNode.scrollTop-paddingTop>.1};handleAutoScroll=()=>{!this.root.viewportNode||!this.root.highlightedNode||(this.root.viewportNode.scrollTop=this.root.viewportNode.scrollTop-this.root.highlightedNode.offsetHeight)};#props=user_derived(()=>({...this.scrollButtonState.props,[this.root.getBitsAttr("scroll-up-button")]:""}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}}function Select_hidden_input($$anchor,$$props){push$1($$props,!0);let value=prop( -$$props,"value",15);const hiddenInputState=SelectHiddenInputState.create({value:boxWith$1(()=>value())});var fragment=comment$2(),node2=first_child(fragment);{var consequent=$$anchor2=>{Hidden_input($$anchor2,spread_props(()=>hiddenInputState.props,{get autocomplete(){return $$props.autocomplete},get value(){return value()},set value($$value){value($$value)}}))};if_block(node2,$$render=>{hiddenInputState.shouldRender&&$$render(consequent)})}append($$anchor,fragment),pop()}function Floating_layer_anchor($$anchor,$$props){ -push$1($$props,!0);let tooltip=prop($$props,"tooltip",3,!1);FloatingAnchorState.create({id:boxWith$1(()=>$$props.id),virtualEl:boxWith$1(()=>$$props.virtualEl),ref:$$props.ref},tooltip());var fragment=comment$2(),node2=first_child(fragment);snippet(node2,()=>$$props.children??noop$3),append($$anchor,fragment),pop()}var root_4$K=from_svg('<svg viewBox="0 0 30 10" preserveAspectRatio="none" data-arrow=""><polygon points="0,0 30,0 15,10" fill="currentColor"></polygon></svg>'),root_2$1t=from_html("<\ -span><!></span>");function Arrow($$anchor,$$props){push$1($$props,!0);let id2=prop($$props,"id",19,useId),width=prop($$props,"width",3,10),height=prop($$props,"height",3,5),restProps=rest_props($$props,["$$slots","$$events","$$legacy","id","children","child","width","height"]);const mergedProps=user_derived(()=>mergeProps(restProps,{id:id2()}));var fragment=comment$2(),node2=first_child(fragment);{var consequent=$$anchor2=>{var fragment_1=comment$2(),node_1=first_child(fragment_1);snippet(node_1, -()=>$$props.child,()=>({props:get$3(mergedProps)})),append($$anchor2,fragment_1)},alternate_1=$$anchor2=>{var span=root_2$1t();attribute_effect(span,()=>({...get$3(mergedProps)}));var node_2=child(span);{var consequent_1=$$anchor3=>{var fragment_2=comment$2(),node_3=first_child(fragment_2);snippet(node_3,()=>$$props.children??noop$3),append($$anchor3,fragment_2)},alternate=$$anchor3=>{var svg2=root_4$K();template_effect(()=>{set_attribute(svg2,"width",width()),set_attribute(svg2,"height",height())}), -append($$anchor3,svg2)};if_block(node_2,$$render=>{$$props.children?$$render(consequent_1):$$render(alternate,-1)})}reset(span),append($$anchor2,span)};if_block(node2,$$render=>{$$props.child?$$render(consequent):$$render(alternate_1,-1)})}append($$anchor,fragment),pop()}function Floating_layer_arrow($$anchor,$$props){push$1($$props,!0);let id2=prop($$props,"id",19,useId),ref2=prop($$props,"ref",15,null),restProps=rest_props($$props,["$$slots","$$events","$$legacy","id","ref"]);const arrowState=FloatingArrowState. -create({id:boxWith$1(()=>id2()),ref:boxWith$1(()=>ref2(),v=>ref2(v))}),mergedProps=user_derived(()=>mergeProps(restProps,arrowState.props));Arrow($$anchor,spread_props(()=>get$3(mergedProps))),pop()}function Floating_layer_content($$anchor,$$props){push$1($$props,!0);let side=prop($$props,"side",3,"bottom"),sideOffset=prop($$props,"sideOffset",3,0),align=prop($$props,"align",3,"center"),alignOffset=prop($$props,"alignOffset",3,0),arrowPadding=prop($$props,"arrowPadding",3,0),avoidCollisions=prop( -$$props,"avoidCollisions",3,!0),collisionBoundary=prop($$props,"collisionBoundary",19,()=>[]),collisionPadding=prop($$props,"collisionPadding",3,0),hideWhenDetached=prop($$props,"hideWhenDetached",3,!1),onPlaced=prop($$props,"onPlaced",3,()=>{}),sticky=prop($$props,"sticky",3,"partial"),updatePositionStrategy=prop($$props,"updatePositionStrategy",3,"optimized"),strategy=prop($$props,"strategy",3,"fixed"),dir=prop($$props,"dir",3,"ltr"),style2=prop($$props,"style",19,()=>({})),wrapperId=prop($$props, -"wrapperId",19,useId),customAnchor=prop($$props,"customAnchor",3,null),tooltip=prop($$props,"tooltip",3,!1);const contentState=FloatingContentState.create({side:boxWith$1(()=>side()),sideOffset:boxWith$1(()=>sideOffset()),align:boxWith$1(()=>align()),alignOffset:boxWith$1(()=>alignOffset()),id:boxWith$1(()=>$$props.id),arrowPadding:boxWith$1(()=>arrowPadding()),avoidCollisions:boxWith$1(()=>avoidCollisions()),collisionBoundary:boxWith$1(()=>collisionBoundary()),collisionPadding:boxWith$1(()=>collisionPadding()), -hideWhenDetached:boxWith$1(()=>hideWhenDetached()),onPlaced:boxWith$1(()=>onPlaced()),sticky:boxWith$1(()=>sticky()),updatePositionStrategy:boxWith$1(()=>updatePositionStrategy()),strategy:boxWith$1(()=>strategy()),dir:boxWith$1(()=>dir()),style:boxWith$1(()=>style2()),enabled:boxWith$1(()=>$$props.enabled),wrapperId:boxWith$1(()=>wrapperId()),customAnchor:boxWith$1(()=>customAnchor())},tooltip()),mergedProps=user_derived(()=>mergeProps(contentState.wrapperProps,{style:{pointerEvents:"auto"}})); -var fragment=comment$2(),node2=first_child(fragment);snippet(node2,()=>$$props.content??noop$3,()=>({props:contentState.props,wrapperProps:get$3(mergedProps)})),append($$anchor,fragment),pop()}function Floating_layer_content_static($$anchor,$$props){push$1($$props,!0),onMount$1(()=>{$$props.onPlaced?.()});var fragment=comment$2(),node2=first_child(fragment);snippet(node2,()=>$$props.content??noop$3,()=>({props:{},wrapperProps:{}})),append($$anchor,fragment),pop()}function Popper_content($$anchor,$$props){ -let isStatic=prop($$props,"isStatic",3,!1),restProps=rest_props($$props,["$$slots","$$events","$$legacy","content","isStatic","onPlaced"]);var fragment=comment$2(),node2=first_child(fragment);{var consequent=$$anchor2=>{Floating_layer_content_static($$anchor2,{get content(){return $$props.content},get onPlaced(){return $$props.onPlaced}})},alternate=$$anchor2=>{Floating_layer_content($$anchor2,spread_props({get content(){return $$props.content},get onPlaced(){return $$props.onPlaced}},()=>restProps))}; -if_block(node2,$$render=>{isStatic()?$$render(consequent):$$render(alternate,-1)})}append($$anchor,fragment)}var root_1$19=from_html("<!> <!>",1);function Popper_layer_inner($$anchor,$$props){push$1($$props,!0);let interactOutsideBehavior=prop($$props,"interactOutsideBehavior",3,"close"),trapFocus=prop($$props,"trapFocus",3,!0),isValidEvent2=prop($$props,"isValidEvent",3,()=>!1),customAnchor=prop($$props,"customAnchor",3,null),isStatic=prop($$props,"isStatic",3,!1),tooltip=prop($$props,"tooltip", -3,!1),contentPointerEvents=prop($$props,"contentPointerEvents",3,"auto"),restProps=rest_props($$props,["$$slots","$$events","$$legacy","popper","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutsid\ -e","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","enabled","ref","tooltip","contentPointerEvents"]);const resolvedPreventScroll=user_derived(()=>$$props.preventScroll??!0),effectiveStrategy=user_derived(()=>$$props.strategy??(get$3(resolvedPreventScroll)?"fixed":"absolute"));Popper_content($$anchor,{get isStatic(){return isStatic()},get id(){return $$props.id},get side(){return $$props.side},get sideOffset(){ -return $$props.sideOffset},get align(){return $$props.align},get alignOffset(){return $$props.alignOffset},get arrowPadding(){return $$props.arrowPadding},get avoidCollisions(){return $$props.avoidCollisions},get collisionBoundary(){return $$props.collisionBoundary},get collisionPadding(){return $$props.collisionPadding},get sticky(){return $$props.sticky},get hideWhenDetached(){return $$props.hideWhenDetached},get updatePositionStrategy(){return $$props.updatePositionStrategy},get strategy(){return get$3( -effectiveStrategy)},get dir(){return $$props.dir},get wrapperId(){return $$props.wrapperId},get style(){return $$props.style},get onPlaced(){return $$props.onPlaced},get customAnchor(){return customAnchor()},get enabled(){return $$props.enabled},get tooltip(){return tooltip()},content:($$anchor2,$$arg0)=>{let floatingProps=()=>$$arg0?.().props,wrapperProps=()=>$$arg0?.().wrapperProps;var fragment_1=root_1$19(),node2=first_child(fragment_1);{var consequent=$$anchor3=>{Scroll_lock($$anchor3,{get preventScroll(){ -return get$3(resolvedPreventScroll)}})},consequent_1=$$anchor3=>{Scroll_lock($$anchor3,{get preventScroll(){return get$3(resolvedPreventScroll)}})};if_block(node2,$$render=>{$$props.forceMount&&$$props.enabled?$$render(consequent):$$props.forceMount||$$render(consequent_1,1)})}var node_1=sibling(node2,2);Focus_scope(node_1,{get onOpenAutoFocus(){return $$props.onOpenAutoFocus},get onCloseAutoFocus(){return $$props.onCloseAutoFocus},get loop(){return $$props.loop},get enabled(){return $$props.enabled}, -get trapFocus(){return trapFocus()},get forceMount(){return $$props.forceMount},get ref(){return $$props.ref},focusScope:($$anchor3,$$arg02)=>{let focusScopeProps=()=>$$arg02?.().props;Escape_layer($$anchor3,{get onEscapeKeydown(){return $$props.onEscapeKeydown},get escapeKeydownBehavior(){return $$props.escapeKeydownBehavior},get enabled(){return $$props.enabled},get ref(){return $$props.ref},children:($$anchor4,$$slotProps)=>{Dismissible_layer($$anchor4,{get id(){return $$props.id},get onInteractOutside(){ -return $$props.onInteractOutside},get onFocusOutside(){return $$props.onFocusOutside},get interactOutsideBehavior(){return interactOutsideBehavior()},get isValidEvent(){return isValidEvent2()},get enabled(){return $$props.enabled},get ref(){return $$props.ref},children:($$anchor5,$$arg03)=>{let dismissibleProps=()=>$$arg03?.().props;Text_selection_layer($$anchor5,{get id(){return $$props.id},get preventOverflowTextSelection(){return $$props.preventOverflowTextSelection},get onPointerDown(){return $$props. -onPointerDown},get onPointerUp(){return $$props.onPointerUp},get enabled(){return $$props.enabled},get ref(){return $$props.ref},children:($$anchor6,$$slotProps2)=>{var fragment_7=comment$2(),node_2=first_child(fragment_7);{let $0=user_derived(()=>({props:mergeProps(restProps,floatingProps(),dismissibleProps(),focusScopeProps(),{style:{pointerEvents:contentPointerEvents()}}),wrapperProps:wrapperProps()}));snippet(node_2,()=>$$props.popper??noop$3,()=>get$3($0))}append($$anchor6,fragment_7)},$$slots:{ -default:!0}})},$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{focusScope:!0}}),append($$anchor2,fragment_1)},$$slots:{content:!0}}),pop()}function Popper_layer($$anchor,$$props){let interactOutsideBehavior=prop($$props,"interactOutsideBehavior",3,"close"),trapFocus=prop($$props,"trapFocus",3,!0),isValidEvent2=prop($$props,"isValidEvent",3,()=>!1),customAnchor=prop($$props,"customAnchor",3,null),isStatic=prop($$props,"isStatic",3,!1),restProps=rest_props($$props,["$$slots","$$events","$\ -$legacy","popper","open","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","c\ -ustomAnchor","isStatic","ref","shouldRender"]);var fragment=comment$2(),node2=first_child(fragment);{var consequent=$$anchor2=>{Popper_layer_inner($$anchor2,spread_props({get popper(){return $$props.popper},get onEscapeKeydown(){return $$props.onEscapeKeydown},get escapeKeydownBehavior(){return $$props.escapeKeydownBehavior},get preventOverflowTextSelection(){return $$props.preventOverflowTextSelection},get id(){return $$props.id},get onPointerDown(){return $$props.onPointerDown},get onPointerUp(){ -return $$props.onPointerUp},get side(){return $$props.side},get sideOffset(){return $$props.sideOffset},get align(){return $$props.align},get alignOffset(){return $$props.alignOffset},get arrowPadding(){return $$props.arrowPadding},get avoidCollisions(){return $$props.avoidCollisions},get collisionBoundary(){return $$props.collisionBoundary},get collisionPadding(){return $$props.collisionPadding},get sticky(){return $$props.sticky},get hideWhenDetached(){return $$props.hideWhenDetached},get updatePositionStrategy(){ +this.#contentNode)}set contentNode(value){set$1(this.#contentNode,value,!0)}contentPresence;#viewportNode=state$1(null);get viewportNode(){return get$3(this.#viewportNode)}set viewportNode(value){set$1(this.#viewportNode,value,!0)}#triggerNode=state$1(null);get triggerNode(){return get$3(this.#triggerNode)}set triggerNode(value){set$1(this.#triggerNode,value,!0)}#valueNode=state$1(null);get valueNode(){return get$3(this.#valueNode)}set valueNode(value){set$1(this.#valueNode,value,!0)}#valueId=state$1( +"");get valueId(){return get$3(this.#valueId)}set valueId(value){set$1(this.#valueId,value,!0)}#highlightedNode=state$1(null);get highlightedNode(){return get$3(this.#highlightedNode)}set highlightedNode(value){set$1(this.#highlightedNode,value,!0)}#highlightedValue=user_derived(()=>this.highlightedNode?this.highlightedNode.getAttribute("data-value"):null);get highlightedValue(){return get$3(this.#highlightedValue)}set highlightedValue(value){set$1(this.#highlightedValue,value)}#highlightedId=user_derived( +()=>{if(this.highlightedNode)return this.highlightedNode.id});get highlightedId(){return get$3(this.#highlightedId)}set highlightedId(value){set$1(this.#highlightedId,value)}#highlightedLabel=user_derived(()=>this.highlightedNode?this.highlightedNode.getAttribute("data-label"):null);get highlightedLabel(){return get$3(this.#highlightedLabel)}set highlightedLabel(value){set$1(this.#highlightedLabel,value)}#contentIsPositioned=state$1(!1);get contentIsPositioned(){return get$3(this.#contentIsPositioned)}set contentIsPositioned(value){ +set$1(this.#contentIsPositioned,value,!0)}isUsingKeyboard=!1;isCombobox=!1;domContext=new DOMContext(()=>null);constructor(opts){this.opts=opts,this.isCombobox=opts.isCombobox,this.contentPresence=new PresenceManager({ref:boxWith$1(()=>this.contentNode),open:this.opts.open,onComplete:()=>{this.opts.onOpenChangeComplete.current(this.opts.open.current)}}),user_pre_effect(()=>{this.opts.open.current||this.setHighlightedNode(null)})}setHighlightedNode(node2,initial=!1){this.highlightedNode=node2,node2&& +(this.isUsingKeyboard||initial)&&this.scrollHighlightedNodeIntoView(node2)}scrollHighlightedNodeIntoView(node2){!this.viewportNode||!this.contentIsPositioned||node2.scrollIntoView({block:this.opts.scrollAlignment.current})}getCandidateNodes(){const node2=this.contentNode;return node2?Array.from(node2.querySelectorAll(`[${this.getBitsAttr("item")}]:not([data-disabled])`)):[]}setHighlightedToFirstCandidate(initial=!1){this.setHighlightedNode(null);let nodes2=this.getCandidateNodes();if(nodes2.length){ +if(this.viewportNode){const viewportRect=this.viewportNode.getBoundingClientRect();nodes2=nodes2.filter(node2=>{if(!this.viewportNode)return!1;const nodeRect=node2.getBoundingClientRect();return nodeRect.right<=viewportRect.right&&nodeRect.left>=viewportRect.left&&nodeRect.bottom<=viewportRect.bottom&&nodeRect.top>=viewportRect.top})}this.setHighlightedNode(nodes2[0],initial)}}getNodeByValue(value){return this.getCandidateNodes().find(node2=>node2.dataset.value===value)??null}getLabelForValue(value){ +if(value==="")return"";const fromItems=this.opts.items.current.find(item=>item.value===value)?.label;if(fromItems!==void 0)return fromItems;const node2=this.getNodeByValue(value);if(node2){const dataLabel=node2.getAttribute("data-label");return dataLabel!==null&&dataLabel!==""?dataLabel:node2.textContent?.trim()??value}return value}setOpen(open2){this.opts.open.current=open2}toggleOpen(){this.opts.open.current=!this.opts.open.current}handleOpen(){this.setOpen(!0)}handleClose(){this.setHighlightedNode( +null),this.setOpen(!1)}toggleMenu(){this.toggleOpen()}getBitsAttr=part=>selectAttrs.getAttr(part,this.isCombobox?"combobox":void 0)}class SelectSingleRootState extends SelectBaseRootState{opts;isMulti=!1;#hasValue=user_derived(()=>this.opts.value.current!=="");get hasValue(){return get$3(this.#hasValue)}set hasValue(value){set$1(this.#hasValue,value)}#currentLabel=user_derived(()=>this.opts.items.current.length?this.opts.items.current.find(item=>item.value===this.opts.value.current)?.label??"":"");get currentLabel(){ +return get$3(this.#currentLabel)}set currentLabel(value){set$1(this.#currentLabel,value)}#candidateLabels=user_derived(()=>this.opts.items.current.length?this.opts.items.current.filter(item=>!item.disabled).map(item=>item.label):[]);get candidateLabels(){return get$3(this.#candidateLabels)}set candidateLabels(value){set$1(this.#candidateLabels,value)}#dataTypeaheadEnabled=user_derived(()=>!(this.isMulti||this.opts.items.current.length===0));get dataTypeaheadEnabled(){return get$3(this.#dataTypeaheadEnabled)}set dataTypeaheadEnabled(value){ +set$1(this.#dataTypeaheadEnabled,value)}constructor(opts){super(opts),this.opts=opts,user_effect(()=>{!this.opts.open.current&&this.highlightedNode&&this.setHighlightedNode(null)}),watch$1(()=>this.opts.open.current,()=>{this.opts.open.current&&this.setInitialHighlightedNode()})}includesItem(itemValue){return this.opts.value.current===itemValue}toggleItem(itemValue,itemLabel=itemValue){const newValue=this.includesItem(itemValue)?"":itemValue;this.opts.value.current=newValue,newValue!==""&&(this. +opts.inputValue.current=itemLabel)}setInitialHighlightedNode(){afterTick(()=>{if(!(this.highlightedNode&&this.domContext.getDocument().contains(this.highlightedNode))){if(this.opts.value.current!==""){const node2=this.getNodeByValue(this.opts.value.current);if(node2){this.setHighlightedNode(node2,!0);return}}this.setHighlightedToFirstCandidate(!0)}})}}class SelectMultipleRootState extends SelectBaseRootState{opts;isMulti=!0;#hasValue=user_derived(()=>this.opts.value.current.length>0);get hasValue(){ +return get$3(this.#hasValue)}set hasValue(value){set$1(this.#hasValue,value)}constructor(opts){super(opts),this.opts=opts,user_effect(()=>{!this.opts.open.current&&this.highlightedNode&&this.setHighlightedNode(null)}),watch$1(()=>this.opts.open.current,()=>{this.opts.open.current&&this.setInitialHighlightedNode()})}includesItem(itemValue){return this.opts.value.current.includes(itemValue)}toggleItem(itemValue,itemLabel=itemValue){this.includesItem(itemValue)?this.opts.value.current=this.opts.value. +current.filter(v=>v!==itemValue):this.opts.value.current=[...this.opts.value.current,itemValue],this.opts.inputValue.current=itemLabel}setInitialHighlightedNode(){afterTick(()=>{if(this.domContext&&!(this.highlightedNode&&this.domContext.getDocument().contains(this.highlightedNode))){if(this.opts.value.current.length&&this.opts.value.current[0]!==""){const node2=this.getNodeByValue(this.opts.value.current[0]);if(node2){this.setHighlightedNode(node2,!0);return}}this.setHighlightedToFirstCandidate( +!0)}})}}class SelectRootState{static create(props){const{type:type2,...rest}=props,rootState=type2==="single"?new SelectSingleRootState(rest):new SelectMultipleRootState(rest);return SelectRootContext.set(rootState)}}class SelectTriggerState{static create(opts){return new SelectTriggerState(opts,SelectRootContext.get())}opts;root;attachment;#domTypeahead;#dataTypeahead;constructor(opts,root2){this.opts=opts,this.root=root2,this.attachment=attachRef(opts.ref,v=>this.root.triggerNode=v),this.root. +domContext=new DOMContext(opts.ref),this.#domTypeahead=new DOMTypeahead({getCurrentItem:()=>this.root.highlightedNode,onMatch:node2=>{this.root.setHighlightedNode(node2)},getActiveElement:()=>this.root.domContext.getActiveElement(),getWindow:()=>this.root.domContext.getWindow()}),this.#dataTypeahead=new DataTypeahead({getCurrentItem:()=>this.root.isMulti?"":this.root.currentLabel,onMatch:label=>{if(this.root.isMulti||!this.root.opts.items.current)return;const matchedItem=this.root.opts.items.current. +find(item=>item.label===label);matchedItem&&(this.root.opts.value.current=matchedItem.value)},enabled:()=>!this.root.isMulti&&this.root.dataTypeaheadEnabled,candidateValues:()=>this.root.isMulti?[]:this.root.candidateLabels,getWindow:()=>this.root.domContext.getWindow()}),this.onkeydown=this.onkeydown.bind(this),this.onpointerdown=this.onpointerdown.bind(this),this.onpointerup=this.onpointerup.bind(this),this.onclick=this.onclick.bind(this)}#handleOpen(){this.root.opts.open.current=!0,this.#dataTypeahead. +resetTypeahead(),this.#domTypeahead.resetTypeahead()}#handlePointerOpen(_){this.#handleOpen()}#handleKeyboardSelection(){const isCurrentSelectedValue=this.root.highlightedValue===this.root.opts.value.current;return!this.root.opts.allowDeselect.current&&isCurrentSelectedValue&&!this.root.isMulti?(this.root.handleClose(),!0):(this.root.highlightedValue!==null&&this.root.toggleItem(this.root.highlightedValue,this.root.highlightedLabel??void 0),!this.root.isMulti&&!isCurrentSelectedValue?(this.root. +handleClose(),!0):!1)}onkeydown(e){if(this.root.isUsingKeyboard=!0,(e.key===ARROW_UP||e.key===ARROW_DOWN)&&e.preventDefault(),!this.root.opts.open.current){if(e.key===ENTER||e.key===SPACE||e.key===ARROW_DOWN||e.key===ARROW_UP)e.preventDefault(),this.root.handleOpen();else if(!this.root.isMulti&&this.root.dataTypeaheadEnabled){this.#dataTypeahead.handleTypeaheadSearch(e.key);return}if(this.root.hasValue)return;const candidateNodes2=this.root.getCandidateNodes();if(!candidateNodes2.length)return;if(e. +key===ARROW_DOWN){const firstCandidate=candidateNodes2[0];this.root.setHighlightedNode(firstCandidate)}else if(e.key===ARROW_UP){const lastCandidate=candidateNodes2[candidateNodes2.length-1];this.root.setHighlightedNode(lastCandidate)}return}if(e.key===TAB){this.root.handleClose();return}if((e.key===ENTER||e.key===SPACE&&this.#domTypeahead.search==="")&&!e.isComposing&&(e.preventDefault(),this.#handleKeyboardSelection()))return;if(e.key===ARROW_UP&&e.altKey&&this.root.handleClose(),FIRST_LAST_KEYS. +includes(e.key)){e.preventDefault();const candidateNodes2=this.root.getCandidateNodes(),currHighlightedNode=this.root.highlightedNode,currIndex=currHighlightedNode?candidateNodes2.indexOf(currHighlightedNode):-1,loop2=this.root.opts.loop.current;let nextItem;if(e.key===ARROW_DOWN?nextItem=next(candidateNodes2,currIndex,loop2):e.key===ARROW_UP?nextItem=prev(candidateNodes2,currIndex,loop2):e.key===PAGE_DOWN?nextItem=forward(candidateNodes2,currIndex,10,loop2):e.key===PAGE_UP?nextItem=backward(candidateNodes2, +currIndex,10,loop2):e.key===HOME?nextItem=candidateNodes2[0]:e.key===END&&(nextItem=candidateNodes2[candidateNodes2.length-1]),!nextItem)return;this.root.setHighlightedNode(nextItem);return}const isModifierKey=e.ctrlKey||e.altKey||e.metaKey,isCharacterKey=e.key.length===1,isSpaceKey=e.key===SPACE,candidateNodes=this.root.getCandidateNodes();if(e.key!==TAB){if(!isModifierKey&&(isCharacterKey||isSpaceKey)){!this.#domTypeahead.handleTypeaheadSearch(e.key,candidateNodes)&&isSpaceKey&&(e.preventDefault(), +this.#handleKeyboardSelection());return}this.root.highlightedNode||this.root.setHighlightedToFirstCandidate()}}onclick(e){e.currentTarget.focus()}onpointerdown(e){if(this.root.opts.disabled.current)return;if(e.pointerType==="touch")return e.preventDefault();const target2=e.target;target2?.hasPointerCapture(e.pointerId)&&target2?.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&(this.root.opts.open.current===!1?this.#handlePointerOpen(e):this.root.handleClose())}onpointerup(e){this. +root.opts.disabled.current||(e.preventDefault(),e.pointerType==="touch"&&(this.root.opts.open.current===!1?this.#handlePointerOpen(e):this.root.handleClose()))}#props=user_derived(()=>({id:this.opts.id.current,disabled:this.root.opts.disabled.current?!0:void 0,"aria-haspopup":"listbox","aria-expanded":boolToStr(this.root.opts.open.current),"aria-activedescendant":this.root.highlightedId,"data-state":getDataOpenClosed(this.root.opts.open.current),"data-disabled":boolToEmptyStrOrUndef(this.root.opts. +disabled.current),"data-placeholder":this.root.hasValue?void 0:"",[this.root.getBitsAttr("trigger")]:"",onpointerdown:this.onpointerdown,onkeydown:this.onkeydown,onclick:this.onclick,onpointerup:this.onpointerup,...this.attachment}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}}class SelectContentState{static create(opts){return SelectContentContext.set(new SelectContentState(opts,SelectRootContext.get()))}opts;root;attachment;#isPositioned=state$1(!1);get isPositioned(){ +return get$3(this.#isPositioned)}set isPositioned(value){set$1(this.#isPositioned,value,!0)}domContext;constructor(opts,root2){this.opts=opts,this.root=root2,this.attachment=attachRef(opts.ref,v=>this.root.contentNode=v),this.domContext=new DOMContext(this.opts.ref),this.root.domContext===null&&(this.root.domContext=this.domContext),onDestroyEffect(()=>{this.root.contentNode=null,this.root.contentIsPositioned=!1,this.isPositioned=!1}),watch$1(()=>this.root.opts.open.current,()=>{this.root.opts.open. +current||(this.root.contentIsPositioned=!1,this.isPositioned=!1)}),watch$1([()=>this.isPositioned,()=>this.root.highlightedNode],()=>{!this.isPositioned||!this.root.highlightedNode||this.root.scrollHighlightedNodeIntoView(this.root.highlightedNode)}),this.onpointermove=this.onpointermove.bind(this)}onpointermove(_){this.root.isUsingKeyboard=!1}#styles=user_derived(()=>getFloatingContentCSSVars(this.root.isCombobox?"combobox":"select"));onInteractOutside=e=>{if(e.target===this.root.triggerNode||e. +target===this.root.inputNode){e.preventDefault();return}this.opts.onInteractOutside.current(e),!e.defaultPrevented&&this.root.handleClose()};onEscapeKeydown=e=>{this.opts.onEscapeKeydown.current(e),!e.defaultPrevented&&this.root.handleClose()};onOpenAutoFocus=e=>{e.preventDefault()};onCloseAutoFocus=e=>{e.preventDefault()};get shouldRender(){return this.root.contentPresence.shouldRender}#snippetProps=user_derived(()=>({open:this.root.opts.open.current}));get snippetProps(){return get$3(this.#snippetProps)}set snippetProps(value){ +set$1(this.#snippetProps,value)}#props=user_derived(()=>({id:this.opts.id.current,role:"listbox","aria-multiselectable":this.root.isMulti?"true":void 0,"data-state":getDataOpenClosed(this.root.opts.open.current),...getDataTransitionAttrs(this.root.contentPresence.transitionStatus),[this.root.getBitsAttr("content")]:"",style:{display:"flex",flexDirection:"column",outline:"none",boxSizing:"border-box",pointerEvents:"auto",...get$3(this.#styles)},onpointermove:this.onpointermove,...this.attachment}));get props(){ +return get$3(this.#props)}set props(value){set$1(this.#props,value)}popperProps={onInteractOutside:this.onInteractOutside,onEscapeKeydown:this.onEscapeKeydown,onOpenAutoFocus:this.onOpenAutoFocus,onCloseAutoFocus:this.onCloseAutoFocus,trapFocus:!1,loop:!1,onPlaced:()=>{this.root.opts.open.current&&(this.root.contentIsPositioned=!0,this.isPositioned=!0)}}}class SelectItemState{static create(opts){return new SelectItemState(opts,SelectRootContext.get())}opts;root;attachment;#isSelected=user_derived( +()=>this.root.includesItem(this.opts.value.current));get isSelected(){return get$3(this.#isSelected)}set isSelected(value){set$1(this.#isSelected,value)}#isHighlighted=user_derived(()=>this.root.highlightedValue===this.opts.value.current);get isHighlighted(){return get$3(this.#isHighlighted)}set isHighlighted(value){set$1(this.#isHighlighted,value)}prevHighlighted=new Previous(()=>this.isHighlighted);#mounted=state$1(!1);get mounted(){return get$3(this.#mounted)}set mounted(value){set$1(this.#mounted, +value,!0)}constructor(opts,root2){this.opts=opts,this.root=root2,this.attachment=attachRef(opts.ref),watch$1([()=>this.isHighlighted,()=>this.prevHighlighted.current],()=>{this.isHighlighted?this.opts.onHighlight.current():this.prevHighlighted.current&&this.opts.onUnhighlight.current()}),watch$1(()=>this.mounted,()=>{this.mounted&&this.root.setInitialHighlightedNode()}),this.onpointerdown=this.onpointerdown.bind(this),this.onpointerup=this.onpointerup.bind(this),this.onpointermove=this.onpointermove. +bind(this)}handleSelect(){if(this.opts.disabled.current)return;const isCurrentSelectedValue=this.opts.value.current===this.root.opts.value.current;if(!this.root.opts.allowDeselect.current&&isCurrentSelectedValue&&!this.root.isMulti){this.root.handleClose();return}this.root.toggleItem(this.opts.value.current,this.opts.label.current),!this.root.isMulti&&!isCurrentSelectedValue&&this.root.handleClose()}#snippetProps=user_derived(()=>({selected:this.isSelected,highlighted:this.isHighlighted}));get snippetProps(){ +return get$3(this.#snippetProps)}set snippetProps(value){set$1(this.#snippetProps,value)}onpointerdown(e){e.preventDefault()}onpointerup(e){if(!(e.defaultPrevented||!this.opts.ref.current)){if(e.pointerType==="touch"&&!isIOS){on(this.opts.ref.current,"click",()=>{this.handleSelect(),this.root.setHighlightedNode(this.opts.ref.current)},{once:!0});return}e.preventDefault(),this.handleSelect(),e.pointerType==="touch"&&this.root.setHighlightedNode(this.opts.ref.current)}}onpointermove(e){e.pointerType!== +"touch"&&this.root.highlightedNode!==this.opts.ref.current&&this.root.setHighlightedNode(this.opts.ref.current)}#props=user_derived(()=>({id:this.opts.id.current,role:"option","aria-selected":this.root.includesItem(this.opts.value.current)?"true":void 0,"data-value":this.opts.value.current,"data-disabled":boolToEmptyStrOrUndef(this.opts.disabled.current),"data-highlighted":this.root.highlightedValue===this.opts.value.current&&!this.opts.disabled.current?"":void 0,"data-selected":this.root.includesItem( +this.opts.value.current)?"":void 0,"data-label":this.opts.label.current,[this.root.getBitsAttr("item")]:"",onpointermove:this.onpointermove,onpointerdown:this.onpointerdown,onpointerup:this.onpointerup,...this.attachment}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}}class SelectHiddenInputState{static create(opts){return new SelectHiddenInputState(opts,SelectRootContext.get())}opts;root;#shouldRender=user_derived(()=>this.root.opts.name.current!=="");get shouldRender(){ +return get$3(this.#shouldRender)}set shouldRender(value){set$1(this.#shouldRender,value)}constructor(opts,root2){this.opts=opts,this.root=root2,this.onfocus=this.onfocus.bind(this)}onfocus(e){e.preventDefault(),this.root.isCombobox?this.root.inputNode?.focus():this.root.triggerNode?.focus()}#props=user_derived(()=>({disabled:boolToTrueOrUndef(this.root.opts.disabled.current),required:boolToTrueOrUndef(this.root.opts.required.current),name:this.root.opts.name.current,value:this.opts.value.current, +onfocus:this.onfocus}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}}class SelectViewportState{static create(opts){return new SelectViewportState(opts,SelectContentContext.get())}opts;content;root;attachment;#prevScrollTop=state$1(0);get prevScrollTop(){return get$3(this.#prevScrollTop)}set prevScrollTop(value){set$1(this.#prevScrollTop,value,!0)}constructor(opts,content2){this.opts=opts,this.content=content2,this.root=content2.root,this.attachment=attachRef(opts. +ref,v=>{this.root.viewportNode=v})}#props=user_derived(()=>({id:this.opts.id.current,role:"presentation",[this.root.getBitsAttr("viewport")]:"",style:{position:"relative",flex:1,overflow:"auto"},...this.attachment}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}}class SelectScrollButtonImplState{opts;content;root;attachment;autoScrollTimer=null;userScrollTimer=-1;isUserScrolling=!1;onAutoScroll=noop$1;#mounted=state$1(!1);get mounted(){return get$3(this.#mounted)}set mounted(value){ +set$1(this.#mounted,value,!0)}constructor(opts,content2){this.opts=opts,this.content=content2,this.root=content2.root,this.attachment=attachRef(opts.ref),watch$1([()=>this.mounted],()=>{if(!this.mounted){this.isUserScrolling=!1;return}this.isUserScrolling}),user_effect(()=>{this.mounted||this.clearAutoScrollInterval()}),this.onpointerdown=this.onpointerdown.bind(this),this.onpointermove=this.onpointermove.bind(this),this.onpointerleave=this.onpointerleave.bind(this)}handleUserScroll(){this.content. +domContext.clearTimeout(this.userScrollTimer),this.isUserScrolling=!0,this.userScrollTimer=this.content.domContext.setTimeout(()=>{this.isUserScrolling=!1},200)}clearAutoScrollInterval(){this.autoScrollTimer!==null&&(this.content.domContext.clearTimeout(this.autoScrollTimer),this.autoScrollTimer=null)}onpointerdown(_){if(this.autoScrollTimer!==null)return;const autoScroll=tick2=>{this.onAutoScroll(),this.autoScrollTimer=this.content.domContext.setTimeout(()=>autoScroll(tick2+1),this.opts.delay.current( +tick2))};this.autoScrollTimer=this.content.domContext.setTimeout(()=>autoScroll(1),this.opts.delay.current(0))}onpointermove(e){this.onpointerdown(e)}onpointerleave(_){this.clearAutoScrollInterval()}#props=user_derived(()=>({id:this.opts.id.current,"aria-hidden":boolToStrTrueOrUndef(!0),style:{flexShrink:0},onpointerdown:this.onpointerdown,onpointermove:this.onpointermove,onpointerleave:this.onpointerleave,...this.attachment}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props, +value)}}class SelectScrollDownButtonState{static create(opts){return new SelectScrollDownButtonState(new SelectScrollButtonImplState(opts,SelectContentContext.get()))}scrollButtonState;content;root;#canScrollDown=state$1(!1);get canScrollDown(){return get$3(this.#canScrollDown)}set canScrollDown(value){set$1(this.#canScrollDown,value,!0)}scrollIntoViewTimer=null;constructor(scrollButtonState){this.scrollButtonState=scrollButtonState,this.content=scrollButtonState.content,this.root=scrollButtonState. +root,this.scrollButtonState.onAutoScroll=this.handleAutoScroll,watch$1([()=>this.root.viewportNode,()=>this.content.isPositioned],()=>{if(!(!this.root.viewportNode||!this.content.isPositioned))return this.handleScroll(!0),on(this.root.viewportNode,"scroll",()=>this.handleScroll())}),watch$1([()=>this.root.opts.inputValue.current,()=>this.root.viewportNode,()=>this.content.isPositioned],()=>{!this.root.viewportNode||!this.content.isPositioned||this.handleScroll(!0)}),watch$1(()=>this.scrollButtonState. +mounted,()=>{this.scrollButtonState.mounted&&(this.scrollIntoViewTimer&&clearTimeout(this.scrollIntoViewTimer),this.scrollIntoViewTimer=afterSleep(5,()=>{const activeItem=this.root.highlightedNode;activeItem&&this.root.scrollHighlightedNodeIntoView(activeItem)}))})}handleScroll=(manual=!1)=>{if(manual||this.scrollButtonState.handleUserScroll(),!this.root.viewportNode)return;const maxScroll=this.root.viewportNode.scrollHeight-this.root.viewportNode.clientHeight,paddingTop=Number.parseInt(getComputedStyle( +this.root.viewportNode).paddingTop,10);this.canScrollDown=Math.ceil(this.root.viewportNode.scrollTop)<maxScroll-paddingTop};handleAutoScroll=()=>{const viewport=this.root.viewportNode,selectedItem=this.root.highlightedNode;!viewport||!selectedItem||(viewport.scrollTop=viewport.scrollTop+selectedItem.offsetHeight)};#props=user_derived(()=>({...this.scrollButtonState.props,[this.root.getBitsAttr("scroll-down-button")]:""}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}} +class SelectScrollUpButtonState{static create(opts){return new SelectScrollUpButtonState(new SelectScrollButtonImplState(opts,SelectContentContext.get()))}scrollButtonState;content;root;#canScrollUp=state$1(!1);get canScrollUp(){return get$3(this.#canScrollUp)}set canScrollUp(value){set$1(this.#canScrollUp,value,!0)}constructor(scrollButtonState){this.scrollButtonState=scrollButtonState,this.content=scrollButtonState.content,this.root=scrollButtonState.root,this.scrollButtonState.onAutoScroll=this. +handleAutoScroll,watch$1([()=>this.root.viewportNode,()=>this.content.isPositioned],()=>{if(!(!this.root.viewportNode||!this.content.isPositioned))return this.handleScroll(!0),on(this.root.viewportNode,"scroll",()=>this.handleScroll())})}handleScroll=(manual=!1)=>{if(manual||this.scrollButtonState.handleUserScroll(),!this.root.viewportNode)return;const paddingTop=Number.parseInt(getComputedStyle(this.root.viewportNode).paddingTop,10);this.canScrollUp=this.root.viewportNode.scrollTop-paddingTop>.1};handleAutoScroll=()=>{ +!this.root.viewportNode||!this.root.highlightedNode||(this.root.viewportNode.scrollTop=this.root.viewportNode.scrollTop-this.root.highlightedNode.offsetHeight)};#props=user_derived(()=>({...this.scrollButtonState.props,[this.root.getBitsAttr("scroll-up-button")]:""}));get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value)}}function Select_hidden_input($$anchor,$$props){push$1($$props,!0);let value=prop($$props,"value",15);const hiddenInputState=SelectHiddenInputState.create( +{value:boxWith$1(()=>value())});var fragment=comment$2(),node2=first_child(fragment);{var consequent=$$anchor2=>{Hidden_input($$anchor2,spread_props(()=>hiddenInputState.props,{get autocomplete(){return $$props.autocomplete},get value(){return value()},set value($$value){value($$value)}}))};if_block(node2,$$render=>{hiddenInputState.shouldRender&&$$render(consequent)})}append($$anchor,fragment),pop()}function Floating_layer_anchor($$anchor,$$props){push$1($$props,!0);let tooltip=prop($$props,"to\ +oltip",3,!1);FloatingAnchorState.create({id:boxWith$1(()=>$$props.id),virtualEl:boxWith$1(()=>$$props.virtualEl),ref:$$props.ref},tooltip());var fragment=comment$2(),node2=first_child(fragment);snippet(node2,()=>$$props.children??noop$3),append($$anchor,fragment),pop()}var root_4$K=from_svg('<svg viewBox="0 0 30 10" preserveAspectRatio="none" data-arrow=""><polygon points="0,0 30,0 15,10" fill="currentColor"></polygon></svg>'),root_2$1t=from_html("<span><!></span>");function Arrow($$anchor,$$props){ +push$1($$props,!0);let id2=prop($$props,"id",19,useId),width=prop($$props,"width",3,10),height=prop($$props,"height",3,5),restProps=rest_props($$props,["$$slots","$$events","$$legacy","id","children","child","width","height"]);const mergedProps=user_derived(()=>mergeProps(restProps,{id:id2()}));var fragment=comment$2(),node2=first_child(fragment);{var consequent=$$anchor2=>{var fragment_1=comment$2(),node_1=first_child(fragment_1);snippet(node_1,()=>$$props.child,()=>({props:get$3(mergedProps)})), +append($$anchor2,fragment_1)},alternate_1=$$anchor2=>{var span=root_2$1t();attribute_effect(span,()=>({...get$3(mergedProps)}));var node_2=child(span);{var consequent_1=$$anchor3=>{var fragment_2=comment$2(),node_3=first_child(fragment_2);snippet(node_3,()=>$$props.children??noop$3),append($$anchor3,fragment_2)},alternate=$$anchor3=>{var svg2=root_4$K();template_effect(()=>{set_attribute(svg2,"width",width()),set_attribute(svg2,"height",height())}),append($$anchor3,svg2)};if_block(node_2,$$render=>{ +$$props.children?$$render(consequent_1):$$render(alternate,-1)})}reset(span),append($$anchor2,span)};if_block(node2,$$render=>{$$props.child?$$render(consequent):$$render(alternate_1,-1)})}append($$anchor,fragment),pop()}function Floating_layer_arrow($$anchor,$$props){push$1($$props,!0);let id2=prop($$props,"id",19,useId),ref2=prop($$props,"ref",15,null),restProps=rest_props($$props,["$$slots","$$events","$$legacy","id","ref"]);const arrowState=FloatingArrowState.create({id:boxWith$1(()=>id2()), +ref:boxWith$1(()=>ref2(),v=>ref2(v))}),mergedProps=user_derived(()=>mergeProps(restProps,arrowState.props));Arrow($$anchor,spread_props(()=>get$3(mergedProps))),pop()}function Floating_layer_content($$anchor,$$props){push$1($$props,!0);let side=prop($$props,"side",3,"bottom"),sideOffset=prop($$props,"sideOffset",3,0),align=prop($$props,"align",3,"center"),alignOffset=prop($$props,"alignOffset",3,0),arrowPadding=prop($$props,"arrowPadding",3,0),avoidCollisions=prop($$props,"avoidCollisions",3,!0), +collisionBoundary=prop($$props,"collisionBoundary",19,()=>[]),collisionPadding=prop($$props,"collisionPadding",3,0),hideWhenDetached=prop($$props,"hideWhenDetached",3,!1),onPlaced=prop($$props,"onPlaced",3,()=>{}),sticky=prop($$props,"sticky",3,"partial"),updatePositionStrategy=prop($$props,"updatePositionStrategy",3,"optimized"),strategy=prop($$props,"strategy",3,"fixed"),dir=prop($$props,"dir",3,"ltr"),style2=prop($$props,"style",19,()=>({})),wrapperId=prop($$props,"wrapperId",19,useId),customAnchor=prop( +$$props,"customAnchor",3,null),tooltip=prop($$props,"tooltip",3,!1);const contentState=FloatingContentState.create({side:boxWith$1(()=>side()),sideOffset:boxWith$1(()=>sideOffset()),align:boxWith$1(()=>align()),alignOffset:boxWith$1(()=>alignOffset()),id:boxWith$1(()=>$$props.id),arrowPadding:boxWith$1(()=>arrowPadding()),avoidCollisions:boxWith$1(()=>avoidCollisions()),collisionBoundary:boxWith$1(()=>collisionBoundary()),collisionPadding:boxWith$1(()=>collisionPadding()),hideWhenDetached:boxWith$1( +()=>hideWhenDetached()),onPlaced:boxWith$1(()=>onPlaced()),sticky:boxWith$1(()=>sticky()),updatePositionStrategy:boxWith$1(()=>updatePositionStrategy()),strategy:boxWith$1(()=>strategy()),dir:boxWith$1(()=>dir()),style:boxWith$1(()=>style2()),enabled:boxWith$1(()=>$$props.enabled),wrapperId:boxWith$1(()=>wrapperId()),customAnchor:boxWith$1(()=>customAnchor())},tooltip()),mergedProps=user_derived(()=>mergeProps(contentState.wrapperProps,{style:{pointerEvents:"auto"}}));var fragment=comment$2(),node2=first_child( +fragment);snippet(node2,()=>$$props.content??noop$3,()=>({props:contentState.props,wrapperProps:get$3(mergedProps)})),append($$anchor,fragment),pop()}function Floating_layer_content_static($$anchor,$$props){push$1($$props,!0),onMount$1(()=>{$$props.onPlaced?.()});var fragment=comment$2(),node2=first_child(fragment);snippet(node2,()=>$$props.content??noop$3,()=>({props:{},wrapperProps:{}})),append($$anchor,fragment),pop()}function Popper_content($$anchor,$$props){let isStatic=prop($$props,"isStat\ +ic",3,!1),restProps=rest_props($$props,["$$slots","$$events","$$legacy","content","isStatic","onPlaced"]);var fragment=comment$2(),node2=first_child(fragment);{var consequent=$$anchor2=>{Floating_layer_content_static($$anchor2,{get content(){return $$props.content},get onPlaced(){return $$props.onPlaced}})},alternate=$$anchor2=>{Floating_layer_content($$anchor2,spread_props({get content(){return $$props.content},get onPlaced(){return $$props.onPlaced}},()=>restProps))};if_block(node2,$$render=>{ +isStatic()?$$render(consequent):$$render(alternate,-1)})}append($$anchor,fragment)}var root_1$19=from_html("<!> <!>",1);function Popper_layer_inner($$anchor,$$props){push$1($$props,!0);let interactOutsideBehavior=prop($$props,"interactOutsideBehavior",3,"close"),trapFocus=prop($$props,"trapFocus",3,!0),isValidEvent2=prop($$props,"isValidEvent",3,()=>!1),customAnchor=prop($$props,"customAnchor",3,null),isStatic=prop($$props,"isStatic",3,!1),tooltip=prop($$props,"tooltip",3,!1),contentPointerEvents=prop( +$$props,"contentPointerEvents",3,"auto"),restProps=rest_props($$props,["$$slots","$$events","$$legacy","popper","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAut\ +oFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","isStatic","enabled","ref","tooltip","contentPointerEvents"]);const resolvedPreventScroll=user_derived(()=>$$props.preventScroll??!0),effectiveStrategy=user_derived(()=>$$props.strategy??(get$3(resolvedPreventScroll)?"fixed":"absolute"));Popper_content($$anchor,{get isStatic(){return isStatic()},get id(){return $$props.id},get side(){return $$props.side},get sideOffset(){return $$props.sideOffset}, +get align(){return $$props.align},get alignOffset(){return $$props.alignOffset},get arrowPadding(){return $$props.arrowPadding},get avoidCollisions(){return $$props.avoidCollisions},get collisionBoundary(){return $$props.collisionBoundary},get collisionPadding(){return $$props.collisionPadding},get sticky(){return $$props.sticky},get hideWhenDetached(){return $$props.hideWhenDetached},get updatePositionStrategy(){return $$props.updatePositionStrategy},get strategy(){return get$3(effectiveStrategy)}, +get dir(){return $$props.dir},get wrapperId(){return $$props.wrapperId},get style(){return $$props.style},get onPlaced(){return $$props.onPlaced},get customAnchor(){return customAnchor()},get enabled(){return $$props.enabled},get tooltip(){return tooltip()},content:($$anchor2,$$arg0)=>{let floatingProps=()=>$$arg0?.().props,wrapperProps=()=>$$arg0?.().wrapperProps;var fragment_1=root_1$19(),node2=first_child(fragment_1);{var consequent=$$anchor3=>{Scroll_lock($$anchor3,{get preventScroll(){return get$3( +resolvedPreventScroll)}})},consequent_1=$$anchor3=>{Scroll_lock($$anchor3,{get preventScroll(){return get$3(resolvedPreventScroll)}})};if_block(node2,$$render=>{$$props.forceMount&&$$props.enabled?$$render(consequent):$$props.forceMount||$$render(consequent_1,1)})}var node_1=sibling(node2,2);Focus_scope(node_1,{get onOpenAutoFocus(){return $$props.onOpenAutoFocus},get onCloseAutoFocus(){return $$props.onCloseAutoFocus},get loop(){return $$props.loop},get enabled(){return $$props.enabled},get trapFocus(){ +return trapFocus()},get forceMount(){return $$props.forceMount},get ref(){return $$props.ref},focusScope:($$anchor3,$$arg02)=>{let focusScopeProps=()=>$$arg02?.().props;Escape_layer($$anchor3,{get onEscapeKeydown(){return $$props.onEscapeKeydown},get escapeKeydownBehavior(){return $$props.escapeKeydownBehavior},get enabled(){return $$props.enabled},get ref(){return $$props.ref},children:($$anchor4,$$slotProps)=>{Dismissible_layer($$anchor4,{get id(){return $$props.id},get onInteractOutside(){return $$props. +onInteractOutside},get onFocusOutside(){return $$props.onFocusOutside},get interactOutsideBehavior(){return interactOutsideBehavior()},get isValidEvent(){return isValidEvent2()},get enabled(){return $$props.enabled},get ref(){return $$props.ref},children:($$anchor5,$$arg03)=>{let dismissibleProps=()=>$$arg03?.().props;Text_selection_layer($$anchor5,{get id(){return $$props.id},get preventOverflowTextSelection(){return $$props.preventOverflowTextSelection},get onPointerDown(){return $$props.onPointerDown}, +get onPointerUp(){return $$props.onPointerUp},get enabled(){return $$props.enabled},get ref(){return $$props.ref},children:($$anchor6,$$slotProps2)=>{var fragment_7=comment$2(),node_2=first_child(fragment_7);{let $0=user_derived(()=>({props:mergeProps(restProps,floatingProps(),dismissibleProps(),focusScopeProps(),{style:{pointerEvents:contentPointerEvents()}}),wrapperProps:wrapperProps()}));snippet(node_2,()=>$$props.popper??noop$3,()=>get$3($0))}append($$anchor6,fragment_7)},$$slots:{default:!0}})}, +$$slots:{default:!0}})},$$slots:{default:!0}})},$$slots:{focusScope:!0}}),append($$anchor2,fragment_1)},$$slots:{content:!0}}),pop()}function Popper_layer($$anchor,$$props){let interactOutsideBehavior=prop($$props,"interactOutsideBehavior",3,"close"),trapFocus=prop($$props,"trapFocus",3,!0),isValidEvent2=prop($$props,"isValidEvent",3,()=>!1),customAnchor=prop($$props,"customAnchor",3,null),isStatic=prop($$props,"isStatic",3,!1),restProps=rest_props($$props,["$$slots","$$events","$$legacy","poppe\ +r","open","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary","collisionPadding","sticky","hideWhenDetached","updatePositionStrategy","strategy","dir","preventScroll","wrapperId","style","onPlaced","onInteractOutside","onCloseAutoFocus","onOpenAutoFocus","onFocusOutside","interactOutsideBehavior","loop","trapFocus","isValidEvent","customAnchor","i\ +sStatic","ref","shouldRender"]);var fragment=comment$2(),node2=first_child(fragment);{var consequent=$$anchor2=>{Popper_layer_inner($$anchor2,spread_props({get popper(){return $$props.popper},get onEscapeKeydown(){return $$props.onEscapeKeydown},get escapeKeydownBehavior(){return $$props.escapeKeydownBehavior},get preventOverflowTextSelection(){return $$props.preventOverflowTextSelection},get id(){return $$props.id},get onPointerDown(){return $$props.onPointerDown},get onPointerUp(){return $$props. +onPointerUp},get side(){return $$props.side},get sideOffset(){return $$props.sideOffset},get align(){return $$props.align},get alignOffset(){return $$props.alignOffset},get arrowPadding(){return $$props.arrowPadding},get avoidCollisions(){return $$props.avoidCollisions},get collisionBoundary(){return $$props.collisionBoundary},get collisionPadding(){return $$props.collisionPadding},get sticky(){return $$props.sticky},get hideWhenDetached(){return $$props.hideWhenDetached},get updatePositionStrategy(){ return $$props.updatePositionStrategy},get strategy(){return $$props.strategy},get dir(){return $$props.dir},get preventScroll(){return $$props.preventScroll},get wrapperId(){return $$props.wrapperId},get style(){return $$props.style},get onPlaced(){return $$props.onPlaced},get customAnchor(){return customAnchor()},get isStatic(){return isStatic()},get enabled(){return $$props.open},get onInteractOutside(){return $$props.onInteractOutside},get onCloseAutoFocus(){return $$props.onCloseAutoFocus}, get onOpenAutoFocus(){return $$props.onOpenAutoFocus},get interactOutsideBehavior(){return interactOutsideBehavior()},get loop(){return $$props.loop},get trapFocus(){return trapFocus()},get isValidEvent(){return isValidEvent2()},get onFocusOutside(){return $$props.onFocusOutside},forceMount:!1,get ref(){return $$props.ref}},()=>restProps))};if_block(node2,$$render=>{$$props.shouldRender&&$$render(consequent)})}append($$anchor,fragment)}function Popper_layer_force_mount($$anchor,$$props){let interactOutsideBehavior=prop( $$props,"interactOutsideBehavior",3,"close"),trapFocus=prop($$props,"trapFocus",3,!0),isValidEvent2=prop($$props,"isValidEvent",3,()=>!1),customAnchor=prop($$props,"customAnchor",3,null),isStatic=prop($$props,"isStatic",3,!1),restProps=rest_props($$props,["$$slots","$$events","$$legacy","popper","onEscapeKeydown","escapeKeydownBehavior","preventOverflowTextSelection","id","onPointerDown","onPointerUp","side","sideOffset","align","alignOffset","arrowPadding","avoidCollisions","collisionBoundary", @@ -1324,120 +1325,121 @@ Disable automatic scrolling while messages stream so you can control the viewpor ient settings section to edit.",mcpServerUsageStats:"Usage statistics for MCP servers. Tracks how many times tools from each server have been used.",agenticMaxTurns:"Maximum number of tool execution cycles before stopping (prevents infinite loops).",agenticMaxToolPreviewLines:"Number of lines shown in tool output previews (last N lines). Only these previews and the final LLM response persist after the agentic loop completes.",showToolCallInProgress:"Automatically expand tool call details while e\ xecuting and keep them expanded after completion.",pyInterpreterEnabled:"Enable Python interpreter using Pyodide. Allows running Python code in markdown code blocks.",preEncodeConversation:"After each response, re-submit the conversation to pre-fill the server KV cache. Makes the next turn faster since the prompt is already encoded while you read the response.",enableContinueGeneration:'Enable "Continue" button for assistant messages. Currently works only with non-reasoning models.'},SETTINGS_COLOR_MODES_CONFIG=[ {value:ColorMode.SYSTEM,label:"System",icon:Monitor},{value:ColorMode.LIGHT,label:"Light",icon:Sun},{value:ColorMode.DARK,label:"Dark",icon:Moon}],NUMERIC_FIELDS=["temperature","top_k","top_p","min_p","max_tokens","pasteLongTextToFileLen","dynatemp_range","dynatemp_exponent","typ_p","xtc_probability","xtc_threshold","repeat_last_n","repeat_penalty","presence_penalty","frequency_penalty","dry_multiplier","dry_base","dry_allowed_length","dry_penalty_last_n","agenticMaxTurns","agenticMaxToolPreview\ -Lines"],POSITIVE_INTEGER_FIELDS=["agenticMaxTurns","agenticMaxToolPreviewLines"],SETTINGS_KEYS={THEME:"theme",API_KEY:"apiKey",SYSTEM_MESSAGE:"systemMessage",PASTE_LONG_TEXT_TO_FILE_LEN:"pasteLongTextToFileLen",COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT:"copyTextAttachmentsAsPlainText",ENABLE_CONTINUE_GENERATION:"enableContinueGeneration",PDF_AS_IMAGE:"pdfAsImage",ASK_FOR_TITLE_CONFIRMATION:"askForTitleConfirmation",SHOW_MESSAGE_STATS:"showMessageStats",SHOW_THOUGHT_IN_PROGRESS:"showThoughtInProgress", -KEEP_STATS_VISIBLE:"keepStatsVisible",AUTO_MIC_ON_EMPTY:"autoMicOnEmpty",RENDER_USER_CONTENT_AS_MARKDOWN:"renderUserContentAsMarkdown",DISABLE_AUTO_SCROLL:"disableAutoScroll",ALWAYS_SHOW_SIDEBAR_ON_DESKTOP:"alwaysShowSidebarOnDesktop",FULL_HEIGHT_CODE_BLOCKS:"fullHeightCodeBlocks",SHOW_RAW_MODEL_NAMES:"showRawModelNames",TEMPERATURE:"temperature",DYNATEMP_RANGE:"dynatemp_range",DYNATEMP_EXPONENT:"dynatemp_exponent",TOP_K:"top_k",TOP_P:"top_p",MIN_P:"min_p",XTC_PROBABILITY:"xtc_probability",XTC_THRESHOLD:"\ -xtc_threshold",TYP_P:"typ_p",MAX_TOKENS:"max_tokens",SAMPLERS:"samplers",BACKEND_SAMPLING:"backend_sampling",REPEAT_LAST_N:"repeat_last_n",REPEAT_PENALTY:"repeat_penalty",PRESENCE_PENALTY:"presence_penalty",FREQUENCY_PENALTY:"frequency_penalty",DRY_MULTIPLIER:"dry_multiplier",DRY_BASE:"dry_base",DRY_ALLOWED_LENGTH:"dry_allowed_length",DRY_PENALTY_LAST_N:"dry_penalty_last_n",AGENTIC_MAX_TURNS:"agenticMaxTurns",ALWAYS_SHOW_AGENTIC_TURNS:"alwaysShowAgenticTurns",AGENTIC_MAX_TOOL_PREVIEW_LINES:"agen\ -ticMaxToolPreviewLines",SHOW_TOOL_CALL_IN_PROGRESS:"showToolCallInProgress",DISABLE_REASONING_PARSING:"disableReasoningParsing",EXCLUDE_REASONING_FROM_CONTEXT:"excludeReasoningFromContext",SHOW_RAW_OUTPUT_SWITCH:"showRawOutputSwitch",CUSTOM:"custom"},SETTINGS_SECTION_TITLES={GENERAL:"General",DISPLAY:"Display",SAMPLING:"Sampling",PENALTIES:"Penalties",AGENTIC:"Agentic",TOOLS:"Tools",IMPORT_EXPORT:"Import/Export",DEVELOPER:"Developer"},SETTINGS_CHAT_SECTIONS=[{title:SETTINGS_SECTION_TITLES.GENERAL, -slug:"general",icon:Sliders_vertical,fields:[{key:SETTINGS_KEYS.THEME,label:"Theme",type:SettingsFieldType.SELECT,options:SETTINGS_COLOR_MODES_CONFIG},{key:SETTINGS_KEYS.API_KEY,label:"API Key",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.SYSTEM_MESSAGE,label:"System Message",type:SettingsFieldType.TEXTAREA},{key:SETTINGS_KEYS.PASTE_LONG_TEXT_TO_FILE_LEN,label:"Paste long text to file length",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT,label:"Copy tex\ -t attachments as plain text",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.ENABLE_CONTINUE_GENERATION,label:'Enable "Continue" button',type:SettingsFieldType.CHECKBOX,isExperimental:!0},{key:SETTINGS_KEYS.PDF_AS_IMAGE,label:"Parse PDF as image",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.ASK_FOR_TITLE_CONFIRMATION,label:"Ask for confirmation before changing conversation title",type:SettingsFieldType.CHECKBOX}]},{title:SETTINGS_SECTION_TITLES.DISPLAY,slug:"display",icon:Monitor,fields:[ -{key:SETTINGS_KEYS.SHOW_MESSAGE_STATS,label:"Show message generation statistics",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.SHOW_THOUGHT_IN_PROGRESS,label:"Show thought in progress",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.SHOW_TOOL_CALL_IN_PROGRESS,label:"Show tool call in progress",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.KEEP_STATS_VISIBLE,label:"Keep stats visible after generation",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.AUTO_MIC_ON_EMPTY,label:"Sho\ -w microphone on empty input",type:SettingsFieldType.CHECKBOX,isExperimental:!0},{key:SETTINGS_KEYS.RENDER_USER_CONTENT_AS_MARKDOWN,label:"Render user content as Markdown",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.FULL_HEIGHT_CODE_BLOCKS,label:"Use full height code blocks",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.DISABLE_AUTO_SCROLL,label:"Disable automatic scroll",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.ALWAYS_SHOW_SIDEBAR_ON_DESKTOP,label:"Always show sidebar on\ - desktop",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.SHOW_RAW_MODEL_NAMES,label:"Show raw model names",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.ALWAYS_SHOW_AGENTIC_TURNS,label:"Always show agentic turns in conversation",type:SettingsFieldType.CHECKBOX}]},{title:SETTINGS_SECTION_TITLES.SAMPLING,slug:"sampling",icon:Funnel,fields:[{key:SETTINGS_KEYS.TEMPERATURE,label:"Temperature",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DYNATEMP_RANGE,label:"Dynamic temperature range", -type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DYNATEMP_EXPONENT,label:"Dynamic temperature exponent",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.TOP_K,label:"Top K",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.TOP_P,label:"Top P",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.MIN_P,label:"Min P",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.XTC_PROBABILITY,label:"XTC probability",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.XTC_THRESHOLD,label:"XTC threshold",type:SettingsFieldType. -INPUT},{key:SETTINGS_KEYS.TYP_P,label:"Typical P",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.MAX_TOKENS,label:"Max tokens",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.SAMPLERS,label:"Samplers",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.BACKEND_SAMPLING,label:"Backend sampling",type:SettingsFieldType.CHECKBOX}]},{title:SETTINGS_SECTION_TITLES.PENALTIES,slug:"penalties",icon:Triangle_alert,fields:[{key:SETTINGS_KEYS.REPEAT_LAST_N,label:"Repeat last N",type:SettingsFieldType.INPUT}, -{key:SETTINGS_KEYS.REPEAT_PENALTY,label:"Repeat penalty",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.PRESENCE_PENALTY,label:"Presence penalty",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.FREQUENCY_PENALTY,label:"Frequency penalty",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DRY_MULTIPLIER,label:"DRY multiplier",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DRY_BASE,label:"DRY base",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DRY_ALLOWED_LENGTH,label:"DRY allowed length",type:SettingsFieldType. -INPUT},{key:SETTINGS_KEYS.DRY_PENALTY_LAST_N,label:"DRY penalty last N",type:SettingsFieldType.INPUT}]},{title:SETTINGS_SECTION_TITLES.AGENTIC,slug:"agentic",icon:List_restart,fields:[{key:SETTINGS_KEYS.AGENTIC_MAX_TURNS,label:"Agentic turns",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.AGENTIC_MAX_TOOL_PREVIEW_LINES,label:"Max lines per tool preview",type:SettingsFieldType.INPUT}]},{title:SETTINGS_SECTION_TITLES.TOOLS,slug:"tools",icon:Pencil_ruler},{title:SETTINGS_SECTION_TITLES.IMPORT_EXPORT, -slug:"import-export",icon:Database},{title:SETTINGS_SECTION_TITLES.DEVELOPER,slug:"developer",icon:Code,fields:[{key:SETTINGS_KEYS.DISABLE_REASONING_PARSING,label:"Disable reasoning content parsing",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.EXCLUDE_REASONING_FROM_CONTEXT,label:"Exclude reasoning from context",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.SHOW_RAW_OUTPUT_SWITCH,label:"Enable raw output toggle",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.CUSTOM,label:"Custo\ -m JSON",type:SettingsFieldType.TEXTAREA}]}];FileTypeAudio.MP3+"",FileExtensionAudio.MP3,MimeTypeAudio.MP3_MPEG,MimeTypeAudio.MP3,FileTypeAudio.WAV+"",FileExtensionAudio.WAV,MimeTypeAudio.WAV;FileTypeImage.JPEG+"",FileExtensionImage.JPG,FileExtensionImage.JPEG,MimeTypeImage.JPEG,FileTypeImage.PNG+"",FileExtensionImage.PNG,MimeTypeImage.PNG,FileTypeImage.GIF+"",FileExtensionImage.GIF,MimeTypeImage.GIF,FileTypeImage.WEBP+"",FileExtensionImage.WEBP,MimeTypeImage.WEBP,FileTypeImage.SVG+"",FileExtensionImage. -SVG,MimeTypeImage.SVG;FileTypePdf.PDF+"",FileExtensionPdf.PDF,MimeTypeApplication.PDF;FileTypeText.PLAIN_TEXT+"",FileExtensionText.TXT,MimeTypeText.PLAIN,FileTypeText.MARKDOWN+"",FileExtensionText.MD,MimeTypeText.MARKDOWN,FileTypeText.ASCIIDOC+"",FileExtensionText.ADOC,MimeTypeText.ASCIIDOC,FileTypeText.JAVASCRIPT+"",FileExtensionText.JS,MimeTypeText.JAVASCRIPT,MimeTypeText.JAVASCRIPT_APP,FileTypeText.TYPESCRIPT+"",FileExtensionText.TS,MimeTypeText.TYPESCRIPT,FileTypeText.JSX+"",FileExtensionText. -JSX,MimeTypeText.JSX,FileTypeText.TSX+"",FileExtensionText.TSX,MimeTypeText.TSX,FileTypeText.CSS+"",FileExtensionText.CSS,MimeTypeText.CSS,FileTypeText.HTML+"",FileExtensionText.HTML,FileExtensionText.HTM,MimeTypeText.HTML,FileTypeText.JSON+"",FileExtensionText.JSON,MimeTypeText.JSON,FileTypeText.XML+"",FileExtensionText.XML,MimeTypeText.XML_TEXT,MimeTypeText.XML_APP,FileTypeText.YAML+"",FileExtensionText.YAML,FileExtensionText.YML,MimeTypeText.YAML_TEXT,MimeTypeText.YAML_APP,FileTypeText.CSV+"", -FileExtensionText.CSV,MimeTypeText.CSV,FileTypeText.LOG+"",FileExtensionText.LOG,MimeTypeText.PLAIN,FileTypeText.PYTHON+"",FileExtensionText.PY,MimeTypeText.PYTHON,FileTypeText.JAVA+"",FileExtensionText.JAVA,MimeTypeText.JAVA,FileTypeText.CPP+"",FileExtensionText.CPP,FileExtensionText.C,FileExtensionText.H,FileExtensionText.HPP,MimeTypeText.CPP_SRC,MimeTypeText.CPP_HDR,MimeTypeText.C_SRC,MimeTypeText.C_HDR,FileTypeText.PHP+"",FileExtensionText.PHP,MimeTypeText.PHP,FileTypeText.RUBY+"",FileExtensionText. -RB,MimeTypeText.RUBY,FileTypeText.GO+"",FileExtensionText.GO,MimeTypeText.GO,FileTypeText.RUST+"",FileExtensionText.RS,MimeTypeText.RUST,FileTypeText.SHELL+"",FileExtensionText.SH,FileExtensionText.BAT,MimeTypeText.SHELL,MimeTypeText.BAT,FileTypeText.SQL+"",FileExtensionText.SQL,MimeTypeText.SQL,FileTypeText.R+"",FileExtensionText.R,MimeTypeText.R,FileTypeText.SCALA+"",FileExtensionText.SCALA,MimeTypeText.SCALA,FileTypeText.KOTLIN+"",FileExtensionText.KT,MimeTypeText.KOTLIN,FileTypeText.SWIFT+"", -FileExtensionText.SWIFT,MimeTypeText.SWIFT,FileTypeText.DART+"",FileExtensionText.DART,MimeTypeText.DART,FileTypeText.VUE+"",FileExtensionText.VUE,MimeTypeText.VUE,FileTypeText.SVELTE+"",FileExtensionText.SVELTE,MimeTypeText.SVELTE,FileTypeText.LATEX+"",FileExtensionText.TEX,MimeTypeText.LATEX,MimeTypeText.TEX,MimeTypeText.TEX_APP,FileTypeText.BIBTEX+"",FileExtensionText.BIB,MimeTypeText.BIBTEX,FileTypeText.CUDA+"",FileExtensionText.CU,FileExtensionText.CUH,MimeTypeText.CUDA,FileTypeText.VULKAN+ -"",FileExtensionText.COMP,MimeTypeText.PLAIN,FileTypeText.HASKELL+"",FileExtensionText.HS,MimeTypeText.HASKELL,FileTypeText.CSHARP+"",FileExtensionText.CS,MimeTypeText.CSHARP,FileTypeText.PROPERTIES+"",FileExtensionText.PROPERTIES,MimeTypeText.PROPERTIES;const BR_PATTERN=/<br\s*\/?\s*>/gi,LIST_PATTERN=/^<ul>([\s\S]*)<\/ul>$/i,LI_PATTERN=/<li>([\s\S]*?)<\/li>/gi,TOOL_GROUP_LABELS={[ToolSource.BUILTIN]:"Built-in",[ToolSource.CUSTOM]:"JSON Schema"},TOOL_SERVER_LABELS={[ToolSource.BUILTIN]:"Built-in\ - Tools",[ToolSource.CUSTOM]:"Custom Tools"},TOOLTIP_DELAY_DURATION=500;var root$1R=from_svg('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 174 174" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1"><g id="shape-320b5b95-d08d-8089-8007-585a8e498184"><defs><clipPath id="frame-clip-320b5b95-d08d-8089-8007-585a8e498184-render-1" class="frame-clip frame-clip-def"><rect rx="0" ry="0" x="0" y="0" width="174.00000000000045" height="174" transform="matrix(1.000000, 0.000000, 0.0\ -00000, 1.000000, 0.000000, 0.000000)"></rect></clipPath></defs><g class="frame-container-wrapper"><g class="frame-container-blur"><g class="frame-container-shadows"><g clip-path="url(#frame-clip-320b5b95-d08d-8089-8007-585a8e498184-render-1)" fill="none"><g class="fills" id="fills-320b5b95-d08d-8089-8007-585a8e498184"><rect rx="0" ry="0" x="0" y="0" width="174.00000000000045" height="174" transform="matrix(1.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000)" class="frame-background"></re\ -ct></g><g class="frame-children"><g id="shape-320b5b95-d08d-8089-8007-585a974337b1"><g class="fills" id="fills-320b5b95-d08d-8089-8007-585a974337b1"><path d="M15.5587158203125,81.5927734375L83.44091796875,13.7105712890625C92.813720703125,4.3380126953125,108.0096435546875,4.3380126953125,117.3817138671875,13.7105712890625L117.3817138671875,13.7105712890625C126.7547607421875,23.08306884765625,126.7547607421875,38.27911376953125,117.3817138671875,47.65167236328125L66.1168212890625,98.9169921875" fi\ -ll="none" stroke-linecap="round" style="fill: none;"></path></g><g fill="none" stroke-linecap="round" id="strokes-b954dcef-3e3e-8015-8007-585acd4382b6-320b5b95-d08d-8089-8007-585a974337b1" class="strokes"><g class="stroke-shape"><path d="M15.5587158203125,81.5927734375L83.44091796875,13.7105712890625C92.813720703125,4.3380126953125,108.0096435546875,4.3380126953125,117.3817138671875,13.7105712890625L117.3817138671875,13.7105712890625C126.7547607421875,23.08306884765625,126.7547607421875,38.27911\ -376953125,117.3817138671875,47.65167236328125L66.1168212890625,98.9169921875" style="fill: none; stroke-width: 12; stroke: currentColor; stroke-opacity: 1;"></path></g></g></g><g id="shape-320b5b95-d08d-8089-8007-585a974337b2"><g class="fills" id="fills-320b5b95-d08d-8089-8007-585a974337b2"><path d="M66.5587158203125,98.26885986328125L117.1165771484375,47.7105712890625C126.489501953125,38.3380126953125,141.6854248046875,38.3380126953125,151.0584716796875,47.7105712890625L151.4114990234375,48.064\ -0869140625C160.7845458984375,57.43670654296875,160.7845458984375,72.6326904296875,151.4114990234375,82.00518798828125L90.018310546875,143.39886474609375C86.8941650390625,146.52288818359375,86.8941650390625,151.587890625,90.018310546875,154.71185302734375L102.62451171875,167.31890869140625" fill="none" stroke-linecap="round" style="fill: none;"></path></g><g fill="none" stroke-linecap="round" id="strokes-b954dcef-3e3e-8015-8007-585acd447743-320b5b95-d08d-8089-8007-585a974337b2" class="strokes"><g\ - class="stroke-shape"><path d="M66.5587158203125,98.26885986328125L117.1165771484375,47.7105712890625C126.489501953125,38.3380126953125,141.6854248046875,38.3380126953125,151.0584716796875,47.7105712890625L151.4114990234375,48.0640869140625C160.7845458984375,57.43670654296875,160.7845458984375,72.6326904296875,151.4114990234375,82.00518798828125L90.018310546875,143.39886474609375C86.8941650390625,146.52288818359375,86.8941650390625,151.587890625,90.018310546875,154.71185302734375L102.62451171875\ -,167.31890869140625" style="fill: none; stroke-width: 12; stroke: currentColor; stroke-opacity: 1;"></path></g></g></g><g id="shape-320b5b95-d08d-8089-8007-585a974337b3"><g class="fills" id="fills-320b5b95-d08d-8089-8007-585a974337b3"><path d="M99.79296875,30.68115234375L49.588134765625,80.8857421875C40.215576171875,90.258056640625,40.215576171875,105.45404052734375,49.588134765625,114.82708740234375L49.588134765625,114.82708740234375C58.9608154296875,124.19903564453125,74.1566162109375,124.1990\ -3564453125,83.529296875,114.82708740234375L133.7340087890625,64.62225341796875" fill="none" stroke-linecap="round" style="fill: none;"></path></g><g fill="none" stroke-linecap="round" id="strokes-b954dcef-3e3e-8015-8007-585acd44c5c9-320b5b95-d08d-8089-8007-585a974337b3" class="strokes"><g class="stroke-shape"><path d="M99.79296875,30.68115234375L49.588134765625,80.8857421875C40.215576171875,90.258056640625,40.215576171875,105.45404052734375,49.588134765625,114.82708740234375L49.588134765625,114.\ -82708740234375C58.9608154296875,124.19903564453125,74.1566162109375,124.19903564453125,83.529296875,114.82708740234375L133.7340087890625,64.62225341796875" style="fill: none; stroke-width: 12; stroke: currentColor; stroke-opacity: 1;"></path></g></g></g></g></g></g></g></g></g></svg>');function McpLogo($$anchor,$$props){let className=prop($$props,"class",3,""),style2=prop($$props,"style",3,"");var svg2=root$1R();template_effect(()=>{set_class(svg2,0,clsx(className())),set_style(svg2,style2())}), -append($$anchor,svg2)}const FORK_TREE_DEPTH_PADDING=8,SYSTEM_MESSAGE_PLACEHOLDER="System message",APP_NAME="llama.cpp",ICON_STRIP_TRANSITION_DURATION=150,ICON_STRIP_TRANSITION_DELAY_MULTIPLIER=50,SIDEBAR_ACTIONS_ITEMS=[{icon:Square_pen,tooltip:"New chat",route:"?new_chat=true#/",keys:["shift","cmd","o"]},{icon:Search,tooltip:"Search",keys:["cmd","k"]},{icon:McpLogo,tooltip:"MCP Servers",route:"#/settings/mcp",activeRouteId:"/settings/mcp"},{icon:Settings$1,tooltip:"Settings",route:"#/settings/ch\ -at/general",activeRoutePrefix:"/settings/chat"}],URI_SCHEME_SEPARATOR="://",TEMPLATE_EXPRESSION_REGEX=/\{([+#./;?&]?)([^}]+)\}/g,URI_TEMPLATE_OPERATORS={RESERVED:"+",FRAGMENT:"#",PATH_SEGMENT:"/",LABEL:".",PATH_PARAM:";",FORM_QUERY:"?",FORM_CONTINUATION:"&"},URI_TEMPLATE_SEPARATORS={COMMA:",",SLASH:"/",PERIOD:".",SEMICOLON:";",QUERY_PREFIX:"?",QUERY_CONTINUATION:"&"},VARIABLE_EXPLODE_MODIFIER_REGEX=/[*]$/,VARIABLE_PREFIX_MODIFIER_REGEX=/:[\d]+$/,LEADING_SLASHES_REGEX=/^\/+/,DEFAULT_MOBILE_BREAKPOINT=768; -class IsMobile extends MediaQuery{constructor(breakpoint=DEFAULT_MOBILE_BREAKPOINT){super(`max-width: ${breakpoint-1}px`)}}const SYNCABLE_PARAMETERS=[{key:"temperature",serverKey:"temperature",type:SyncableParameterType.NUMBER,canSync:!0},{key:"top_k",serverKey:"top_k",type:SyncableParameterType.NUMBER,canSync:!0},{key:"top_p",serverKey:"top_p",type:SyncableParameterType.NUMBER,canSync:!0},{key:"min_p",serverKey:"min_p",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dynatemp_range",serverKey:"\ -dynatemp_range",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dynatemp_exponent",serverKey:"dynatemp_exponent",type:SyncableParameterType.NUMBER,canSync:!0},{key:"xtc_probability",serverKey:"xtc_probability",type:SyncableParameterType.NUMBER,canSync:!0},{key:"xtc_threshold",serverKey:"xtc_threshold",type:SyncableParameterType.NUMBER,canSync:!0},{key:"typ_p",serverKey:"typ_p",type:SyncableParameterType.NUMBER,canSync:!0},{key:"repeat_last_n",serverKey:"repeat_last_n",type:SyncableParameterType. -NUMBER,canSync:!0},{key:"repeat_penalty",serverKey:"repeat_penalty",type:SyncableParameterType.NUMBER,canSync:!0},{key:"presence_penalty",serverKey:"presence_penalty",type:SyncableParameterType.NUMBER,canSync:!0},{key:"frequency_penalty",serverKey:"frequency_penalty",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dry_multiplier",serverKey:"dry_multiplier",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dry_base",serverKey:"dry_base",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dr\ -y_allowed_length",serverKey:"dry_allowed_length",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dry_penalty_last_n",serverKey:"dry_penalty_last_n",type:SyncableParameterType.NUMBER,canSync:!0},{key:"max_tokens",serverKey:"max_tokens",type:SyncableParameterType.NUMBER,canSync:!0},{key:"samplers",serverKey:"samplers",type:SyncableParameterType.STRING,canSync:!0},{key:"backend_sampling",serverKey:"backend_sampling",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"pasteLongTextToFileLen",serverKey:"\ -pasteLongTextToFileLen",type:SyncableParameterType.NUMBER,canSync:!0},{key:"pdfAsImage",serverKey:"pdfAsImage",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"showThoughtInProgress",serverKey:"showThoughtInProgress",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"keepStatsVisible",serverKey:"keepStatsVisible",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"showMessageStats",serverKey:"showMessageStats",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"askForTitleConfirmation",serverKey:"\ -askForTitleConfirmation",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"titleGenerationUseFirstLine",serverKey:"titleGenerationUseFirstLine",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"disableAutoScroll",serverKey:"disableAutoScroll",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"renderUserContentAsMarkdown",serverKey:"renderUserContentAsMarkdown",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"autoMicOnEmpty",serverKey:"autoMicOnEmpty",type:SyncableParameterType.BOOLEAN, -canSync:!0},{key:"pyInterpreterEnabled",serverKey:"pyInterpreterEnabled",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"enableContinueGeneration",serverKey:"enableContinueGeneration",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"fullHeightCodeBlocks",serverKey:"fullHeightCodeBlocks",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"systemMessage",serverKey:"systemMessage",type:SyncableParameterType.STRING,canSync:!0},{key:"showSystemMessage",serverKey:"showSystemMessage",type:SyncableParameterType. -BOOLEAN,canSync:!0},{key:"theme",serverKey:"theme",type:SyncableParameterType.STRING,canSync:!0},{key:"copyTextAttachmentsAsPlainText",serverKey:"copyTextAttachmentsAsPlainText",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"showRawOutputSwitch",serverKey:"showRawOutputSwitch",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"alwaysShowSidebarOnDesktop",serverKey:"alwaysShowSidebarOnDesktop",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"showRawModelNames",serverKey:"showRawModelN\ -ames",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"mcpServers",serverKey:"mcpServers",type:SyncableParameterType.STRING,canSync:!0},{key:"agenticMaxTurns",serverKey:"agenticMaxTurns",type:SyncableParameterType.NUMBER,canSync:!0},{key:"agenticMaxToolPreviewLines",serverKey:"agenticMaxToolPreviewLines",type:SyncableParameterType.NUMBER,canSync:!0},{key:"showToolCallInProgress",serverKey:"showToolCallInProgress",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"alwaysShowAgenticTurns",serverKey:"\ -alwaysShowAgenticTurns",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"excludeReasoningFromContext",serverKey:"excludeReasoningFromContext",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"sendOnEnter",serverKey:"sendOnEnter",type:SyncableParameterType.BOOLEAN,canSync:!0}];class ParameterSyncService{static roundFloatingPoint(value){return normalizeFloatingPoint(value)}static extractServerDefaults(serverParams,webuiSettings){const extracted={};if(serverParams){for(const param of SYNCABLE_PARAMETERS) -if(param.canSync&¶m.serverKey in serverParams){const value=serverParams[param.serverKey];value!==void 0&&(extracted[param.key]=this.roundFloatingPoint(value))}serverParams.samplers&&Array.isArray(serverParams.samplers)&&(extracted.samplers=serverParams.samplers.join(";"))}if(webuiSettings){for(const param of SYNCABLE_PARAMETERS)if(param.canSync&¶m.serverKey in webuiSettings){const value=webuiSettings[param.serverKey];value!==void 0&&(extracted[param.key]=this.roundFloatingPoint(value))}} -return extracted}static mergeWithServerDefaults(currentSettings,serverDefaults,userOverrides=new Set){const merged={...currentSettings};for(const[key2,serverValue]of Object.entries(serverDefaults))userOverrides.has(key2)||(merged[key2]=this.roundFloatingPoint(serverValue));return merged}static getParameterInfo(key2,currentValue,propsDefaults,userOverrides){const hasPropsDefault=propsDefaults[key2]!==void 0,isUserOverride=userOverrides.has(key2),source2=isUserOverride?ParameterSource.CUSTOM:ParameterSource. -DEFAULT;return{value:currentValue,source:source2,serverDefault:hasPropsDefault?propsDefaults[key2]:void 0,userOverride:isUserOverride?currentValue:void 0}}static canSyncParameter(key2){return SYNCABLE_PARAMETERS.some(param=>param.key===key2&¶m.canSync)}static getSyncableParameterKeys(){return SYNCABLE_PARAMETERS.filter(param=>param.canSync).map(param=>param.key)}static validateServerParameter(key2,value){const param=SYNCABLE_PARAMETERS.find(p2=>p2.key===key2);if(!param)return!1;switch(param. -type){case SyncableParameterType.NUMBER:return typeof value=="number"&&!isNaN(value);case SyncableParameterType.STRING:return typeof value=="string";case SyncableParameterType.BOOLEAN:return typeof value=="boolean";default:return!1}}static createParameterDiff(currentSettings,serverDefaults){const diff2={};for(const key2 of this.getSyncableParameterKeys()){const currentValue=currentSettings[key2],serverValue=serverDefaults[key2];serverValue!==void 0&&(diff2[key2]={current:currentValue,server:serverValue, -differs:currentValue!==serverValue})}return diff2}}class PropsService{static async fetch(autoload=!1){const params={};return autoload||(params.autoload="false"),apiFetchWithParams("./props",params,{authOnly:!0})}static async fetchForModel(modelId,autoload=!1){const params={model:modelId};return autoload||(params.autoload="false"),apiFetchWithParams("./props",params,{authOnly:!0})}}class ServerStore{#props=state$1(null);get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value, -!0)}#loading=state$1(!1);get loading(){return get$3(this.#loading)}set loading(value){set$1(this.#loading,value,!0)}#error=state$1(null);get error(){return get$3(this.#error)}set error(value){set$1(this.#error,value,!0)}#role=state$1(null);get role(){return get$3(this.#role)}set role(value){set$1(this.#role,value,!0)}fetchPromise=null;get defaultParams(){return this.props?.default_generation_settings?.params||null}get contextSize(){const nCtx=this.props?.default_generation_settings?.n_ctx;return typeof nCtx== -"number"?nCtx:null}get webuiSettings(){return this.props?.webui_settings}get isRouterMode(){return this.role===ServerRole.ROUTER}get isModelMode(){return this.role===ServerRole.MODEL}async fetch(){if(this.fetchPromise)return this.fetchPromise;this.loading=!0,this.error=null;const fetchPromise=(async()=>{try{const props=await PropsService.fetch();this.props=props,this.error=null,this.detectRole(props)}catch(error2){this.error=this.getErrorMessage(error2),console.error("Error fetching server prope\ -rties:",error2)}finally{this.loading=!1,this.fetchPromise=null}})();this.fetchPromise=fetchPromise,await fetchPromise}getErrorMessage(error2){if(error2 instanceof Error){const message=error2.message||"";if(error2.name==="TypeError"&&message.includes("fetch"))return"Server is not running or unreachable";if(message.includes("ECONNREFUSED"))return"Connection refused - server may be offline";if(message.includes("ENOTFOUND"))return"Server not found - check server address";if(message.includes("ETIMEDO\ -UT"))return"Request timed out";if(message.includes("503"))return"Server temporarily unavailable";if(message.includes("500"))return"Server error - check server logs";if(message.includes("404"))return"Server endpoint not found";if(message.includes("403")||message.includes("401"))return"Access denied"}return"Failed to connect to server"}clear(){this.props=null,this.error=null,this.loading=!1,this.role=null,this.fetchPromise=null}detectRole(props){const newRole=props?.role===ServerRole.ROUTER?ServerRole. -ROUTER:ServerRole.MODEL;this.role!==newRole&&(this.role=newRole,console.info(`Server running in ${newRole===ServerRole.ROUTER?"ROUTER":"MODEL"} mode`))}}const serverStore=new ServerStore,serverProps=()=>serverStore.props,serverLoading=()=>serverStore.loading,serverError=()=>serverStore.error,contextSize=()=>serverStore.contextSize,isRouterMode=()=>serverStore.isRouterMode;class SettingsStore{#config=state$1(proxy({...SETTING_CONFIG_DEFAULT}));get config(){return get$3(this.#config)}set config(value){ -set$1(this.#config,value,!0)}#theme=state$1("auto");get theme(){return get$3(this.#theme)}set theme(value){set$1(this.#theme,value,!0)}#isInitialized=state$1(!1);get isInitialized(){return get$3(this.#isInitialized)}set isInitialized(value){set$1(this.#isInitialized,value,!0)}#userOverrides=state$1(proxy(new Set));get userOverrides(){return get$3(this.#userOverrides)}set userOverrides(value){set$1(this.#userOverrides,value,!0)}getServerDefaults(){const serverParams=serverStore.defaultParams,webuiSettings=serverStore. -webuiSettings;return ParameterSyncService.extractServerDefaults(serverParams,webuiSettings)}constructor(){this.initialize()}initialize(){try{this.loadConfig(),this.loadTheme(),this.isInitialized=!0}catch(error2){console.error("Failed to initialize settings store:",error2)}}loadConfig(){try{const storedConfigRaw=localStorage.getItem(CONFIG_LOCALSTORAGE_KEY),savedVal=JSON.parse(storedConfigRaw||"{}");this.config={...SETTING_CONFIG_DEFAULT,...savedVal},"sendOnEnter"in savedVal||new IsMobile().current&& -(this.config.sendOnEnter=!1);const savedOverrides=JSON.parse(localStorage.getItem(USER_OVERRIDES_LOCALSTORAGE_KEY)||"[]");this.userOverrides=new Set(savedOverrides)}catch(error2){console.warn("Failed to parse config from localStorage, using defaults:",error2),this.config={...SETTING_CONFIG_DEFAULT},this.userOverrides=new Set}}loadTheme(){this.theme=localStorage.getItem("theme")||"auto"}updateConfig(key2,value){if(this.config[key2]=value,ParameterSyncService.canSyncParameter(key2)){const propsDefault=this. -getServerDefaults()[key2];if(propsDefault!==void 0){const normalizedValue=normalizeFloatingPoint(value),normalizedDefault=normalizeFloatingPoint(propsDefault);normalizedValue===normalizedDefault?this.userOverrides.delete(key2):this.userOverrides.add(key2)}}this.saveConfig()}updateMultipleConfig(updates){Object.assign(this.config,updates);const propsDefaults=this.getServerDefaults();for(const[key2,value]of Object.entries(updates))if(ParameterSyncService.canSyncParameter(key2)){const propsDefault=propsDefaults[key2]; -if(propsDefault!==void 0){const normalizedValue=normalizeFloatingPoint(value),normalizedDefault=normalizeFloatingPoint(propsDefault);normalizedValue===normalizedDefault?this.userOverrides.delete(key2):this.userOverrides.add(key2)}}this.saveConfig()}saveConfig(){try{localStorage.setItem(CONFIG_LOCALSTORAGE_KEY,JSON.stringify(this.config)),localStorage.setItem(USER_OVERRIDES_LOCALSTORAGE_KEY,JSON.stringify(Array.from(this.userOverrides)))}catch(error2){console.error("Failed to save config to local\ -Storage:",error2)}}updateTheme(newTheme){this.theme=newTheme,this.saveTheme()}saveTheme(){try{this.theme==="auto"?localStorage.removeItem("theme"):localStorage.setItem("theme",this.theme)}catch(error2){console.error("Failed to save theme to localStorage:",error2)}}resetConfig(){this.config={...SETTING_CONFIG_DEFAULT},this.saveConfig()}resetTheme(){this.theme="auto",this.saveTheme()}resetAll(){this.resetConfig(),this.resetTheme()}resetParameterToServerDefault(key2){const serverDefaults=this.getServerDefaults(), -webuiSettings=serverStore.webuiSettings;webuiSettings&&key2 in webuiSettings?setConfigValue(this.config,key2,webuiSettings[key2]):serverDefaults[key2]!==void 0?setConfigValue(this.config,key2,""):key2 in SETTING_CONFIG_DEFAULT&&setConfigValue(this.config,key2,getConfigValue(SETTING_CONFIG_DEFAULT,key2)),this.userOverrides.delete(key2),this.saveConfig()}syncWithServerDefaults(){const propsDefaults=this.getServerDefaults();if(Object.keys(propsDefaults).length===0)return;const webuiSettings=serverStore. -webuiSettings,webuiSettingsKeys=new Set(webuiSettings?Object.keys(webuiSettings):[]);for(const[key2,propsValue]of Object.entries(propsDefaults)){const currentValue=getConfigValue(this.config,key2),normalizedCurrent=normalizeFloatingPoint(currentValue),normalizedDefault=normalizeFloatingPoint(propsValue);normalizedCurrent===normalizedDefault&&(this.userOverrides.delete(key2),!webuiSettingsKeys.has(key2)&&getConfigValue(SETTING_CONFIG_DEFAULT,key2)===void 0&&setConfigValue(this.config,key2,void 0))} -if(webuiSettings)for(const[key2,value]of Object.entries(webuiSettings))!this.userOverrides.has(key2)&&value!==void 0&&setConfigValue(this.config,key2,value);this.saveConfig(),console.log("User overrides after sync:",Array.from(this.userOverrides))}forceSyncWithServerDefaults(){const propsDefaults=this.getServerDefaults(),webuiSettings=serverStore.webuiSettings;for(const key2 of ParameterSyncService.getSyncableParameterKeys())webuiSettings&&key2 in webuiSettings?setConfigValue(this.config,key2,webuiSettings[key2]): -propsDefaults[key2]!==void 0?setConfigValue(this.config,key2,""):key2 in SETTING_CONFIG_DEFAULT&&setConfigValue(this.config,key2,getConfigValue(SETTING_CONFIG_DEFAULT,key2)),this.userOverrides.delete(key2);this.saveConfig()}getConfig(key2){return this.config[key2]}getAllConfig(){return{...this.config}}canSyncParameter(key2){return ParameterSyncService.canSyncParameter(key2)}getParameterInfo(key2){const propsDefaults=this.getServerDefaults(),currentValue=getConfigValue(this.config,key2);return ParameterSyncService. -getParameterInfo(key2,currentValue??"",propsDefaults,this.userOverrides)}getParameterDiff(){const serverDefaults=this.getServerDefaults();if(Object.keys(serverDefaults).length===0)return{};const configAsRecord=configToParameterRecord(this.config,ParameterSyncService.getSyncableParameterKeys());return ParameterSyncService.createParameterDiff(configAsRecord,serverDefaults)}clearAllUserOverrides(){this.userOverrides.clear(),this.saveConfig(),console.log("Cleared all user overrides")}}const settingsStore=new SettingsStore, -config$1=()=>settingsStore.config;function redactValue(value,showLastChars){return showLastChars?`....${value.slice(-showLastChars)}`:"[redacted]"}function getAuthHeaders(){const apiKey=config$1().apiKey?.toString().trim();return apiKey?{Authorization:`Bearer ${apiKey}`}:{}}function getJsonHeaders(){return{"Content-Type":"application/json",...getAuthHeaders()}}function sanitizeHeaders(headers,extraRedactedHeaders,partialRedactHeaders){if(!headers)return{};const normalized=new Headers(headers),sanitized={}, -redactedHeaders=new Set(Array.from(extraRedactedHeaders??[],header=>header.toLowerCase()));for(const[key2,value]of normalized.entries()){const normalizedKey=key2.toLowerCase(),partialChars=partialRedactHeaders?.get(normalizedKey);partialChars!==void 0?sanitized[key2]=redactValue(value,partialChars):REDACTED_HEADERS.has(normalizedKey)||redactedHeaders.has(normalizedKey)?sanitized[key2]=redactValue(value):sanitized[key2]=value}return sanitized}async function apiFetch(path2,options={}){const{authOnly=!1, -headers:customHeaders,...fetchOptions}=options,headers={...authOnly?getAuthHeaders():getJsonHeaders(),...customHeaders},url2=path2.startsWith(UrlProtocol.HTTP)||path2.startsWith(UrlProtocol.HTTPS)?path2:`${base}${path2}`,response=await fetch(url2,{...fetchOptions,headers});if(!response.ok){const errorMessage=await parseErrorMessage(response);throw new Error(errorMessage)}return response.json()}async function apiFetchWithParams(basePath,params,options={}){const url2=new URL(basePath,window.location. -href);for(const[key2,value]of Object.entries(params))value!=null&&url2.searchParams.set(key2,value);const{authOnly=!1,headers:customHeaders,...fetchOptions}=options,headers={...authOnly?getAuthHeaders():getJsonHeaders(),...customHeaders},response=await fetch(url2.toString(),{...fetchOptions,headers});if(!response.ok){const errorMessage=await parseErrorMessage(response);throw new Error(errorMessage)}return response.json()}async function apiPost(path2,body2,options={}){return apiFetch(path2,{method:"\ -POST",body:JSON.stringify(body2),...options})}async function parseErrorMessage(response){try{const errorData=await response.json();if(errorData?.error?.message)return errorData.error.message;if(errorData?.error&&typeof errorData.error=="string")return errorData.error;if(errorData?.message)return errorData.message}catch{}return`Request failed: ${response.status} ${response.statusText}`}function error(status,body2){throw new HttpError(status,body2)}async function validateApiKey(fetch2){try{const apiKey=config$1(). -apiKey,headers={"Content-Type":"application/json"};apiKey&&(headers.Authorization=`Bearer ${apiKey}`);const response=await fetch2(`${base}/props`,{headers});if(!response.ok){if(response.status===401||response.status===403)throw error(401,"Access denied");console.warn(`Server responded with status ${response.status} during API key validation`);return}}catch(err){if(err&&typeof err=="object"&&"status"in err)throw err;console.warn("Cannot connect to server for API key validation:",err)}}function isMcpPrompt(item){ -return!!(item.attachment?.type===AttachmentType.MCP_PROMPT||item.uploadedFile?.type===SpecialFileType.MCP_PROMPT&&item.uploadedFile.mcpPrompt)}function isMcpResource(item){return item.attachment?.type===AttachmentType.MCP_RESOURCE}function getUploadedFileCategory$1(file){const categoryByMime=getFileTypeCategory(file.type);return categoryByMime||getFileTypeCategoryByExtension(file.name)}function getAttachmentDisplayItems(options){const{uploadedFiles=[],attachments=[]}=options,items2=[];for(const file of uploadedFiles) -items2.push({id:file.id,name:file.name,size:file.size,preview:file.preview,isImage:getUploadedFileCategory$1(file)===FileTypeCategory.IMAGE,isLoading:file.isLoading,loadError:file.loadError,uploadedFile:file,textContent:file.textContent});for(const[index2,attachment]of attachments.entries()){const isImage2=isImageFile(attachment);items2.push({id:`attachment-${index2}`,name:attachment.name,size:"size"in attachment?attachment.size:void 0,preview:isImage2&&"base64Url"in attachment?attachment.base64Url: -void 0,isImage:isImage2,attachment,attachmentIndex:index2,textContent:"content"in attachment?attachment.content:void 0})}return items2.reverse()}function getUploadedFileCategory(uploadedFile){const categoryByMime=getFileTypeCategory(uploadedFile.type);return categoryByMime||getFileTypeCategoryByExtension(uploadedFile.name)}function isTextFile(attachment,uploadedFile){return uploadedFile?getUploadedFileCategory(uploadedFile)===FileTypeCategory.TEXT:attachment?attachment.type===AttachmentType.TEXT|| -attachment.type===AttachmentType.LEGACY_CONTEXT:!1}function isImageFile(attachment,uploadedFile){return uploadedFile?getUploadedFileCategory(uploadedFile)===FileTypeCategory.IMAGE:attachment?attachment.type===AttachmentType.IMAGE:!1}function isPdfFile$1(attachment,uploadedFile){return uploadedFile?getUploadedFileCategory(uploadedFile)===FileTypeCategory.PDF:attachment?attachment.type===AttachmentType.PDF:!1}function isAudioFile(attachment,uploadedFile){return uploadedFile?getUploadedFileCategory( -uploadedFile)===FileTypeCategory.AUDIO:attachment?attachment.type===AttachmentType.AUDIO:!1}function autoResizeTextarea(textareaElement){textareaElement&&(textareaElement.style.height="1rem",textareaElement.style.height=textareaElement.scrollHeight+"px")}function findMessageById(messages,id2){if(id2)return messages.find(m=>m.id===id2)}function filterByLeafNodeId(messages,leafNodeId,includeRoot=!1){const result=[],nodeMap=new Map;for(const msg of messages)nodeMap.set(msg.id,msg);let startNode=nodeMap. -get(leafNodeId);if(!startNode){let latestTime=-1;for(const msg of messages)msg.timestamp>latestTime&&(startNode=msg,latestTime=msg.timestamp)}let currentNode=startNode;for(;currentNode&&((currentNode.type!=="root"||includeRoot)&&result.push(currentNode),currentNode.parent!==null);)currentNode=nodeMap.get(currentNode.parent);return result.sort((a,b)=>a.role===MessageRole.SYSTEM&&b.role!==MessageRole.SYSTEM?-1:a.role!==MessageRole.SYSTEM&&b.role===MessageRole.SYSTEM?1:a.timestamp-b.timestamp),result} -function findLeafNode(messages,messageId){const nodeMap=new Map;for(const msg of messages)nodeMap.set(msg.id,msg);let currentNode=nodeMap.get(messageId);for(;currentNode&¤tNode.children.length>0;){const lastChildId=currentNode.children[currentNode.children.length-1];currentNode=nodeMap.get(lastChildId)}return currentNode?.id??messageId}function findDescendantMessages(messages,messageId){const nodeMap=new Map;for(const msg of messages)nodeMap.set(msg.id,msg);const descendants=[],queue=[messageId]; -for(;queue.length>0;){const currentId=queue.shift(),currentNode=nodeMap.get(currentId);if(currentNode)for(const childId of currentNode.children)descendants.push(childId),queue.push(childId)}return descendants}function getMessageSiblings(messages,messageId){const nodeMap=new Map;for(const msg of messages)nodeMap.set(msg.id,msg);const message=nodeMap.get(messageId);if(!message)return null;if(message.parent===null)return{message,siblingIds:[messageId],currentIndex:0,totalSiblings:1};const parentNode=nodeMap. -get(message.parent);if(!parentNode)return{message,siblingIds:[messageId],currentIndex:0,totalSiblings:1};const siblingIds=parentNode.children,siblingLeafIds=siblingIds.map(siblingId=>findLeafNode(messages,siblingId)),currentIndex=siblingIds.indexOf(messageId);return{message,siblingIds:siblingLeafIds,currentIndex,totalSiblings:siblingIds.length}}var core$5,hasRequiredCore$4;function requireCore$4(){if(hasRequiredCore$4)return core$5;hasRequiredCore$4=1;function deepFreeze(obj){return obj instanceof -Map?obj.clear=obj.delete=obj.set=function(){throw new Error("map is read-only")}:obj instanceof Set&&(obj.add=obj.clear=obj.delete=function(){throw new Error("set is read-only")}),Object.freeze(obj),Object.getOwnPropertyNames(obj).forEach(name=>{const prop2=obj[name],type2=typeof prop2;(type2==="object"||type2==="function")&&!Object.isFrozen(prop2)&&deepFreeze(prop2)}),obj}class Response2{constructor(mode){mode.data===void 0&&(mode.data={}),this.data=mode.data,this.isMatchIgnored=!1}ignoreMatch(){ -this.isMatchIgnored=!0}}function escapeHTML(value){return value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function inherit$1(original,...objects){const result=Object.create(null);for(const key2 in original)result[key2]=original[key2];return objects.forEach(function(obj){for(const key2 in obj)result[key2]=obj[key2]}),result}const SPAN_CLOSE="</span>",emitsWrappingTags=node2=>!!node2.scope,scopeToCSSClass=(name,{prefix})=>{if(name. -startsWith("language:"))return name.replace("language:","language-");if(name.includes(".")){const pieces=name.split(".");return[`${prefix}${pieces.shift()}`,...pieces.map((x,i)=>`${x}${"_".repeat(i+1)}`)].join(" ")}return`${prefix}${name}`};class HTMLRenderer{constructor(parseTree3,options){this.buffer="",this.classPrefix=options.classPrefix,parseTree3.walk(this)}addText(text2){this.buffer+=escapeHTML(text2)}openNode(node2){if(!emitsWrappingTags(node2))return;const className=scopeToCSSClass(node2. -scope,{prefix:this.classPrefix});this.span(className)}closeNode(node2){emitsWrappingTags(node2)&&(this.buffer+=SPAN_CLOSE)}value(){return this.buffer}span(className){this.buffer+=`<span class="${className}">`}}const newNode=(opts={})=>{const result={children:[]};return Object.assign(result,opts),result};class TokenTree{constructor(){this.rootNode=newNode(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(node2){this.top.children.push( -node2)}openNode(scope2){const node2=newNode({scope:scope2});this.add(node2),this.stack.push(node2)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(builder){return this.constructor._walk(builder,this.rootNode)}static _walk(builder,node2){return typeof node2=="string"?builder.addText(node2):node2.children&&(builder.openNode(node2),node2.children.forEach(child2=>this._walk(builder,child2)), -builder.closeNode(node2)),builder}static _collapse(node2){typeof node2!="string"&&node2.children&&(node2.children.every(el=>typeof el=="string")?node2.children=[node2.children.join("")]:node2.children.forEach(child2=>{TokenTree._collapse(child2)}))}}class TokenTreeEmitter extends TokenTree{constructor(options){super(),this.options=options}addText(text2){text2!==""&&this.add(text2)}startScope(scope2){this.openNode(scope2)}endScope(){this.closeNode()}__addSublanguage(emitter,name){const node2=emitter. -root;name&&(node2.scope=`language:${name}`),this.add(node2)}toHTML(){return new HTMLRenderer(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function source2(re2){return re2?typeof re2=="string"?re2:re2.source:null}function lookahead2(re2){return concat2("(?=",re2,")")}function anyNumberOfTimes(re2){return concat2("(?:",re2,")*")}function optional2(re2){return concat2("(?:",re2,")?")}function concat2(...args){return args.map(x=>source2(x)).join("")}function stripOptionsFromArgs2(args){ -const opts=args[args.length-1];return typeof opts=="object"&&opts.constructor===Object?(args.splice(args.length-1,1),opts):{}}function either2(...args){return"("+(stripOptionsFromArgs2(args).capture?"":"?:")+args.map(x=>source2(x)).join("|")+")"}function countMatchGroups(re2){return new RegExp(re2.toString()+"|").exec("").length-1}function startsWith(re2,lexeme){const match=re2&&re2.exec(lexeme);return match&&match.index===0}const BACKREF_RE=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function _rewriteBackreferences(regexps,{ -joinWith}){let numCaptures=0;return regexps.map(regex=>{numCaptures+=1;const offset2=numCaptures;let re2=source2(regex),out="";for(;re2.length>0;){const match=BACKREF_RE.exec(re2);if(!match){out+=re2;break}out+=re2.substring(0,match.index),re2=re2.substring(match.index+match[0].length),match[0][0]==="\\"&&match[1]?out+="\\"+String(Number(match[1])+offset2):(out+=match[0],match[0]==="("&&numCaptures++)}return out}).map(re2=>`(${re2})`).join(joinWith)}const MATCH_NOTHING_RE=/\b\B/,IDENT_RE2="[a-zA\ --Z]\\w*",UNDERSCORE_IDENT_RE="[a-zA-Z_]\\w*",NUMBER_RE="\\b\\d+(\\.\\d+)?",C_NUMBER_RE="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",BINARY_NUMBER_RE="\\b(0b[01]+)",RE_STARTERS_RE="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG=(opts={})=>{const beginShebang=/^#![ ]*\//;return opts.binary&&(opts.begin=concat2(beginShebang,/.*\b/,opts.binary,/\b.*/)),inherit$1({scope:"\ -meta",begin:beginShebang,end:/$/,relevance:0,"on:begin":(m,resp)=>{m.index!==0&&resp.ignoreMatch()}},opts)},BACKSLASH_ESCAPE={begin:"\\\\[\\s\\S]",relevance:0},APOS_STRING_MODE={scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[BACKSLASH_ESCAPE]},QUOTE_STRING_MODE={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[BACKSLASH_ESCAPE]},PHRASAL_WORDS_MODE={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/}, -COMMENT=function(begin,end,modeOptions={}){const mode=inherit$1({scope:"comment",begin,end,contains:[]},modeOptions);mode.contains.push({scope:"doctag",begin:"[ ]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const ENGLISH_WORD=either2("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return mode.contains.push({begin:concat2(/[ ]+/,"(",ENGLISH_WORD, -/[.]?[:]?([.][ ]|[ ])/,"){3}")}),mode},C_LINE_COMMENT_MODE=COMMENT("//","$"),C_BLOCK_COMMENT_MODE=COMMENT("/\\*","\\*/"),HASH_COMMENT_MODE=COMMENT("#","$"),NUMBER_MODE={scope:"number",begin:NUMBER_RE,relevance:0},C_NUMBER_MODE={scope:"number",begin:C_NUMBER_RE,relevance:0},BINARY_NUMBER_MODE={scope:"number",begin:BINARY_NUMBER_RE,relevance:0},REGEXP_MODE={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[BACKSLASH_ESCAPE]}]}, -TITLE_MODE={scope:"title",begin:IDENT_RE2,relevance:0},UNDERSCORE_TITLE_MODE={scope:"title",begin:UNDERSCORE_IDENT_RE,relevance:0},METHOD_GUARD={begin:"\\.\\s*"+UNDERSCORE_IDENT_RE,relevance:0};var MODES2=Object.freeze({__proto__:null,APOS_STRING_MODE,BACKSLASH_ESCAPE,BINARY_NUMBER_MODE,BINARY_NUMBER_RE,COMMENT,C_BLOCK_COMMENT_MODE,C_LINE_COMMENT_MODE,C_NUMBER_MODE,C_NUMBER_RE,END_SAME_AS_BEGIN:function(mode){return Object.assign(mode,{"on:begin":(m,resp)=>{resp.data._beginMatch=m[1]},"on:end":(m,resp)=>{ -resp.data._beginMatch!==m[1]&&resp.ignoreMatch()}})},HASH_COMMENT_MODE,IDENT_RE:IDENT_RE2,MATCH_NOTHING_RE,METHOD_GUARD,NUMBER_MODE,NUMBER_RE,PHRASAL_WORDS_MODE,QUOTE_STRING_MODE,REGEXP_MODE,RE_STARTERS_RE,SHEBANG,TITLE_MODE,UNDERSCORE_IDENT_RE,UNDERSCORE_TITLE_MODE});function skipIfHasPrecedingDot(match,response){match.input[match.index-1]==="."&&response.ignoreMatch()}function scopeClassName(mode,_parent){mode.className!==void 0&&(mode.scope=mode.className,delete mode.className)}function beginKeywords(mode,parent){ -parent&&mode.beginKeywords&&(mode.begin="\\b("+mode.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",mode.__beforeBegin=skipIfHasPrecedingDot,mode.keywords=mode.keywords||mode.beginKeywords,delete mode.beginKeywords,mode.relevance===void 0&&(mode.relevance=0))}function compileIllegal(mode,_parent){Array.isArray(mode.illegal)&&(mode.illegal=either2(...mode.illegal))}function compileMatch(mode,_parent){if(mode.match){if(mode.begin||mode.end)throw new Error("begin & end are not supported wi\ -th match");mode.begin=mode.match,delete mode.match}}function compileRelevance(mode,_parent){mode.relevance===void 0&&(mode.relevance=1)}const beforeMatchExt=(mode,parent)=>{if(!mode.beforeMatch)return;if(mode.starts)throw new Error("beforeMatch cannot be used with starts");const originalMode=Object.assign({},mode);Object.keys(mode).forEach(key2=>{delete mode[key2]}),mode.keywords=originalMode.keywords,mode.begin=concat2(originalMode.beforeMatch,lookahead2(originalMode.begin)),mode.starts={relevance:0, -contains:[Object.assign(originalMode,{endsParent:!0})]},mode.relevance=0,delete originalMode.beforeMatch},COMMON_KEYWORDS=["of","and","for","in","not","or","if","then","parent","list","value"],DEFAULT_KEYWORD_SCOPE="keyword";function compileKeywords(rawKeywords,caseInsensitive,scopeName=DEFAULT_KEYWORD_SCOPE){const compiledKeywords=Object.create(null);return typeof rawKeywords=="string"?compileList(scopeName,rawKeywords.split(" ")):Array.isArray(rawKeywords)?compileList(scopeName,rawKeywords):Object. -keys(rawKeywords).forEach(function(scopeName2){Object.assign(compiledKeywords,compileKeywords(rawKeywords[scopeName2],caseInsensitive,scopeName2))}),compiledKeywords;function compileList(scopeName2,keywordList){caseInsensitive&&(keywordList=keywordList.map(x=>x.toLowerCase())),keywordList.forEach(function(keyword2){const pair=keyword2.split("|");compiledKeywords[pair[0]]=[scopeName2,scoreForKeyword(pair[0],pair[1])]})}}function scoreForKeyword(keyword2,providedScore){return providedScore?Number( -providedScore):commonKeyword(keyword2)?0:1}function commonKeyword(keyword2){return COMMON_KEYWORDS.includes(keyword2.toLowerCase())}const seenDeprecations={},error2=message=>{console.error(message)},warn2=(message,...args)=>{console.log(`WARN: ${message}`,...args)},deprecated2=(version3,message)=>{seenDeprecations[`${version3}/${message}`]||(console.log(`Deprecated as of ${version3}. ${message}`),seenDeprecations[`${version3}/${message}`]=!0)},MultiClassError=new Error;function remapScopeNames(mode,regexes,{ -key:key2}){let offset2=0;const scopeNames=mode[key2],emit={},positions={};for(let i=1;i<=regexes.length;i++)positions[i+offset2]=scopeNames[i],emit[i+offset2]=!0,offset2+=countMatchGroups(regexes[i-1]);mode[key2]=positions,mode[key2]._emit=emit,mode[key2]._multi=!0}function beginMultiClass(mode){if(Array.isArray(mode.begin)){if(mode.skip||mode.excludeBegin||mode.returnBegin)throw error2("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),MultiClassError;if(typeof mode.beginScope!= -"object"||mode.beginScope===null)throw error2("beginScope must be object"),MultiClassError;remapScopeNames(mode,mode.begin,{key:"beginScope"}),mode.begin=_rewriteBackreferences(mode.begin,{joinWith:""})}}function endMultiClass(mode){if(Array.isArray(mode.end)){if(mode.skip||mode.excludeEnd||mode.returnEnd)throw error2("skip, excludeEnd, returnEnd not compatible with endScope: {}"),MultiClassError;if(typeof mode.endScope!="object"||mode.endScope===null)throw error2("endScope must be object"),MultiClassError; -remapScopeNames(mode,mode.end,{key:"endScope"}),mode.end=_rewriteBackreferences(mode.end,{joinWith:""})}}function scopeSugar(mode){mode.scope&&typeof mode.scope=="object"&&mode.scope!==null&&(mode.beginScope=mode.scope,delete mode.scope)}function MultiClass(mode){scopeSugar(mode),typeof mode.beginScope=="string"&&(mode.beginScope={_wrap:mode.beginScope}),typeof mode.endScope=="string"&&(mode.endScope={_wrap:mode.endScope}),beginMultiClass(mode),endMultiClass(mode)}function compileLanguage(language2){ -function langRe(value,global2){return new RegExp(source2(value),"m"+(language2.case_insensitive?"i":"")+(language2.unicodeRegex?"u":"")+(global2?"g":""))}class MultiRegex{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(re2,opts){opts.position=this.position++,this.matchIndexes[this.matchAt]=opts,this.regexes.push([opts,re2]),this.matchAt+=countMatchGroups(re2)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const terminators=this.regexes.map(el=>el[1]); -this.matcherRe=langRe(_rewriteBackreferences(terminators,{joinWith:"|"}),!0),this.lastIndex=0}exec(s2){this.matcherRe.lastIndex=this.lastIndex;const match=this.matcherRe.exec(s2);if(!match)return null;const i=match.findIndex((el,i2)=>i2>0&&el!==void 0),matchData=this.matchIndexes[i];return match.splice(0,i),Object.assign(match,matchData)}}class ResumableMultiRegex{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(index2){if(this.multiRegexes[index2]) -return this.multiRegexes[index2];const matcher=new MultiRegex;return this.rules.slice(index2).forEach(([re2,opts])=>matcher.addRule(re2,opts)),matcher.compile(),this.multiRegexes[index2]=matcher,matcher}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(re2,opts){this.rules.push([re2,opts]),opts.type==="begin"&&this.count++}exec(s2){const m=this.getMatcher(this.regexIndex);m.lastIndex=this.lastIndex;let result=m.exec(s2);if(this.resumingScanAtSamePosition()&& -!(result&&result.index===this.lastIndex)){const m2=this.getMatcher(0);m2.lastIndex=this.lastIndex+1,result=m2.exec(s2)}return result&&(this.regexIndex+=result.position+1,this.regexIndex===this.count&&this.considerAll()),result}}function buildModeRegex(mode){const mm=new ResumableMultiRegex;return mode.contains.forEach(term=>mm.addRule(term.begin,{rule:term,type:"begin"})),mode.terminatorEnd&&mm.addRule(mode.terminatorEnd,{type:"end"}),mode.illegal&&mm.addRule(mode.illegal,{type:"illegal"}),mm}function compileMode(mode,parent){ -const cmode=mode;if(mode.isCompiled)return cmode;[scopeClassName,compileMatch,MultiClass,beforeMatchExt].forEach(ext=>ext(mode,parent)),language2.compilerExtensions.forEach(ext=>ext(mode,parent)),mode.__beforeBegin=null,[beginKeywords,compileIllegal,compileRelevance].forEach(ext=>ext(mode,parent)),mode.isCompiled=!0;let keywordPattern=null;return typeof mode.keywords=="object"&&mode.keywords.$pattern&&(mode.keywords=Object.assign({},mode.keywords),keywordPattern=mode.keywords.$pattern,delete mode. -keywords.$pattern),keywordPattern=keywordPattern||/\w+/,mode.keywords&&(mode.keywords=compileKeywords(mode.keywords,language2.case_insensitive)),cmode.keywordPatternRe=langRe(keywordPattern,!0),parent&&(mode.begin||(mode.begin=/\B|\b/),cmode.beginRe=langRe(cmode.begin),!mode.end&&!mode.endsWithParent&&(mode.end=/\B|\b/),mode.end&&(cmode.endRe=langRe(cmode.end)),cmode.terminatorEnd=source2(cmode.end)||"",mode.endsWithParent&&parent.terminatorEnd&&(cmode.terminatorEnd+=(mode.end?"|":"")+parent.terminatorEnd)), -mode.illegal&&(cmode.illegalRe=langRe(mode.illegal)),mode.contains||(mode.contains=[]),mode.contains=[].concat(...mode.contains.map(function(c2){return expandOrCloneMode(c2==="self"?mode:c2)})),mode.contains.forEach(function(c2){compileMode(c2,cmode)}),mode.starts&&compileMode(mode.starts,parent),cmode.matcher=buildModeRegex(cmode),cmode}if(language2.compilerExtensions||(language2.compilerExtensions=[]),language2.contains&&language2.contains.includes("self"))throw new Error("ERR: contains `self`\ - is not supported at the top-level of a language. See documentation.");return language2.classNameAliases=inherit$1(language2.classNameAliases||{}),compileMode(language2)}function dependencyOnParent(mode){return mode?mode.endsWithParent||dependencyOnParent(mode.starts):!1}function expandOrCloneMode(mode){return mode.variants&&!mode.cachedVariants&&(mode.cachedVariants=mode.variants.map(function(variant){return inherit$1(mode,{variants:null},variant)})),mode.cachedVariants?mode.cachedVariants:dependencyOnParent( -mode)?inherit$1(mode,{starts:mode.starts?inherit$1(mode.starts):null}):Object.isFrozen(mode)?inherit$1(mode):mode}var version2="11.11.1";class HTMLInjectionError extends Error{constructor(reason,html2){super(reason),this.name="HTMLInjectionError",this.html=html2}}const escape2=escapeHTML,inherit=inherit$1,NO_MATCH=Symbol("nomatch"),MAX_KEYWORD_HITS=7,HLJS=function(hljs){const languages=Object.create(null),aliases=Object.create(null),plugins=[];let SAFE_MODE=!0;const LANGUAGE_NOT_FOUND="Could not\ - find the language '{}', did you forget to load/include a language module?",PLAINTEXT_LANGUAGE={disableAutodetect:!0,name:"Plain text",contains:[]};let options={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:TokenTreeEmitter};function shouldNotHighlight(languageName){return options.noHighlightRe.test(languageName)}function blockLanguage(block2){let classes=block2. -className+" ";classes+=block2.parentNode?block2.parentNode.className:"";const match=options.languageDetectRe.exec(classes);if(match){const language2=getLanguage(match[1]);return language2||(warn2(LANGUAGE_NOT_FOUND.replace("{}",match[1])),warn2("Falling back to no-highlight mode for this block.",block2)),language2?match[1]:"no-highlight"}return classes.split(/\s+/).find(_class=>shouldNotHighlight(_class)||getLanguage(_class))}function highlight2(codeOrLanguageName,optionsOrCode,ignoreIllegals){let code2="", -languageName="";typeof optionsOrCode=="object"?(code2=codeOrLanguageName,ignoreIllegals=optionsOrCode.ignoreIllegals,languageName=optionsOrCode.language):(deprecated2("10.7.0","highlight(lang, code, ...args) has been deprecated."),deprecated2("10.7.0",`Please use highlight(code, options) instead. +Lines"],POSITIVE_INTEGER_FIELDS=["agenticMaxTurns","agenticMaxToolPreviewLines"],SETTINGS_KEYS={THEME:"theme",API_KEY:"apiKey",SYSTEM_MESSAGE:"systemMessage",PASTE_LONG_TEXT_TO_FILE_LEN:"pasteLongTextToFileLen",COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT:"copyTextAttachmentsAsPlainText",SEND_ON_ENTER:"sendOnEnter",ENABLE_CONTINUE_GENERATION:"enableContinueGeneration",PDF_AS_IMAGE:"pdfAsImage",ASK_FOR_TITLE_CONFIRMATION:"askForTitleConfirmation",TITLE_GENERATION_USE_FIRST_LINE:"titleGenerationUseFirstLin\ +e",SHOW_MESSAGE_STATS:"showMessageStats",SHOW_THOUGHT_IN_PROGRESS:"showThoughtInProgress",KEEP_STATS_VISIBLE:"keepStatsVisible",AUTO_MIC_ON_EMPTY:"autoMicOnEmpty",RENDER_USER_CONTENT_AS_MARKDOWN:"renderUserContentAsMarkdown",DISABLE_AUTO_SCROLL:"disableAutoScroll",ALWAYS_SHOW_SIDEBAR_ON_DESKTOP:"alwaysShowSidebarOnDesktop",FULL_HEIGHT_CODE_BLOCKS:"fullHeightCodeBlocks",SHOW_RAW_MODEL_NAMES:"showRawModelNames",TEMPERATURE:"temperature",DYNATEMP_RANGE:"dynatemp_range",DYNATEMP_EXPONENT:"dynatemp_e\ +xponent",TOP_K:"top_k",TOP_P:"top_p",MIN_P:"min_p",XTC_PROBABILITY:"xtc_probability",XTC_THRESHOLD:"xtc_threshold",TYP_P:"typ_p",MAX_TOKENS:"max_tokens",SAMPLERS:"samplers",BACKEND_SAMPLING:"backend_sampling",REPEAT_LAST_N:"repeat_last_n",REPEAT_PENALTY:"repeat_penalty",PRESENCE_PENALTY:"presence_penalty",FREQUENCY_PENALTY:"frequency_penalty",DRY_MULTIPLIER:"dry_multiplier",DRY_BASE:"dry_base",DRY_ALLOWED_LENGTH:"dry_allowed_length",DRY_PENALTY_LAST_N:"dry_penalty_last_n",AGENTIC_MAX_TURNS:"agen\ +ticMaxTurns",ALWAYS_SHOW_AGENTIC_TURNS:"alwaysShowAgenticTurns",AGENTIC_MAX_TOOL_PREVIEW_LINES:"agenticMaxToolPreviewLines",SHOW_TOOL_CALL_IN_PROGRESS:"showToolCallInProgress",PRE_ENCODE_CONVERSATION:"preEncodeConversation",DISABLE_REASONING_PARSING:"disableReasoningParsing",EXCLUDE_REASONING_FROM_CONTEXT:"excludeReasoningFromContext",SHOW_RAW_OUTPUT_SWITCH:"showRawOutputSwitch",CUSTOM:"custom"},SETTINGS_SECTION_TITLES={GENERAL:"General",DISPLAY:"Display",SAMPLING:"Sampling",PENALTIES:"Penalties", +AGENTIC:"Agentic",TOOLS:"Tools",IMPORT_EXPORT:"Import/Export",DEVELOPER:"Developer"},SETTINGS_CHAT_SECTIONS=[{title:SETTINGS_SECTION_TITLES.GENERAL,slug:"general",icon:Sliders_vertical,fields:[{key:SETTINGS_KEYS.THEME,label:"Theme",type:SettingsFieldType.SELECT,options:SETTINGS_COLOR_MODES_CONFIG},{key:SETTINGS_KEYS.API_KEY,label:"API Key",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.SYSTEM_MESSAGE,label:"System Message",type:SettingsFieldType.TEXTAREA},{key:SETTINGS_KEYS.PASTE_LONG_TEXT_TO_FILE_LEN, +label:"Paste long text to file length",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.SEND_ON_ENTER,label:"Send message on Enter",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT,label:"Copy text attachments as plain text",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.ENABLE_CONTINUE_GENERATION,label:'Enable "Continue" button',type:SettingsFieldType.CHECKBOX,isExperimental:!0},{key:SETTINGS_KEYS.PDF_AS_IMAGE,label:"Parse PDF as image",type:SettingsFieldType. +CHECKBOX},{key:SETTINGS_KEYS.ASK_FOR_TITLE_CONFIRMATION,label:"Ask for confirmation before changing conversation title",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.TITLE_GENERATION_USE_FIRST_LINE,label:"Use first non-empty line for conversation title",type:SettingsFieldType.CHECKBOX}]},{title:SETTINGS_SECTION_TITLES.DISPLAY,slug:"display",icon:Monitor,fields:[{key:SETTINGS_KEYS.SHOW_MESSAGE_STATS,label:"Show message generation statistics",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS. +SHOW_THOUGHT_IN_PROGRESS,label:"Show thought in progress",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.SHOW_TOOL_CALL_IN_PROGRESS,label:"Show tool call in progress",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.KEEP_STATS_VISIBLE,label:"Keep stats visible after generation",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.AUTO_MIC_ON_EMPTY,label:"Show microphone on empty input",type:SettingsFieldType.CHECKBOX,isExperimental:!0},{key:SETTINGS_KEYS.RENDER_USER_CONTENT_AS_MARKDOWN,label:"\ +Render user content as Markdown",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.FULL_HEIGHT_CODE_BLOCKS,label:"Use full height code blocks",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.DISABLE_AUTO_SCROLL,label:"Disable automatic scroll",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.ALWAYS_SHOW_SIDEBAR_ON_DESKTOP,label:"Always show sidebar on desktop",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.SHOW_RAW_MODEL_NAMES,label:"Show raw model names",type:SettingsFieldType.CHECKBOX}, +{key:SETTINGS_KEYS.ALWAYS_SHOW_AGENTIC_TURNS,label:"Always show agentic turns in conversation",type:SettingsFieldType.CHECKBOX}]},{title:SETTINGS_SECTION_TITLES.SAMPLING,slug:"sampling",icon:Funnel,fields:[{key:SETTINGS_KEYS.TEMPERATURE,label:"Temperature",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DYNATEMP_RANGE,label:"Dynamic temperature range",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DYNATEMP_EXPONENT,label:"Dynamic temperature exponent",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS. +TOP_K,label:"Top K",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.TOP_P,label:"Top P",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.MIN_P,label:"Min P",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.XTC_PROBABILITY,label:"XTC probability",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.XTC_THRESHOLD,label:"XTC threshold",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.TYP_P,label:"Typical P",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.MAX_TOKENS,label:"Max tokens",type:SettingsFieldType. +INPUT},{key:SETTINGS_KEYS.SAMPLERS,label:"Samplers",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.BACKEND_SAMPLING,label:"Backend sampling",type:SettingsFieldType.CHECKBOX}]},{title:SETTINGS_SECTION_TITLES.PENALTIES,slug:"penalties",icon:Triangle_alert,fields:[{key:SETTINGS_KEYS.REPEAT_LAST_N,label:"Repeat last N",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.REPEAT_PENALTY,label:"Repeat penalty",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.PRESENCE_PENALTY,label:"Presence penalty",type:SettingsFieldType. +INPUT},{key:SETTINGS_KEYS.FREQUENCY_PENALTY,label:"Frequency penalty",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DRY_MULTIPLIER,label:"DRY multiplier",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DRY_BASE,label:"DRY base",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DRY_ALLOWED_LENGTH,label:"DRY allowed length",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.DRY_PENALTY_LAST_N,label:"DRY penalty last N",type:SettingsFieldType.INPUT}]},{title:SETTINGS_SECTION_TITLES.AGENTIC,slug:"a\ +gentic",icon:List_restart,fields:[{key:SETTINGS_KEYS.AGENTIC_MAX_TURNS,label:"Agentic turns",type:SettingsFieldType.INPUT},{key:SETTINGS_KEYS.AGENTIC_MAX_TOOL_PREVIEW_LINES,label:"Max lines per tool preview",type:SettingsFieldType.INPUT}]},{title:SETTINGS_SECTION_TITLES.TOOLS,slug:"tools",icon:Pencil_ruler},{title:SETTINGS_SECTION_TITLES.IMPORT_EXPORT,slug:"import-export",icon:Database},{title:SETTINGS_SECTION_TITLES.DEVELOPER,slug:"developer",icon:Code,fields:[{key:SETTINGS_KEYS.PRE_ENCODE_CONVERSATION, +label:"Pre-fill KV cache after response",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.DISABLE_REASONING_PARSING,label:"Disable reasoning content parsing",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.EXCLUDE_REASONING_FROM_CONTEXT,label:"Exclude reasoning from context",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.SHOW_RAW_OUTPUT_SWITCH,label:"Enable raw output toggle",type:SettingsFieldType.CHECKBOX},{key:SETTINGS_KEYS.CUSTOM,label:"Custom JSON",type:SettingsFieldType.TEXTAREA}]}]; +FileTypeAudio.MP3+"",FileExtensionAudio.MP3,MimeTypeAudio.MP3_MPEG,MimeTypeAudio.MP3,FileTypeAudio.WAV+"",FileExtensionAudio.WAV,MimeTypeAudio.WAV;FileTypeImage.JPEG+"",FileExtensionImage.JPG,FileExtensionImage.JPEG,MimeTypeImage.JPEG,FileTypeImage.PNG+"",FileExtensionImage.PNG,MimeTypeImage.PNG,FileTypeImage.GIF+"",FileExtensionImage.GIF,MimeTypeImage.GIF,FileTypeImage.WEBP+"",FileExtensionImage.WEBP,MimeTypeImage.WEBP,FileTypeImage.SVG+"",FileExtensionImage.SVG,MimeTypeImage.SVG;FileTypePdf.PDF+ +"",FileExtensionPdf.PDF,MimeTypeApplication.PDF;FileTypeText.PLAIN_TEXT+"",FileExtensionText.TXT,MimeTypeText.PLAIN,FileTypeText.MARKDOWN+"",FileExtensionText.MD,MimeTypeText.MARKDOWN,FileTypeText.ASCIIDOC+"",FileExtensionText.ADOC,MimeTypeText.ASCIIDOC,FileTypeText.JAVASCRIPT+"",FileExtensionText.JS,MimeTypeText.JAVASCRIPT,MimeTypeText.JAVASCRIPT_APP,FileTypeText.TYPESCRIPT+"",FileExtensionText.TS,MimeTypeText.TYPESCRIPT,FileTypeText.JSX+"",FileExtensionText.JSX,MimeTypeText.JSX,FileTypeText.TSX+ +"",FileExtensionText.TSX,MimeTypeText.TSX,FileTypeText.CSS+"",FileExtensionText.CSS,MimeTypeText.CSS,FileTypeText.HTML+"",FileExtensionText.HTML,FileExtensionText.HTM,MimeTypeText.HTML,FileTypeText.JSON+"",FileExtensionText.JSON,MimeTypeText.JSON,FileTypeText.XML+"",FileExtensionText.XML,MimeTypeText.XML_TEXT,MimeTypeText.XML_APP,FileTypeText.YAML+"",FileExtensionText.YAML,FileExtensionText.YML,MimeTypeText.YAML_TEXT,MimeTypeText.YAML_APP,FileTypeText.CSV+"",FileExtensionText.CSV,MimeTypeText.CSV, +FileTypeText.LOG+"",FileExtensionText.LOG,MimeTypeText.PLAIN,FileTypeText.PYTHON+"",FileExtensionText.PY,MimeTypeText.PYTHON,FileTypeText.JAVA+"",FileExtensionText.JAVA,MimeTypeText.JAVA,FileTypeText.CPP+"",FileExtensionText.CPP,FileExtensionText.C,FileExtensionText.H,FileExtensionText.HPP,MimeTypeText.CPP_SRC,MimeTypeText.CPP_HDR,MimeTypeText.C_SRC,MimeTypeText.C_HDR,FileTypeText.PHP+"",FileExtensionText.PHP,MimeTypeText.PHP,FileTypeText.RUBY+"",FileExtensionText.RB,MimeTypeText.RUBY,FileTypeText. +GO+"",FileExtensionText.GO,MimeTypeText.GO,FileTypeText.RUST+"",FileExtensionText.RS,MimeTypeText.RUST,FileTypeText.SHELL+"",FileExtensionText.SH,FileExtensionText.BAT,MimeTypeText.SHELL,MimeTypeText.BAT,FileTypeText.SQL+"",FileExtensionText.SQL,MimeTypeText.SQL,FileTypeText.R+"",FileExtensionText.R,MimeTypeText.R,FileTypeText.SCALA+"",FileExtensionText.SCALA,MimeTypeText.SCALA,FileTypeText.KOTLIN+"",FileExtensionText.KT,MimeTypeText.KOTLIN,FileTypeText.SWIFT+"",FileExtensionText.SWIFT,MimeTypeText. +SWIFT,FileTypeText.DART+"",FileExtensionText.DART,MimeTypeText.DART,FileTypeText.VUE+"",FileExtensionText.VUE,MimeTypeText.VUE,FileTypeText.SVELTE+"",FileExtensionText.SVELTE,MimeTypeText.SVELTE,FileTypeText.LATEX+"",FileExtensionText.TEX,MimeTypeText.LATEX,MimeTypeText.TEX,MimeTypeText.TEX_APP,FileTypeText.BIBTEX+"",FileExtensionText.BIB,MimeTypeText.BIBTEX,FileTypeText.CUDA+"",FileExtensionText.CU,FileExtensionText.CUH,MimeTypeText.CUDA,FileTypeText.VULKAN+"",FileExtensionText.COMP,MimeTypeText. +PLAIN,FileTypeText.HASKELL+"",FileExtensionText.HS,MimeTypeText.HASKELL,FileTypeText.CSHARP+"",FileExtensionText.CS,MimeTypeText.CSHARP,FileTypeText.PROPERTIES+"",FileExtensionText.PROPERTIES,MimeTypeText.PROPERTIES;const BR_PATTERN=/<br\s*\/?\s*>/gi,LIST_PATTERN=/^<ul>([\s\S]*)<\/ul>$/i,LI_PATTERN=/<li>([\s\S]*?)<\/li>/gi,TOOL_GROUP_LABELS={[ToolSource.BUILTIN]:"Built-in",[ToolSource.CUSTOM]:"JSON Schema"},TOOL_SERVER_LABELS={[ToolSource.BUILTIN]:"Built-in Tools",[ToolSource.CUSTOM]:"Custom Too\ +ls"},TOOLTIP_DELAY_DURATION=500;var root$1R=from_svg('<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 174 174" xmlns:xlink="http://www.w3.org/1999/xlink" fill="none" version="1.1"><g id="shape-320b5b95-d08d-8089-8007-585a8e498184"><defs><clipPath id="frame-clip-320b5b95-d08d-8089-8007-585a8e498184-render-1" class="frame-clip frame-clip-def"><rect rx="0" ry="0" x="0" y="0" width="174.00000000000045" height="174" transform="matrix(1.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000)"><\ +/rect></clipPath></defs><g class="frame-container-wrapper"><g class="frame-container-blur"><g class="frame-container-shadows"><g clip-path="url(#frame-clip-320b5b95-d08d-8089-8007-585a8e498184-render-1)" fill="none"><g class="fills" id="fills-320b5b95-d08d-8089-8007-585a8e498184"><rect rx="0" ry="0" x="0" y="0" width="174.00000000000045" height="174" transform="matrix(1.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000)" class="frame-background"></rect></g><g class="frame-children"><g id=\ +"shape-320b5b95-d08d-8089-8007-585a974337b1"><g class="fills" id="fills-320b5b95-d08d-8089-8007-585a974337b1"><path d="M15.5587158203125,81.5927734375L83.44091796875,13.7105712890625C92.813720703125,4.3380126953125,108.0096435546875,4.3380126953125,117.3817138671875,13.7105712890625L117.3817138671875,13.7105712890625C126.7547607421875,23.08306884765625,126.7547607421875,38.27911376953125,117.3817138671875,47.65167236328125L66.1168212890625,98.9169921875" fill="none" stroke-linecap="round" style=\ +"fill: none;"></path></g><g fill="none" stroke-linecap="round" id="strokes-b954dcef-3e3e-8015-8007-585acd4382b6-320b5b95-d08d-8089-8007-585a974337b1" class="strokes"><g class="stroke-shape"><path d="M15.5587158203125,81.5927734375L83.44091796875,13.7105712890625C92.813720703125,4.3380126953125,108.0096435546875,4.3380126953125,117.3817138671875,13.7105712890625L117.3817138671875,13.7105712890625C126.7547607421875,23.08306884765625,126.7547607421875,38.27911376953125,117.3817138671875,47.65167236\ +328125L66.1168212890625,98.9169921875" style="fill: none; stroke-width: 12; stroke: currentColor; stroke-opacity: 1;"></path></g></g></g><g id="shape-320b5b95-d08d-8089-8007-585a974337b2"><g class="fills" id="fills-320b5b95-d08d-8089-8007-585a974337b2"><path d="M66.5587158203125,98.26885986328125L117.1165771484375,47.7105712890625C126.489501953125,38.3380126953125,141.6854248046875,38.3380126953125,151.0584716796875,47.7105712890625L151.4114990234375,48.0640869140625C160.7845458984375,57.4367065\ +4296875,160.7845458984375,72.6326904296875,151.4114990234375,82.00518798828125L90.018310546875,143.39886474609375C86.8941650390625,146.52288818359375,86.8941650390625,151.587890625,90.018310546875,154.71185302734375L102.62451171875,167.31890869140625" fill="none" stroke-linecap="round" style="fill: none;"></path></g><g fill="none" stroke-linecap="round" id="strokes-b954dcef-3e3e-8015-8007-585acd447743-320b5b95-d08d-8089-8007-585a974337b2" class="strokes"><g class="stroke-shape"><path d="M66.5587\ +158203125,98.26885986328125L117.1165771484375,47.7105712890625C126.489501953125,38.3380126953125,141.6854248046875,38.3380126953125,151.0584716796875,47.7105712890625L151.4114990234375,48.0640869140625C160.7845458984375,57.43670654296875,160.7845458984375,72.6326904296875,151.4114990234375,82.00518798828125L90.018310546875,143.39886474609375C86.8941650390625,146.52288818359375,86.8941650390625,151.587890625,90.018310546875,154.71185302734375L102.62451171875,167.31890869140625" style="fill: none;\ + stroke-width: 12; stroke: currentColor; stroke-opacity: 1;"></path></g></g></g><g id="shape-320b5b95-d08d-8089-8007-585a974337b3"><g class="fills" id="fills-320b5b95-d08d-8089-8007-585a974337b3"><path d="M99.79296875,30.68115234375L49.588134765625,80.8857421875C40.215576171875,90.258056640625,40.215576171875,105.45404052734375,49.588134765625,114.82708740234375L49.588134765625,114.82708740234375C58.9608154296875,124.19903564453125,74.1566162109375,124.19903564453125,83.529296875,114.82708740234\ +375L133.7340087890625,64.62225341796875" fill="none" stroke-linecap="round" style="fill: none;"></path></g><g fill="none" stroke-linecap="round" id="strokes-b954dcef-3e3e-8015-8007-585acd44c5c9-320b5b95-d08d-8089-8007-585a974337b3" class="strokes"><g class="stroke-shape"><path d="M99.79296875,30.68115234375L49.588134765625,80.8857421875C40.215576171875,90.258056640625,40.215576171875,105.45404052734375,49.588134765625,114.82708740234375L49.588134765625,114.82708740234375C58.9608154296875,124.199\ +03564453125,74.1566162109375,124.19903564453125,83.529296875,114.82708740234375L133.7340087890625,64.62225341796875" style="fill: none; stroke-width: 12; stroke: currentColor; stroke-opacity: 1;"></path></g></g></g></g></g></g></g></g></g></svg>');function McpLogo($$anchor,$$props){let className=prop($$props,"class",3,""),style2=prop($$props,"style",3,"");var svg2=root$1R();template_effect(()=>{set_class(svg2,0,clsx(className())),set_style(svg2,style2())}),append($$anchor,svg2)}const FORK_TREE_DEPTH_PADDING=8, +SYSTEM_MESSAGE_PLACEHOLDER="System message",APP_NAME="llama.cpp",ICON_STRIP_TRANSITION_DURATION=150,ICON_STRIP_TRANSITION_DELAY_MULTIPLIER=50,SIDEBAR_ACTIONS_ITEMS=[{icon:Square_pen,tooltip:"New chat",route:"?new_chat=true#/",keys:["shift","cmd","o"]},{icon:Search,tooltip:"Search",keys:["cmd","k"]},{icon:McpLogo,tooltip:"MCP Servers",route:"#/settings/mcp",activeRouteId:"/settings/mcp"},{icon:Settings$1,tooltip:"Settings",route:"#/settings/chat/general",activeRoutePrefix:"/settings/chat"}],URI_SCHEME_SEPARATOR="\ +://",TEMPLATE_EXPRESSION_REGEX=/\{([+#./;?&]?)([^}]+)\}/g,URI_TEMPLATE_OPERATORS={RESERVED:"+",FRAGMENT:"#",PATH_SEGMENT:"/",LABEL:".",PATH_PARAM:";",FORM_QUERY:"?",FORM_CONTINUATION:"&"},URI_TEMPLATE_SEPARATORS={COMMA:",",SLASH:"/",PERIOD:".",SEMICOLON:";",QUERY_PREFIX:"?",QUERY_CONTINUATION:"&"},VARIABLE_EXPLODE_MODIFIER_REGEX=/[*]$/,VARIABLE_PREFIX_MODIFIER_REGEX=/:[\d]+$/,LEADING_SLASHES_REGEX=/^\/+/,DEFAULT_MOBILE_BREAKPOINT=768;class IsMobile extends MediaQuery{constructor(breakpoint=DEFAULT_MOBILE_BREAKPOINT){ +super(`max-width: ${breakpoint-1}px`)}}const SYNCABLE_PARAMETERS=[{key:"temperature",serverKey:"temperature",type:SyncableParameterType.NUMBER,canSync:!0},{key:"top_k",serverKey:"top_k",type:SyncableParameterType.NUMBER,canSync:!0},{key:"top_p",serverKey:"top_p",type:SyncableParameterType.NUMBER,canSync:!0},{key:"min_p",serverKey:"min_p",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dynatemp_range",serverKey:"dynatemp_range",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dynatemp_expo\ +nent",serverKey:"dynatemp_exponent",type:SyncableParameterType.NUMBER,canSync:!0},{key:"xtc_probability",serverKey:"xtc_probability",type:SyncableParameterType.NUMBER,canSync:!0},{key:"xtc_threshold",serverKey:"xtc_threshold",type:SyncableParameterType.NUMBER,canSync:!0},{key:"typ_p",serverKey:"typ_p",type:SyncableParameterType.NUMBER,canSync:!0},{key:"repeat_last_n",serverKey:"repeat_last_n",type:SyncableParameterType.NUMBER,canSync:!0},{key:"repeat_penalty",serverKey:"repeat_penalty",type:SyncableParameterType. +NUMBER,canSync:!0},{key:"presence_penalty",serverKey:"presence_penalty",type:SyncableParameterType.NUMBER,canSync:!0},{key:"frequency_penalty",serverKey:"frequency_penalty",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dry_multiplier",serverKey:"dry_multiplier",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dry_base",serverKey:"dry_base",type:SyncableParameterType.NUMBER,canSync:!0},{key:"dry_allowed_length",serverKey:"dry_allowed_length",type:SyncableParameterType.NUMBER,canSync:!0}, +{key:"dry_penalty_last_n",serverKey:"dry_penalty_last_n",type:SyncableParameterType.NUMBER,canSync:!0},{key:"max_tokens",serverKey:"max_tokens",type:SyncableParameterType.NUMBER,canSync:!0},{key:"samplers",serverKey:"samplers",type:SyncableParameterType.STRING,canSync:!0},{key:"backend_sampling",serverKey:"backend_sampling",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"pasteLongTextToFileLen",serverKey:"pasteLongTextToFileLen",type:SyncableParameterType.NUMBER,canSync:!0},{key:"pdfAsImage", +serverKey:"pdfAsImage",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"showThoughtInProgress",serverKey:"showThoughtInProgress",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"keepStatsVisible",serverKey:"keepStatsVisible",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"showMessageStats",serverKey:"showMessageStats",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"askForTitleConfirmation",serverKey:"askForTitleConfirmation",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"\ +titleGenerationUseFirstLine",serverKey:"titleGenerationUseFirstLine",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"disableAutoScroll",serverKey:"disableAutoScroll",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"renderUserContentAsMarkdown",serverKey:"renderUserContentAsMarkdown",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"autoMicOnEmpty",serverKey:"autoMicOnEmpty",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"pyInterpreterEnabled",serverKey:"pyInterpreterEnabled",type:SyncableParameterType. +BOOLEAN,canSync:!0},{key:"enableContinueGeneration",serverKey:"enableContinueGeneration",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"fullHeightCodeBlocks",serverKey:"fullHeightCodeBlocks",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"systemMessage",serverKey:"systemMessage",type:SyncableParameterType.STRING,canSync:!0},{key:"showSystemMessage",serverKey:"showSystemMessage",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"theme",serverKey:"theme",type:SyncableParameterType.STRING, +canSync:!0},{key:"copyTextAttachmentsAsPlainText",serverKey:"copyTextAttachmentsAsPlainText",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"showRawOutputSwitch",serverKey:"showRawOutputSwitch",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"alwaysShowSidebarOnDesktop",serverKey:"alwaysShowSidebarOnDesktop",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"showRawModelNames",serverKey:"showRawModelNames",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"mcpServers",serverKey:"mcp\ +Servers",type:SyncableParameterType.STRING,canSync:!0},{key:"agenticMaxTurns",serverKey:"agenticMaxTurns",type:SyncableParameterType.NUMBER,canSync:!0},{key:"agenticMaxToolPreviewLines",serverKey:"agenticMaxToolPreviewLines",type:SyncableParameterType.NUMBER,canSync:!0},{key:"showToolCallInProgress",serverKey:"showToolCallInProgress",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"alwaysShowAgenticTurns",serverKey:"alwaysShowAgenticTurns",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"\ +excludeReasoningFromContext",serverKey:"excludeReasoningFromContext",type:SyncableParameterType.BOOLEAN,canSync:!0},{key:"sendOnEnter",serverKey:"sendOnEnter",type:SyncableParameterType.BOOLEAN,canSync:!0}];class ParameterSyncService{static roundFloatingPoint(value){return normalizeFloatingPoint(value)}static extractServerDefaults(serverParams,webuiSettings){const extracted={};if(serverParams){for(const param of SYNCABLE_PARAMETERS)if(param.canSync&¶m.serverKey in serverParams){const value=serverParams[param. +serverKey];value!==void 0&&(extracted[param.key]=this.roundFloatingPoint(value))}serverParams.samplers&&Array.isArray(serverParams.samplers)&&(extracted.samplers=serverParams.samplers.join(";"))}if(webuiSettings){for(const param of SYNCABLE_PARAMETERS)if(param.canSync&¶m.serverKey in webuiSettings){const value=webuiSettings[param.serverKey];value!==void 0&&(extracted[param.key]=this.roundFloatingPoint(value))}}return extracted}static mergeWithServerDefaults(currentSettings,serverDefaults,userOverrides=new Set){ +const merged={...currentSettings};for(const[key2,serverValue]of Object.entries(serverDefaults))userOverrides.has(key2)||(merged[key2]=this.roundFloatingPoint(serverValue));return merged}static getParameterInfo(key2,currentValue,propsDefaults,userOverrides){const hasPropsDefault=propsDefaults[key2]!==void 0,isUserOverride=userOverrides.has(key2),source2=isUserOverride?ParameterSource.CUSTOM:ParameterSource.DEFAULT;return{value:currentValue,source:source2,serverDefault:hasPropsDefault?propsDefaults[key2]: +void 0,userOverride:isUserOverride?currentValue:void 0}}static canSyncParameter(key2){return SYNCABLE_PARAMETERS.some(param=>param.key===key2&¶m.canSync)}static getSyncableParameterKeys(){return SYNCABLE_PARAMETERS.filter(param=>param.canSync).map(param=>param.key)}static validateServerParameter(key2,value){const param=SYNCABLE_PARAMETERS.find(p2=>p2.key===key2);if(!param)return!1;switch(param.type){case SyncableParameterType.NUMBER:return typeof value=="number"&&!isNaN(value);case SyncableParameterType. +STRING:return typeof value=="string";case SyncableParameterType.BOOLEAN:return typeof value=="boolean";default:return!1}}static createParameterDiff(currentSettings,serverDefaults){const diff2={};for(const key2 of this.getSyncableParameterKeys()){const currentValue=currentSettings[key2],serverValue=serverDefaults[key2];serverValue!==void 0&&(diff2[key2]={current:currentValue,server:serverValue,differs:currentValue!==serverValue})}return diff2}}class PropsService{static async fetch(autoload=!1){const params={}; +return autoload||(params.autoload="false"),apiFetchWithParams("./props",params,{authOnly:!0})}static async fetchForModel(modelId,autoload=!1){const params={model:modelId};return autoload||(params.autoload="false"),apiFetchWithParams("./props",params,{authOnly:!0})}}class ServerStore{#props=state$1(null);get props(){return get$3(this.#props)}set props(value){set$1(this.#props,value,!0)}#loading=state$1(!1);get loading(){return get$3(this.#loading)}set loading(value){set$1(this.#loading,value,!0)}#error=state$1( +null);get error(){return get$3(this.#error)}set error(value){set$1(this.#error,value,!0)}#role=state$1(null);get role(){return get$3(this.#role)}set role(value){set$1(this.#role,value,!0)}fetchPromise=null;get defaultParams(){return this.props?.default_generation_settings?.params||null}get contextSize(){const nCtx=this.props?.default_generation_settings?.n_ctx;return typeof nCtx=="number"?nCtx:null}get webuiSettings(){return this.props?.webui_settings}get isRouterMode(){return this.role===ServerRole. +ROUTER}get isModelMode(){return this.role===ServerRole.MODEL}async fetch(){if(this.fetchPromise)return this.fetchPromise;this.loading=!0,this.error=null;const fetchPromise=(async()=>{try{const props=await PropsService.fetch();this.props=props,this.error=null,this.detectRole(props)}catch(error2){this.error=this.getErrorMessage(error2),console.error("Error fetching server properties:",error2)}finally{this.loading=!1,this.fetchPromise=null}})();this.fetchPromise=fetchPromise,await fetchPromise}getErrorMessage(error2){ +if(error2 instanceof Error){const message=error2.message||"";if(error2.name==="TypeError"&&message.includes("fetch"))return"Server is not running or unreachable";if(message.includes("ECONNREFUSED"))return"Connection refused - server may be offline";if(message.includes("ENOTFOUND"))return"Server not found - check server address";if(message.includes("ETIMEDOUT"))return"Request timed out";if(message.includes("503"))return"Server temporarily unavailable";if(message.includes("500"))return"Server erro\ +r - check server logs";if(message.includes("404"))return"Server endpoint not found";if(message.includes("403")||message.includes("401"))return"Access denied"}return"Failed to connect to server"}clear(){this.props=null,this.error=null,this.loading=!1,this.role=null,this.fetchPromise=null}detectRole(props){const newRole=props?.role===ServerRole.ROUTER?ServerRole.ROUTER:ServerRole.MODEL;this.role!==newRole&&(this.role=newRole,console.info(`Server running in ${newRole===ServerRole.ROUTER?"ROUTER":"M\ +ODEL"} mode`))}}const serverStore=new ServerStore,serverProps=()=>serverStore.props,serverLoading=()=>serverStore.loading,serverError=()=>serverStore.error,contextSize=()=>serverStore.contextSize,isRouterMode=()=>serverStore.isRouterMode;class SettingsStore{#config=state$1(proxy({...SETTING_CONFIG_DEFAULT}));get config(){return get$3(this.#config)}set config(value){set$1(this.#config,value,!0)}#theme=state$1("auto");get theme(){return get$3(this.#theme)}set theme(value){set$1(this.#theme,value,!0)}#isInitialized=state$1( +!1);get isInitialized(){return get$3(this.#isInitialized)}set isInitialized(value){set$1(this.#isInitialized,value,!0)}#userOverrides=state$1(proxy(new Set));get userOverrides(){return get$3(this.#userOverrides)}set userOverrides(value){set$1(this.#userOverrides,value,!0)}getServerDefaults(){const serverParams=serverStore.defaultParams,webuiSettings=serverStore.webuiSettings;return ParameterSyncService.extractServerDefaults(serverParams,webuiSettings)}constructor(){this.initialize()}initialize(){ +try{this.loadConfig(),this.loadTheme(),this.isInitialized=!0}catch(error2){console.error("Failed to initialize settings store:",error2)}}loadConfig(){try{const storedConfigRaw=localStorage.getItem(CONFIG_LOCALSTORAGE_KEY),savedVal=JSON.parse(storedConfigRaw||"{}");this.config={...SETTING_CONFIG_DEFAULT,...savedVal},"sendOnEnter"in savedVal||new IsMobile().current&&(this.config.sendOnEnter=!1);const savedOverrides=JSON.parse(localStorage.getItem(USER_OVERRIDES_LOCALSTORAGE_KEY)||"[]");this.userOverrides= +new Set(savedOverrides)}catch(error2){console.warn("Failed to parse config from localStorage, using defaults:",error2),this.config={...SETTING_CONFIG_DEFAULT},this.userOverrides=new Set}}loadTheme(){this.theme=localStorage.getItem("theme")||"auto"}updateConfig(key2,value){if(this.config[key2]=value,ParameterSyncService.canSyncParameter(key2)){const propsDefault=this.getServerDefaults()[key2];if(propsDefault!==void 0){const normalizedValue=normalizeFloatingPoint(value),normalizedDefault=normalizeFloatingPoint( +propsDefault);normalizedValue===normalizedDefault?this.userOverrides.delete(key2):this.userOverrides.add(key2)}}this.saveConfig()}updateMultipleConfig(updates){Object.assign(this.config,updates);const propsDefaults=this.getServerDefaults();for(const[key2,value]of Object.entries(updates))if(ParameterSyncService.canSyncParameter(key2)){const propsDefault=propsDefaults[key2];if(propsDefault!==void 0){const normalizedValue=normalizeFloatingPoint(value),normalizedDefault=normalizeFloatingPoint(propsDefault); +normalizedValue===normalizedDefault?this.userOverrides.delete(key2):this.userOverrides.add(key2)}}this.saveConfig()}saveConfig(){try{localStorage.setItem(CONFIG_LOCALSTORAGE_KEY,JSON.stringify(this.config)),localStorage.setItem(USER_OVERRIDES_LOCALSTORAGE_KEY,JSON.stringify(Array.from(this.userOverrides)))}catch(error2){console.error("Failed to save config to localStorage:",error2)}}updateTheme(newTheme){this.theme=newTheme,this.saveTheme()}saveTheme(){try{this.theme==="auto"?localStorage.removeItem( +"theme"):localStorage.setItem("theme",this.theme)}catch(error2){console.error("Failed to save theme to localStorage:",error2)}}resetConfig(){this.config={...SETTING_CONFIG_DEFAULT},this.saveConfig()}resetTheme(){this.theme="auto",this.saveTheme()}resetAll(){this.resetConfig(),this.resetTheme()}resetParameterToServerDefault(key2){const serverDefaults=this.getServerDefaults(),webuiSettings=serverStore.webuiSettings;webuiSettings&&key2 in webuiSettings?setConfigValue(this.config,key2,webuiSettings[key2]): +serverDefaults[key2]!==void 0?setConfigValue(this.config,key2,""):key2 in SETTING_CONFIG_DEFAULT&&setConfigValue(this.config,key2,getConfigValue(SETTING_CONFIG_DEFAULT,key2)),this.userOverrides.delete(key2),this.saveConfig()}syncWithServerDefaults(){const propsDefaults=this.getServerDefaults();if(Object.keys(propsDefaults).length===0)return;const webuiSettings=serverStore.webuiSettings,webuiSettingsKeys=new Set(webuiSettings?Object.keys(webuiSettings):[]);for(const[key2,propsValue]of Object.entries( +propsDefaults)){const currentValue=getConfigValue(this.config,key2),normalizedCurrent=normalizeFloatingPoint(currentValue),normalizedDefault=normalizeFloatingPoint(propsValue);normalizedCurrent===normalizedDefault&&(this.userOverrides.delete(key2),!webuiSettingsKeys.has(key2)&&getConfigValue(SETTING_CONFIG_DEFAULT,key2)===void 0&&setConfigValue(this.config,key2,void 0))}if(webuiSettings)for(const[key2,value]of Object.entries(webuiSettings))!this.userOverrides.has(key2)&&value!==void 0&&setConfigValue( +this.config,key2,value);this.saveConfig(),console.log("User overrides after sync:",Array.from(this.userOverrides))}forceSyncWithServerDefaults(){const propsDefaults=this.getServerDefaults(),webuiSettings=serverStore.webuiSettings;for(const key2 of ParameterSyncService.getSyncableParameterKeys())webuiSettings&&key2 in webuiSettings?setConfigValue(this.config,key2,webuiSettings[key2]):propsDefaults[key2]!==void 0?setConfigValue(this.config,key2,""):key2 in SETTING_CONFIG_DEFAULT&&setConfigValue(this. +config,key2,getConfigValue(SETTING_CONFIG_DEFAULT,key2)),this.userOverrides.delete(key2);this.saveConfig()}getConfig(key2){return this.config[key2]}getAllConfig(){return{...this.config}}canSyncParameter(key2){return ParameterSyncService.canSyncParameter(key2)}getParameterInfo(key2){const propsDefaults=this.getServerDefaults(),currentValue=getConfigValue(this.config,key2);return ParameterSyncService.getParameterInfo(key2,currentValue??"",propsDefaults,this.userOverrides)}getParameterDiff(){const serverDefaults=this. +getServerDefaults();if(Object.keys(serverDefaults).length===0)return{};const configAsRecord=configToParameterRecord(this.config,ParameterSyncService.getSyncableParameterKeys());return ParameterSyncService.createParameterDiff(configAsRecord,serverDefaults)}clearAllUserOverrides(){this.userOverrides.clear(),this.saveConfig(),console.log("Cleared all user overrides")}}const settingsStore=new SettingsStore,config$1=()=>settingsStore.config;function redactValue(value,showLastChars){return showLastChars? +`....${value.slice(-showLastChars)}`:"[redacted]"}function getAuthHeaders(){const apiKey=config$1().apiKey?.toString().trim();return apiKey?{Authorization:`Bearer ${apiKey}`}:{}}function getJsonHeaders(){return{"Content-Type":"application/json",...getAuthHeaders()}}function sanitizeHeaders(headers,extraRedactedHeaders,partialRedactHeaders){if(!headers)return{};const normalized=new Headers(headers),sanitized={},redactedHeaders=new Set(Array.from(extraRedactedHeaders??[],header=>header.toLowerCase())); +for(const[key2,value]of normalized.entries()){const normalizedKey=key2.toLowerCase(),partialChars=partialRedactHeaders?.get(normalizedKey);partialChars!==void 0?sanitized[key2]=redactValue(value,partialChars):REDACTED_HEADERS.has(normalizedKey)||redactedHeaders.has(normalizedKey)?sanitized[key2]=redactValue(value):sanitized[key2]=value}return sanitized}async function apiFetch(path2,options={}){const{authOnly=!1,headers:customHeaders,...fetchOptions}=options,headers={...authOnly?getAuthHeaders(): +getJsonHeaders(),...customHeaders},url2=path2.startsWith(UrlProtocol.HTTP)||path2.startsWith(UrlProtocol.HTTPS)?path2:`${base}${path2}`,response=await fetch(url2,{...fetchOptions,headers});if(!response.ok){const errorMessage=await parseErrorMessage(response);throw new Error(errorMessage)}return response.json()}async function apiFetchWithParams(basePath,params,options={}){const url2=new URL(basePath,window.location.href);for(const[key2,value]of Object.entries(params))value!=null&&url2.searchParams. +set(key2,value);const{authOnly=!1,headers:customHeaders,...fetchOptions}=options,headers={...authOnly?getAuthHeaders():getJsonHeaders(),...customHeaders},response=await fetch(url2.toString(),{...fetchOptions,headers});if(!response.ok){const errorMessage=await parseErrorMessage(response);throw new Error(errorMessage)}return response.json()}async function apiPost(path2,body2,options={}){return apiFetch(path2,{method:"POST",body:JSON.stringify(body2),...options})}async function parseErrorMessage(response){ +try{const errorData=await response.json();if(errorData?.error?.message)return errorData.error.message;if(errorData?.error&&typeof errorData.error=="string")return errorData.error;if(errorData?.message)return errorData.message}catch{}return`Request failed: ${response.status} ${response.statusText}`}function error(status,body2){throw new HttpError(status,body2)}async function validateApiKey(fetch2){try{const apiKey=config$1().apiKey,headers={"Content-Type":"application/json"};apiKey&&(headers.Authorization= +`Bearer ${apiKey}`);const response=await fetch2(`${base}/props`,{headers});if(!response.ok){if(response.status===401||response.status===403)throw error(401,"Access denied");console.warn(`Server responded with status ${response.status} during API key validation`);return}}catch(err){if(err&&typeof err=="object"&&"status"in err)throw err;console.warn("Cannot connect to server for API key validation:",err)}}function isMcpPrompt(item){return!!(item.attachment?.type===AttachmentType.MCP_PROMPT||item.uploadedFile?. +type===SpecialFileType.MCP_PROMPT&&item.uploadedFile.mcpPrompt)}function isMcpResource(item){return item.attachment?.type===AttachmentType.MCP_RESOURCE}function getUploadedFileCategory$1(file){const categoryByMime=getFileTypeCategory(file.type);return categoryByMime||getFileTypeCategoryByExtension(file.name)}function getAttachmentDisplayItems(options){const{uploadedFiles=[],attachments=[]}=options,items2=[];for(const file of uploadedFiles)items2.push({id:file.id,name:file.name,size:file.size,preview:file. +preview,isImage:getUploadedFileCategory$1(file)===FileTypeCategory.IMAGE,isLoading:file.isLoading,loadError:file.loadError,uploadedFile:file,textContent:file.textContent});for(const[index2,attachment]of attachments.entries()){const isImage2=isImageFile(attachment);items2.push({id:`attachment-${index2}`,name:attachment.name,size:"size"in attachment?attachment.size:void 0,preview:isImage2&&"base64Url"in attachment?attachment.base64Url:void 0,isImage:isImage2,attachment,attachmentIndex:index2,textContent:"\ +content"in attachment?attachment.content:void 0})}return items2.reverse()}function getUploadedFileCategory(uploadedFile){const categoryByMime=getFileTypeCategory(uploadedFile.type);return categoryByMime||getFileTypeCategoryByExtension(uploadedFile.name)}function isTextFile(attachment,uploadedFile){return uploadedFile?getUploadedFileCategory(uploadedFile)===FileTypeCategory.TEXT:attachment?attachment.type===AttachmentType.TEXT||attachment.type===AttachmentType.LEGACY_CONTEXT:!1}function isImageFile(attachment,uploadedFile){ +return uploadedFile?getUploadedFileCategory(uploadedFile)===FileTypeCategory.IMAGE:attachment?attachment.type===AttachmentType.IMAGE:!1}function isPdfFile$1(attachment,uploadedFile){return uploadedFile?getUploadedFileCategory(uploadedFile)===FileTypeCategory.PDF:attachment?attachment.type===AttachmentType.PDF:!1}function isAudioFile(attachment,uploadedFile){return uploadedFile?getUploadedFileCategory(uploadedFile)===FileTypeCategory.AUDIO:attachment?attachment.type===AttachmentType.AUDIO:!1}function autoResizeTextarea(textareaElement){ +textareaElement&&(textareaElement.style.height="1rem",textareaElement.style.height=textareaElement.scrollHeight+"px")}function findMessageById(messages,id2){if(id2)return messages.find(m=>m.id===id2)}function filterByLeafNodeId(messages,leafNodeId,includeRoot=!1){const result=[],nodeMap=new Map;for(const msg of messages)nodeMap.set(msg.id,msg);let startNode=nodeMap.get(leafNodeId);if(!startNode){let latestTime=-1;for(const msg of messages)msg.timestamp>latestTime&&(startNode=msg,latestTime=msg.timestamp)} +let currentNode=startNode;for(;currentNode&&((currentNode.type!=="root"||includeRoot)&&result.push(currentNode),currentNode.parent!==null);)currentNode=nodeMap.get(currentNode.parent);return result.sort((a,b)=>a.role===MessageRole.SYSTEM&&b.role!==MessageRole.SYSTEM?-1:a.role!==MessageRole.SYSTEM&&b.role===MessageRole.SYSTEM?1:a.timestamp-b.timestamp),result}function findLeafNode(messages,messageId){const nodeMap=new Map;for(const msg of messages)nodeMap.set(msg.id,msg);let currentNode=nodeMap.get( +messageId);for(;currentNode&¤tNode.children.length>0;){const lastChildId=currentNode.children[currentNode.children.length-1];currentNode=nodeMap.get(lastChildId)}return currentNode?.id??messageId}function findDescendantMessages(messages,messageId){const nodeMap=new Map;for(const msg of messages)nodeMap.set(msg.id,msg);const descendants=[],queue=[messageId];for(;queue.length>0;){const currentId=queue.shift(),currentNode=nodeMap.get(currentId);if(currentNode)for(const childId of currentNode. +children)descendants.push(childId),queue.push(childId)}return descendants}function getMessageSiblings(messages,messageId){const nodeMap=new Map;for(const msg of messages)nodeMap.set(msg.id,msg);const message=nodeMap.get(messageId);if(!message)return null;if(message.parent===null)return{message,siblingIds:[messageId],currentIndex:0,totalSiblings:1};const parentNode=nodeMap.get(message.parent);if(!parentNode)return{message,siblingIds:[messageId],currentIndex:0,totalSiblings:1};const siblingIds=parentNode. +children,siblingLeafIds=siblingIds.map(siblingId=>findLeafNode(messages,siblingId)),currentIndex=siblingIds.indexOf(messageId);return{message,siblingIds:siblingLeafIds,currentIndex,totalSiblings:siblingIds.length}}var core$5,hasRequiredCore$4;function requireCore$4(){if(hasRequiredCore$4)return core$5;hasRequiredCore$4=1;function deepFreeze(obj){return obj instanceof Map?obj.clear=obj.delete=obj.set=function(){throw new Error("map is read-only")}:obj instanceof Set&&(obj.add=obj.clear=obj.delete= +function(){throw new Error("set is read-only")}),Object.freeze(obj),Object.getOwnPropertyNames(obj).forEach(name=>{const prop2=obj[name],type2=typeof prop2;(type2==="object"||type2==="function")&&!Object.isFrozen(prop2)&&deepFreeze(prop2)}),obj}class Response2{constructor(mode){mode.data===void 0&&(mode.data={}),this.data=mode.data,this.isMatchIgnored=!1}ignoreMatch(){this.isMatchIgnored=!0}}function escapeHTML(value){return value.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace( +/"/g,""").replace(/'/g,"'")}function inherit$1(original,...objects){const result=Object.create(null);for(const key2 in original)result[key2]=original[key2];return objects.forEach(function(obj){for(const key2 in obj)result[key2]=obj[key2]}),result}const SPAN_CLOSE="</span>",emitsWrappingTags=node2=>!!node2.scope,scopeToCSSClass=(name,{prefix})=>{if(name.startsWith("language:"))return name.replace("language:","language-");if(name.includes(".")){const pieces=name.split(".");return[`${prefix}${pieces. +shift()}`,...pieces.map((x,i)=>`${x}${"_".repeat(i+1)}`)].join(" ")}return`${prefix}${name}`};class HTMLRenderer{constructor(parseTree3,options){this.buffer="",this.classPrefix=options.classPrefix,parseTree3.walk(this)}addText(text2){this.buffer+=escapeHTML(text2)}openNode(node2){if(!emitsWrappingTags(node2))return;const className=scopeToCSSClass(node2.scope,{prefix:this.classPrefix});this.span(className)}closeNode(node2){emitsWrappingTags(node2)&&(this.buffer+=SPAN_CLOSE)}value(){return this.buffer}span(className){ +this.buffer+=`<span class="${className}">`}}const newNode=(opts={})=>{const result={children:[]};return Object.assign(result,opts),result};class TokenTree{constructor(){this.rootNode=newNode(),this.stack=[this.rootNode]}get top(){return this.stack[this.stack.length-1]}get root(){return this.rootNode}add(node2){this.top.children.push(node2)}openNode(scope2){const node2=newNode({scope:scope2});this.add(node2),this.stack.push(node2)}closeNode(){if(this.stack.length>1)return this.stack.pop()}closeAllNodes(){ +for(;this.closeNode(););}toJSON(){return JSON.stringify(this.rootNode,null,4)}walk(builder){return this.constructor._walk(builder,this.rootNode)}static _walk(builder,node2){return typeof node2=="string"?builder.addText(node2):node2.children&&(builder.openNode(node2),node2.children.forEach(child2=>this._walk(builder,child2)),builder.closeNode(node2)),builder}static _collapse(node2){typeof node2!="string"&&node2.children&&(node2.children.every(el=>typeof el=="string")?node2.children=[node2.children. +join("")]:node2.children.forEach(child2=>{TokenTree._collapse(child2)}))}}class TokenTreeEmitter extends TokenTree{constructor(options){super(),this.options=options}addText(text2){text2!==""&&this.add(text2)}startScope(scope2){this.openNode(scope2)}endScope(){this.closeNode()}__addSublanguage(emitter,name){const node2=emitter.root;name&&(node2.scope=`language:${name}`),this.add(node2)}toHTML(){return new HTMLRenderer(this,this.options).value()}finalize(){return this.closeAllNodes(),!0}}function source2(re2){ +return re2?typeof re2=="string"?re2:re2.source:null}function lookahead2(re2){return concat2("(?=",re2,")")}function anyNumberOfTimes(re2){return concat2("(?:",re2,")*")}function optional2(re2){return concat2("(?:",re2,")?")}function concat2(...args){return args.map(x=>source2(x)).join("")}function stripOptionsFromArgs2(args){const opts=args[args.length-1];return typeof opts=="object"&&opts.constructor===Object?(args.splice(args.length-1,1),opts):{}}function either2(...args){return"("+(stripOptionsFromArgs2( +args).capture?"":"?:")+args.map(x=>source2(x)).join("|")+")"}function countMatchGroups(re2){return new RegExp(re2.toString()+"|").exec("").length-1}function startsWith(re2,lexeme){const match=re2&&re2.exec(lexeme);return match&&match.index===0}const BACKREF_RE=/\[(?:[^\\\]]|\\.)*\]|\(\??|\\([1-9][0-9]*)|\\./;function _rewriteBackreferences(regexps,{joinWith}){let numCaptures=0;return regexps.map(regex=>{numCaptures+=1;const offset2=numCaptures;let re2=source2(regex),out="";for(;re2.length>0;){const match=BACKREF_RE. +exec(re2);if(!match){out+=re2;break}out+=re2.substring(0,match.index),re2=re2.substring(match.index+match[0].length),match[0][0]==="\\"&&match[1]?out+="\\"+String(Number(match[1])+offset2):(out+=match[0],match[0]==="("&&numCaptures++)}return out}).map(re2=>`(${re2})`).join(joinWith)}const MATCH_NOTHING_RE=/\b\B/,IDENT_RE2="[a-zA-Z]\\w*",UNDERSCORE_IDENT_RE="[a-zA-Z_]\\w*",NUMBER_RE="\\b\\d+(\\.\\d+)?",C_NUMBER_RE="(-?)(\\b0[xX][a-fA-F0-9]+|(\\b\\d+(\\.\\d*)?|\\.\\d+)([eE][-+]?\\d+)?)",BINARY_NUMBER_RE="\ +\\b(0b[01]+)",RE_STARTERS_RE="!|!=|!==|%|%=|&|&&|&=|\\*|\\*=|\\+|\\+=|,|-|-=|/=|/|:|;|<<|<<=|<=|<|===|==|=|>>>=|>>=|>=|>>>|>>|>|\\?|\\[|\\{|\\(|\\^|\\^=|\\||\\|=|\\|\\||~",SHEBANG=(opts={})=>{const beginShebang=/^#![ ]*\//;return opts.binary&&(opts.begin=concat2(beginShebang,/.*\b/,opts.binary,/\b.*/)),inherit$1({scope:"meta",begin:beginShebang,end:/$/,relevance:0,"on:begin":(m,resp)=>{m.index!==0&&resp.ignoreMatch()}},opts)},BACKSLASH_ESCAPE={begin:"\\\\[\\s\\S]",relevance:0},APOS_STRING_MODE={ +scope:"string",begin:"'",end:"'",illegal:"\\n",contains:[BACKSLASH_ESCAPE]},QUOTE_STRING_MODE={scope:"string",begin:'"',end:'"',illegal:"\\n",contains:[BACKSLASH_ESCAPE]},PHRASAL_WORDS_MODE={begin:/\b(a|an|the|are|I'm|isn't|don't|doesn't|won't|but|just|should|pretty|simply|enough|gonna|going|wtf|so|such|will|you|your|they|like|more)\b/},COMMENT=function(begin,end,modeOptions={}){const mode=inherit$1({scope:"comment",begin,end,contains:[]},modeOptions);mode.contains.push({scope:"doctag",begin:"[ \ +]*(?=(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):)",end:/(TODO|FIXME|NOTE|BUG|OPTIMIZE|HACK|XXX):/,excludeBegin:!0,relevance:0});const ENGLISH_WORD=either2("I","a","is","so","us","to","at","if","in","it","on",/[A-Za-z]+['](d|ve|re|ll|t|s|n)/,/[A-Za-z]+[-][a-z]+/,/[A-Za-z][a-z]{2,}/);return mode.contains.push({begin:concat2(/[ ]+/,"(",ENGLISH_WORD,/[.]?[:]?([.][ ]|[ ])/,"){3}")}),mode},C_LINE_COMMENT_MODE=COMMENT("//","$"),C_BLOCK_COMMENT_MODE=COMMENT("/\\*","\\*/"),HASH_COMMENT_MODE=COMMENT("#","$"), +NUMBER_MODE={scope:"number",begin:NUMBER_RE,relevance:0},C_NUMBER_MODE={scope:"number",begin:C_NUMBER_RE,relevance:0},BINARY_NUMBER_MODE={scope:"number",begin:BINARY_NUMBER_RE,relevance:0},REGEXP_MODE={scope:"regexp",begin:/\/(?=[^/\n]*\/)/,end:/\/[gimuy]*/,contains:[BACKSLASH_ESCAPE,{begin:/\[/,end:/\]/,relevance:0,contains:[BACKSLASH_ESCAPE]}]},TITLE_MODE={scope:"title",begin:IDENT_RE2,relevance:0},UNDERSCORE_TITLE_MODE={scope:"title",begin:UNDERSCORE_IDENT_RE,relevance:0},METHOD_GUARD={begin:"\ +\\.\\s*"+UNDERSCORE_IDENT_RE,relevance:0};var MODES2=Object.freeze({__proto__:null,APOS_STRING_MODE,BACKSLASH_ESCAPE,BINARY_NUMBER_MODE,BINARY_NUMBER_RE,COMMENT,C_BLOCK_COMMENT_MODE,C_LINE_COMMENT_MODE,C_NUMBER_MODE,C_NUMBER_RE,END_SAME_AS_BEGIN:function(mode){return Object.assign(mode,{"on:begin":(m,resp)=>{resp.data._beginMatch=m[1]},"on:end":(m,resp)=>{resp.data._beginMatch!==m[1]&&resp.ignoreMatch()}})},HASH_COMMENT_MODE,IDENT_RE:IDENT_RE2,MATCH_NOTHING_RE,METHOD_GUARD,NUMBER_MODE,NUMBER_RE, +PHRASAL_WORDS_MODE,QUOTE_STRING_MODE,REGEXP_MODE,RE_STARTERS_RE,SHEBANG,TITLE_MODE,UNDERSCORE_IDENT_RE,UNDERSCORE_TITLE_MODE});function skipIfHasPrecedingDot(match,response){match.input[match.index-1]==="."&&response.ignoreMatch()}function scopeClassName(mode,_parent){mode.className!==void 0&&(mode.scope=mode.className,delete mode.className)}function beginKeywords(mode,parent){parent&&mode.beginKeywords&&(mode.begin="\\b("+mode.beginKeywords.split(" ").join("|")+")(?!\\.)(?=\\b|\\s)",mode.__beforeBegin= +skipIfHasPrecedingDot,mode.keywords=mode.keywords||mode.beginKeywords,delete mode.beginKeywords,mode.relevance===void 0&&(mode.relevance=0))}function compileIllegal(mode,_parent){Array.isArray(mode.illegal)&&(mode.illegal=either2(...mode.illegal))}function compileMatch(mode,_parent){if(mode.match){if(mode.begin||mode.end)throw new Error("begin & end are not supported with match");mode.begin=mode.match,delete mode.match}}function compileRelevance(mode,_parent){mode.relevance===void 0&&(mode.relevance= +1)}const beforeMatchExt=(mode,parent)=>{if(!mode.beforeMatch)return;if(mode.starts)throw new Error("beforeMatch cannot be used with starts");const originalMode=Object.assign({},mode);Object.keys(mode).forEach(key2=>{delete mode[key2]}),mode.keywords=originalMode.keywords,mode.begin=concat2(originalMode.beforeMatch,lookahead2(originalMode.begin)),mode.starts={relevance:0,contains:[Object.assign(originalMode,{endsParent:!0})]},mode.relevance=0,delete originalMode.beforeMatch},COMMON_KEYWORDS=["of", +"and","for","in","not","or","if","then","parent","list","value"],DEFAULT_KEYWORD_SCOPE="keyword";function compileKeywords(rawKeywords,caseInsensitive,scopeName=DEFAULT_KEYWORD_SCOPE){const compiledKeywords=Object.create(null);return typeof rawKeywords=="string"?compileList(scopeName,rawKeywords.split(" ")):Array.isArray(rawKeywords)?compileList(scopeName,rawKeywords):Object.keys(rawKeywords).forEach(function(scopeName2){Object.assign(compiledKeywords,compileKeywords(rawKeywords[scopeName2],caseInsensitive, +scopeName2))}),compiledKeywords;function compileList(scopeName2,keywordList){caseInsensitive&&(keywordList=keywordList.map(x=>x.toLowerCase())),keywordList.forEach(function(keyword2){const pair=keyword2.split("|");compiledKeywords[pair[0]]=[scopeName2,scoreForKeyword(pair[0],pair[1])]})}}function scoreForKeyword(keyword2,providedScore){return providedScore?Number(providedScore):commonKeyword(keyword2)?0:1}function commonKeyword(keyword2){return COMMON_KEYWORDS.includes(keyword2.toLowerCase())}const seenDeprecations={}, +error2=message=>{console.error(message)},warn2=(message,...args)=>{console.log(`WARN: ${message}`,...args)},deprecated2=(version3,message)=>{seenDeprecations[`${version3}/${message}`]||(console.log(`Deprecated as of ${version3}. ${message}`),seenDeprecations[`${version3}/${message}`]=!0)},MultiClassError=new Error;function remapScopeNames(mode,regexes,{key:key2}){let offset2=0;const scopeNames=mode[key2],emit={},positions={};for(let i=1;i<=regexes.length;i++)positions[i+offset2]=scopeNames[i],emit[i+ +offset2]=!0,offset2+=countMatchGroups(regexes[i-1]);mode[key2]=positions,mode[key2]._emit=emit,mode[key2]._multi=!0}function beginMultiClass(mode){if(Array.isArray(mode.begin)){if(mode.skip||mode.excludeBegin||mode.returnBegin)throw error2("skip, excludeBegin, returnBegin not compatible with beginScope: {}"),MultiClassError;if(typeof mode.beginScope!="object"||mode.beginScope===null)throw error2("beginScope must be object"),MultiClassError;remapScopeNames(mode,mode.begin,{key:"beginScope"}),mode. +begin=_rewriteBackreferences(mode.begin,{joinWith:""})}}function endMultiClass(mode){if(Array.isArray(mode.end)){if(mode.skip||mode.excludeEnd||mode.returnEnd)throw error2("skip, excludeEnd, returnEnd not compatible with endScope: {}"),MultiClassError;if(typeof mode.endScope!="object"||mode.endScope===null)throw error2("endScope must be object"),MultiClassError;remapScopeNames(mode,mode.end,{key:"endScope"}),mode.end=_rewriteBackreferences(mode.end,{joinWith:""})}}function scopeSugar(mode){mode. +scope&&typeof mode.scope=="object"&&mode.scope!==null&&(mode.beginScope=mode.scope,delete mode.scope)}function MultiClass(mode){scopeSugar(mode),typeof mode.beginScope=="string"&&(mode.beginScope={_wrap:mode.beginScope}),typeof mode.endScope=="string"&&(mode.endScope={_wrap:mode.endScope}),beginMultiClass(mode),endMultiClass(mode)}function compileLanguage(language2){function langRe(value,global2){return new RegExp(source2(value),"m"+(language2.case_insensitive?"i":"")+(language2.unicodeRegex?"u": +"")+(global2?"g":""))}class MultiRegex{constructor(){this.matchIndexes={},this.regexes=[],this.matchAt=1,this.position=0}addRule(re2,opts){opts.position=this.position++,this.matchIndexes[this.matchAt]=opts,this.regexes.push([opts,re2]),this.matchAt+=countMatchGroups(re2)+1}compile(){this.regexes.length===0&&(this.exec=()=>null);const terminators=this.regexes.map(el=>el[1]);this.matcherRe=langRe(_rewriteBackreferences(terminators,{joinWith:"|"}),!0),this.lastIndex=0}exec(s2){this.matcherRe.lastIndex= +this.lastIndex;const match=this.matcherRe.exec(s2);if(!match)return null;const i=match.findIndex((el,i2)=>i2>0&&el!==void 0),matchData=this.matchIndexes[i];return match.splice(0,i),Object.assign(match,matchData)}}class ResumableMultiRegex{constructor(){this.rules=[],this.multiRegexes=[],this.count=0,this.lastIndex=0,this.regexIndex=0}getMatcher(index2){if(this.multiRegexes[index2])return this.multiRegexes[index2];const matcher=new MultiRegex;return this.rules.slice(index2).forEach(([re2,opts])=>matcher. +addRule(re2,opts)),matcher.compile(),this.multiRegexes[index2]=matcher,matcher}resumingScanAtSamePosition(){return this.regexIndex!==0}considerAll(){this.regexIndex=0}addRule(re2,opts){this.rules.push([re2,opts]),opts.type==="begin"&&this.count++}exec(s2){const m=this.getMatcher(this.regexIndex);m.lastIndex=this.lastIndex;let result=m.exec(s2);if(this.resumingScanAtSamePosition()&&!(result&&result.index===this.lastIndex)){const m2=this.getMatcher(0);m2.lastIndex=this.lastIndex+1,result=m2.exec(s2)} +return result&&(this.regexIndex+=result.position+1,this.regexIndex===this.count&&this.considerAll()),result}}function buildModeRegex(mode){const mm=new ResumableMultiRegex;return mode.contains.forEach(term=>mm.addRule(term.begin,{rule:term,type:"begin"})),mode.terminatorEnd&&mm.addRule(mode.terminatorEnd,{type:"end"}),mode.illegal&&mm.addRule(mode.illegal,{type:"illegal"}),mm}function compileMode(mode,parent){const cmode=mode;if(mode.isCompiled)return cmode;[scopeClassName,compileMatch,MultiClass, +beforeMatchExt].forEach(ext=>ext(mode,parent)),language2.compilerExtensions.forEach(ext=>ext(mode,parent)),mode.__beforeBegin=null,[beginKeywords,compileIllegal,compileRelevance].forEach(ext=>ext(mode,parent)),mode.isCompiled=!0;let keywordPattern=null;return typeof mode.keywords=="object"&&mode.keywords.$pattern&&(mode.keywords=Object.assign({},mode.keywords),keywordPattern=mode.keywords.$pattern,delete mode.keywords.$pattern),keywordPattern=keywordPattern||/\w+/,mode.keywords&&(mode.keywords=compileKeywords( +mode.keywords,language2.case_insensitive)),cmode.keywordPatternRe=langRe(keywordPattern,!0),parent&&(mode.begin||(mode.begin=/\B|\b/),cmode.beginRe=langRe(cmode.begin),!mode.end&&!mode.endsWithParent&&(mode.end=/\B|\b/),mode.end&&(cmode.endRe=langRe(cmode.end)),cmode.terminatorEnd=source2(cmode.end)||"",mode.endsWithParent&&parent.terminatorEnd&&(cmode.terminatorEnd+=(mode.end?"|":"")+parent.terminatorEnd)),mode.illegal&&(cmode.illegalRe=langRe(mode.illegal)),mode.contains||(mode.contains=[]),mode. +contains=[].concat(...mode.contains.map(function(c2){return expandOrCloneMode(c2==="self"?mode:c2)})),mode.contains.forEach(function(c2){compileMode(c2,cmode)}),mode.starts&&compileMode(mode.starts,parent),cmode.matcher=buildModeRegex(cmode),cmode}if(language2.compilerExtensions||(language2.compilerExtensions=[]),language2.contains&&language2.contains.includes("self"))throw new Error("ERR: contains `self` is not supported at the top-level of a language. See documentation.");return language2.classNameAliases= +inherit$1(language2.classNameAliases||{}),compileMode(language2)}function dependencyOnParent(mode){return mode?mode.endsWithParent||dependencyOnParent(mode.starts):!1}function expandOrCloneMode(mode){return mode.variants&&!mode.cachedVariants&&(mode.cachedVariants=mode.variants.map(function(variant){return inherit$1(mode,{variants:null},variant)})),mode.cachedVariants?mode.cachedVariants:dependencyOnParent(mode)?inherit$1(mode,{starts:mode.starts?inherit$1(mode.starts):null}):Object.isFrozen(mode)? +inherit$1(mode):mode}var version2="11.11.1";class HTMLInjectionError extends Error{constructor(reason,html2){super(reason),this.name="HTMLInjectionError",this.html=html2}}const escape2=escapeHTML,inherit=inherit$1,NO_MATCH=Symbol("nomatch"),MAX_KEYWORD_HITS=7,HLJS=function(hljs){const languages=Object.create(null),aliases=Object.create(null),plugins=[];let SAFE_MODE=!0;const LANGUAGE_NOT_FOUND="Could not find the language '{}', did you forget to load/include a language module?",PLAINTEXT_LANGUAGE={ +disableAutodetect:!0,name:"Plain text",contains:[]};let options={ignoreUnescapedHTML:!1,throwUnescapedHTML:!1,noHighlightRe:/^(no-?highlight)$/i,languageDetectRe:/\blang(?:uage)?-([\w-]+)\b/i,classPrefix:"hljs-",cssSelector:"pre code",languages:null,__emitter:TokenTreeEmitter};function shouldNotHighlight(languageName){return options.noHighlightRe.test(languageName)}function blockLanguage(block2){let classes=block2.className+" ";classes+=block2.parentNode?block2.parentNode.className:"";const match=options. +languageDetectRe.exec(classes);if(match){const language2=getLanguage(match[1]);return language2||(warn2(LANGUAGE_NOT_FOUND.replace("{}",match[1])),warn2("Falling back to no-highlight mode for this block.",block2)),language2?match[1]:"no-highlight"}return classes.split(/\s+/).find(_class=>shouldNotHighlight(_class)||getLanguage(_class))}function highlight2(codeOrLanguageName,optionsOrCode,ignoreIllegals){let code2="",languageName="";typeof optionsOrCode=="object"?(code2=codeOrLanguageName,ignoreIllegals= +optionsOrCode.ignoreIllegals,languageName=optionsOrCode.language):(deprecated2("10.7.0","highlight(lang, code, ...args) has been deprecated."),deprecated2("10.7.0",`Please use highlight(code, options) instead. https://github.com/highlightjs/highlight.js/issues/2277`),languageName=codeOrLanguageName,code2=optionsOrCode),ignoreIllegals===void 0&&(ignoreIllegals=!0);const context={code:code2,language:languageName};fire("before:highlight",context);const result=context.result?context.result:_highlight(context.language,context.code,ignoreIllegals);return result.code=context.code,fire("after:highlight",result),result}function _highlight(languageName,codeToHighlight,ignoreIllegals,continuation){const keywordHits=Object. create(null);function keywordData(mode,matchText){return mode.keywords[matchText]}function processKeywords(){if(!top.keywords){emitter.addText(modeBuffer);return}let lastIndex=0;top.keywordPatternRe.lastIndex=0;let match=top.keywordPatternRe.exec(modeBuffer),buf="";for(;match;){buf+=modeBuffer.substring(lastIndex,match.index);const word=language2.case_insensitive?match[0].toLowerCase():match[0],data=keywordData(top,word);if(data){const[kind,keywordRelevance]=data;if(emitter.addText(buf),buf="",keywordHits[word]= (keywordHits[word]||0)+1,keywordHits[word]<=MAX_KEYWORD_HITS&&(relevance+=keywordRelevance),kind.startsWith("_"))buf+=match[0];else{const cssClass=language2.classNameAliases[kind]||kind;emitKeyword(match[0],cssClass)}}else buf+=match[0];lastIndex=top.keywordPatternRe.lastIndex,match=top.keywordPatternRe.exec(modeBuffer)}buf+=modeBuffer.substring(lastIndex),emitter.addText(buf)}function processSubLanguage(){if(modeBuffer==="")return;let result2=null;if(typeof top.subLanguage=="string"){if(!languages[top. diff --git a/tools/server/webui/src/lib/constants/settings-sections.ts b/tools/server/webui/src/lib/constants/settings-sections.ts index 1f2964c0e..d88638ce6 100644 --- a/tools/server/webui/src/lib/constants/settings-sections.ts +++ b/tools/server/webui/src/lib/constants/settings-sections.ts @@ -65,6 +65,11 @@ export const SETTINGS_CHAT_SECTIONS: SettingsSection[] = [ label: 'Paste long text to file length', type: SettingsFieldType.INPUT }, + { + key: SETTINGS_KEYS.SEND_ON_ENTER, + label: 'Send message on Enter', + type: SettingsFieldType.CHECKBOX + }, { key: SETTINGS_KEYS.COPY_TEXT_ATTACHMENTS_AS_PLAIN_TEXT, label: 'Copy text attachments as plain text', @@ -85,6 +90,11 @@ export const SETTINGS_CHAT_SECTIONS: SettingsSection[] = [ key: SETTINGS_KEYS.ASK_FOR_TITLE_CONFIRMATION, label: 'Ask for confirmation before changing conversation title', type: SettingsFieldType.CHECKBOX + }, + { + key: SETTINGS_KEYS.TITLE_GENERATION_USE_FIRST_LINE, + label: 'Use first non-empty line for conversation title', + type: SettingsFieldType.CHECKBOX } ] }, @@ -297,6 +307,11 @@ export const SETTINGS_CHAT_SECTIONS: SettingsSection[] = [ slug: 'developer', icon: Code, fields: [ + { + key: SETTINGS_KEYS.PRE_ENCODE_CONVERSATION, + label: 'Pre-fill KV cache after response', + type: SettingsFieldType.CHECKBOX + }, { key: SETTINGS_KEYS.DISABLE_REASONING_PARSING, label: 'Disable reasoning content parsing',