Skip to content

Commit

Permalink
Clean-up code
Browse files Browse the repository at this point in the history
  • Loading branch information
captainbrosset committed Jul 17, 2024
1 parent 5751180 commit 5fbcb33
Show file tree
Hide file tree
Showing 10 changed files with 179 additions and 288 deletions.
4 changes: 3 additions & 1 deletion on-device-ai/chat.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,11 @@ async function submitRequest(e) {

if (continuation) {
input = context + " " + input;
} else {
input = `<|system|>\nYou are a friendly assistant.<|end|>\n<|user|>\n${input}<|end|>\n<|assistant|>\n`;
}

Query(continuation, input, (word) => {
Query(input, (word) => {
responseDiv.innerHTML = marked.parse(word);
})
.then(() => {
Expand Down
4 changes: 2 additions & 2 deletions on-device-ai/check_coc.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Init, Query, Abort } from "./main.js";
import { Init, Query, Abort } from "./model.js";

const CoC = `
Participation in the community must be a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.
Expand Down Expand Up @@ -85,7 +85,7 @@ async function startApp() {
e.preventDefault();
const prompt = PROMPT.replace("[COMMENT]", descriptionEl.value);
let data = "";
Query(true, prompt, (word) => {
Query(prompt, (word) => {
data = word;
console.log(word);
if (word.includes("<|END|>")) {
Expand Down
22 changes: 6 additions & 16 deletions on-device-ai/dist/chat.js

Large diffs are not rendered by default.

22 changes: 6 additions & 16 deletions on-device-ai/dist/check_coc.js

Large diffs are not rendered by default.

22 changes: 6 additions & 16 deletions on-device-ai/dist/form_assistant.js

Large diffs are not rendered by default.

22 changes: 6 additions & 16 deletions on-device-ai/dist/issue_tagging.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions on-device-ai/form_assistant.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Init, Query, Abort } from "./main.js";
import { Init, Query, Abort } from "./model.js";

const PROMPT = `Extract personal contact information from text, and produce a structured JSON output.
Expand Down Expand Up @@ -61,7 +61,7 @@ async function startApp() {

const prompt = PROMPT.replace("[INFO]", assistant.value);
let data = "";
Query(true, prompt, (word) => {
Query(prompt, (word) => {
data = word;
if (word.includes("}")) {
Abort();
Expand Down
4 changes: 2 additions & 2 deletions on-device-ai/issue_tagging.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Init, Query, Abort } from "./main.js";
import { Init, Query, Abort } from "./model.js";

const descriptionEl = document.getElementById("description");
const form = document.getElementById("form");
Expand Down Expand Up @@ -80,7 +80,7 @@ async function startApp() {
e.preventDefault();
const prompt = PROMPT.replace("[COMMENT]", descriptionEl.value);
let data = "";
Query(true, prompt, (word) => {
Query(prompt, (word) => {
data = word;
console.log(word);
if (word.includes("<|END|>")) {
Expand Down
212 changes: 0 additions & 212 deletions on-device-ai/main.js

This file was deleted.

Loading

0 comments on commit 5fbcb33

Please sign in to comment.