Skip to content

Commit

Permalink
chore: make clean debug logging
Browse files Browse the repository at this point in the history
  • Loading branch information
PleahMaCaka committed Nov 2, 2023
1 parent 1f7f66c commit 883e5d7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 16 deletions.
17 changes: 9 additions & 8 deletions src/lib/client/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import axios from "axios"
import { Client as LLM } from "booga.js"
import { get } from "svelte/store"

export class Client {
export const client = new class Client {

private _modelUrl: string = get(stateStore).url.model
private _serverUrl: string = get(stateStore).url.server
Expand Down Expand Up @@ -59,9 +59,9 @@ export class Client {
// TODO get char/inst/preset from settings and/or env vars
public async send(
msg: string,
char: string = "Commander V3",
inst: string = "Commander V3",
preset: string = "Commander V3"
char: string = "Commander",
inst: string = "Commander",
preset: string = "Commander"
) {
this.updateModelUrl()

Expand All @@ -77,8 +77,6 @@ export class Client {
preset: preset,
mode: "chat-instruct"
}).then(async (res) => {
if (get(stateStore).debug)
console.log("Response: ", res)
await this.removeLastHistory()
await this.appendHistory(Author.Assistant, res)
})
Expand All @@ -89,6 +87,9 @@ export class Client {

return await this._axios.get(`${this._serverUrl}/service/weather`).then(res => res.data)
}
}

export const client = new Client()
public async translateToKr(content: string): Promise<string> {
return await this._axios.post(`${this._serverUrl}/service/translate/toKr`, content).then(res => res.data)
}

}
20 changes: 12 additions & 8 deletions src/lib/components/chat/messages/AssistantMessage.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -63,15 +63,19 @@
feature = getFeature(command)
// debug and last processing stuffs
if (get(stateStore).debug)
console.log("Assisting!", {
message,
commands: raw_commands,
args,
command,
"feature": feature,
})
executed = true
if (get(stateStore).debug)
if (message === "...") console.log("Waiting for response...")
else {
console.log("Assisting!", {
message,
commands: raw_commands,
args,
command,
"feature": feature,
})
}
})
</script>

Expand Down

0 comments on commit 883e5d7

Please sign in to comment.