Skip to content

Commit

Permalink
Deploying to gh-pages from @ fa2cf3b 🚀
Browse files Browse the repository at this point in the history
  • Loading branch information
norpadon committed Sep 2, 2024
1 parent e335b64 commit 157ef05
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
8 changes: 6 additions & 2 deletions _modules/wanga/models/messages.html
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ <h1>Source code for wanga.models.messages</h1><div class="highlight"><pre>
<span class="n">open_tag</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">escape</span><span class="p">(</span><span class="n">tags</span><span class="o">.</span><span class="n">open</span><span class="p">)</span>
<span class="n">close_tag</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">escape</span><span class="p">(</span><span class="n">tags</span><span class="o">.</span><span class="n">close</span><span class="p">)</span>
<span class="n">tag_regex</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;(</span><span class="si">{</span><span class="n">open_tag</span><span class="si">}</span><span class="s2">.*</span><span class="si">{</span><span class="n">close_tag</span><span class="si">}</span><span class="s2">)&quot;</span><span class="p">)</span>
<span class="n">full_regex</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;(^</span><span class="si">{</span><span class="n">open_tag</span><span class="si">}{</span><span class="n">_HEADER_BODY_REGEX_STR</span><span class="si">}{</span><span class="n">close_tag</span><span class="si">}</span><span class="s2">$)&quot;</span><span class="p">)</span>
<span class="n">full_regex</span> <span class="o">=</span> <span class="n">re</span><span class="o">.</span><span class="n">compile</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;(^</span><span class="si">{</span><span class="n">open_tag</span><span class="si">}{</span><span class="n">inner_regex</span><span class="si">}{</span><span class="n">close_tag</span><span class="si">}</span><span class="s2">$)&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">HeaderRegexes</span><span class="p">(</span><span class="n">tag_regex</span><span class="p">,</span> <span class="n">full_regex</span><span class="p">)</span>


Expand Down Expand Up @@ -327,7 +327,11 @@ <h1>Source code for wanga.models.messages</h1><div class="highlight"><pre>
<span class="n">tool_invocations</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">_parse_tool_invocation</span><span class="p">(</span><span class="n">block_header</span><span class="p">,</span> <span class="n">arg_str</span><span class="p">))</span>
<span class="k">if</span> <span class="n">tool_invocations</span> <span class="ow">and</span> <span class="n">content</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
<span class="n">content</span> <span class="o">=</span> <span class="n">content</span><span class="o">.</span><span class="n">removesuffix</span><span class="p">(</span><span class="s2">&quot;</span><span class="se">\n</span><span class="s2">&quot;</span><span class="p">)</span>
<span class="k">return</span> <span class="n">AssistantMessage</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">header</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;name&quot;</span><span class="p">),</span> <span class="n">content</span><span class="o">=</span><span class="n">content</span><span class="p">,</span> <span class="n">tool_invocations</span><span class="o">=</span><span class="n">tool_invocations</span><span class="p">)</span>
<span class="k">return</span> <span class="n">AssistantMessage</span><span class="p">(</span>
<span class="n">name</span><span class="o">=</span><span class="n">header</span><span class="o">.</span><span class="n">params</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;name&quot;</span><span class="p">),</span>
<span class="n">content</span><span class="o">=</span><span class="n">content</span><span class="p">,</span>
<span class="n">tool_invocations</span><span class="o">=</span><span class="n">tool_invocations</span><span class="p">,</span>
<span class="p">)</span>
<span class="k">case</span> <span class="s2">&quot;tool&quot;</span><span class="p">:</span>
<span class="n">content</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">_map_headers_to_content</span><span class="p">(</span><span class="n">message_blocks</span><span class="p">))</span>
<span class="k">return</span> <span class="n">ToolMessage</span><span class="p">(</span><span class="n">invocation_id</span><span class="o">=</span><span class="n">header</span><span class="o">.</span><span class="n">params</span><span class="p">[</span><span class="s2">&quot;id&quot;</span><span class="p">],</span> <span class="n">content</span><span class="o">=</span><span class="n">content</span><span class="p">)</span>
Expand Down
7 changes: 4 additions & 3 deletions _static/searchtools.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ const Search = {

htmlToText: (htmlString, anchor) => {
const htmlElement = new DOMParser().parseFromString(htmlString, 'text/html');
for (const removalQuery of [".headerlinks", "script", "style"]) {
for (const removalQuery of [".headerlink", "script", "style"]) {
htmlElement.querySelectorAll(removalQuery).forEach((el) => { el.remove() });
}
if (anchor) {
Expand Down Expand Up @@ -328,13 +328,14 @@ const Search = {
for (const [title, foundTitles] of Object.entries(allTitles)) {
if (title.toLowerCase().trim().includes(queryLower) && (queryLower.length >= title.length/2)) {
for (const [file, id] of foundTitles) {
let score = Math.round(100 * queryLower.length / title.length)
const score = Math.round(Scorer.title * queryLower.length / title.length);
const boost = titles[file] === title ? 1 : 0; // add a boost for document titles
normalResults.push([
docNames[file],
titles[file] !== title ? `${titles[file]} > ${title}` : title,
id !== null ? "#" + id : "",
null,
score,
score + boost,
filenames[file],
]);
}
Expand Down
2 changes: 1 addition & 1 deletion searchindex.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 157ef05

Please sign in to comment.