Skip to content

Commit

Permalink
set default font back to Droid Sans, start work on customizer, make s…
Browse files Browse the repository at this point in the history
…tatuses more user-friendly
  • Loading branch information
kercre123 committed Jun 24, 2024
1 parent ec0d60e commit 4bce4be
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 19 deletions.
3 changes: 3 additions & 0 deletions chipper/pkg/vars/vars.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import (
"github.com/wlynxg/anet"
)

var CommitSHA string

// initialize variables so they don't have to be found during runtime

var VarsInited bool
Expand Down Expand Up @@ -146,6 +148,7 @@ func join(p1, p2 string) string {
}

func Init() {
logger.Println("Commit SHA: " + CommitSHA)
if VarsInited {
logger.Println("Not initting vars again")
return
Expand Down
20 changes: 13 additions & 7 deletions chipper/pkg/wirepod/config-ws/webserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ func apiHandler(w http.ResponseWriter, r *http.Request) {
handleGetVersionInfo(w)
case "generate_certs":
handleGenerateCerts(w)
case "get_chipper_commit":
handleGetChipperCommit(w)
default:
http.Error(w, "not found", http.StatusNotFound)
}
Expand All @@ -96,7 +98,7 @@ func handleAddCustomIntent(w http.ResponseWriter, r *http.Request) {
vars.CustomIntentsExist = true
vars.CustomIntents = append(vars.CustomIntents, intent)
saveCustomIntents()
fmt.Fprint(w, "intent added successfully")
fmt.Fprint(w, "Intent added successfully.")
}

func handleEditCustomIntent(w http.ResponseWriter, r *http.Request) {
Expand Down Expand Up @@ -139,7 +141,7 @@ func handleEditCustomIntent(w http.ResponseWriter, r *http.Request) {
}
intent.IsSystemIntent = false
saveCustomIntents()
fmt.Fprint(w, "intent edited successfully")
fmt.Fprint(w, "Intent edited successfully.")
}

func handleGetCustomIntentsJSON(w http.ResponseWriter) {
Expand Down Expand Up @@ -171,7 +173,7 @@ func handleRemoveCustomIntent(w http.ResponseWriter, r *http.Request) {
}
vars.CustomIntents = append(vars.CustomIntents[:request.Number-1], vars.CustomIntents[request.Number:]...)
saveCustomIntents()
fmt.Fprint(w, "intent removed successfully")
fmt.Fprint(w, "Intent removed successfully.")
}

func handleSetWeatherAPI(w http.ResponseWriter, r *http.Request) {
Expand All @@ -191,7 +193,7 @@ func handleSetWeatherAPI(w http.ResponseWriter, r *http.Request) {
vars.APIConfig.Weather.Provider = config.Provider
}
vars.WriteConfigToDisk()
fmt.Fprint(w, "changes successfully applied")
fmt.Fprint(w, "Changes successfully applied.")
}

func handleGetWeatherAPI(w http.ResponseWriter) {
Expand All @@ -206,7 +208,7 @@ func handleSetKGAPI(w http.ResponseWriter, r *http.Request) {
return
}
vars.WriteConfigToDisk()
fmt.Fprint(w, "changes successfully applied")
fmt.Fprint(w, "Changes successfully applied.")
}

func handleGetKGAPI(w http.ResponseWriter) {
Expand All @@ -229,7 +231,7 @@ func handleSetSTTInfo(w http.ResponseWriter, r *http.Request) {
}
if !isDownloadedLanguage(request.Language, vars.DownloadedVoskModels) {
go localization.DownloadVoskModel(request.Language)
fmt.Fprint(w, "downloading language model")
fmt.Fprint(w, "downloading language model...")
return
}
} else if vars.APIConfig.STT.Service == "whisper.cpp" {
Expand All @@ -246,7 +248,7 @@ func handleSetSTTInfo(w http.ResponseWriter, r *http.Request) {
vars.WriteConfigToDisk()
processreqs.ReloadVosk()
logger.Println("Reloaded voice processor successfully")
fmt.Fprint(w, "language switched successfully")
fmt.Fprint(w, "Language switched successfully.")
}

func handleGetDownloadStatus(w http.ResponseWriter) {
Expand Down Expand Up @@ -357,6 +359,10 @@ func handleGenerateCerts(w http.ResponseWriter) {
fmt.Fprint(w, "done")
}

func handleGetChipperCommit(w http.ResponseWriter) {

}

func saveCustomIntents() {
customIntentJSONFile, _ := json.Marshal(vars.CustomIntents)
os.WriteFile(vars.CustomIntentsPath, customIntentJSONFile, 0644)
Expand Down
17 changes: 10 additions & 7 deletions chipper/start.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/bin/bash

UNAME=$(uname -a)
COMMIT_HASH="$(git rev-parse --short HEAD)"

if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root. sudo ./start.sh"
Expand Down Expand Up @@ -34,30 +35,32 @@ if [[ ${USE_INBUILT_BLE} == "true" ]]; then
GOTAGS="${GOTAGS},inbuiltble"
fi

export GOLDFLAGS="-X 'github.com/kercre123/wire-pod/chipper/pkg/vars.CommitSHA=${COMMIT_HASH}'"

#./chipper
if [[ ${STT_SERVICE} == "leopard" ]]; then
if [[ -f ./chipper ]]; then
./chipper
else
/usr/local/go/bin/go run -tags $GOTAGS cmd/leopard/main.go
/usr/local/go/bin/go run -tags $GOTAGS -ldflags="${GOLDFLAGS}" cmd/leopard/main.go
fi
elif [[ ${STT_SERVICE} == "rhino" ]]; then
if [[ -f ./chipper ]]; then
./chipper
else
/usr/local/go/bin/go run -tags $GOTAGS cmd/experimental/rhino/main.go
/usr/local/go/bin/go run -tags $GOTAGS -ldflags="${GOLDFLAGS}" cmd/experimental/rhino/main.go
fi
elif [[ ${STT_SERVICE} == "houndify" ]]; then
if [[ -f ./chipper ]]; then
./chipper
else
/usr/local/go/bin/go run -tags $GOTAGS cmd/experimental/houndify/main.go
/usr/local/go/bin/go run -tags $GOTAGS -ldflags="${GOLDFLAGS}" cmd/experimental/houndify/main.go
fi
elif [[ ${STT_SERVICE} == "whisper" ]]; then
if [[ -f ./chipper ]]; then
./chipper
else
/usr/local/go/bin/go run -tags $GOTAGS cmd/experimental/whisper/main.go
/usr/local/go/bin/go run -tags $GOTAGS -ldflags="${GOLDFLAGS}" cmd/experimental/whisper/main.go
fi
elif [[ ${STT_SERVICE} == "whisper.cpp" ]]; then
if [[ -f ./chipper ]]; then
Expand All @@ -77,7 +80,7 @@ if [[ ${STT_SERVICE} == "leopard" ]]; then
export GGML_METAL_PATH_RESOURCES="../whisper.cpp"
/usr/local/go/bin/go run -tags $GOTAGS -ldflags "-extldflags '-framework Foundation -framework Metal -framework MetalKit'" cmd/experimental/whisper.cpp/main.go
else
/usr/local/go/bin/go run -tags $GOTAGS cmd/experimental/whisper.cpp/main.go
/usr/local/go/bin/go run -tags $GOTAGS -ldflags="${GOLDFLAGS}" cmd/experimental/whisper.cpp/main.go
fi
fi
elif [[ ${STT_SERVICE} == "vosk" ]]; then
Expand All @@ -92,7 +95,7 @@ if [[ ${STT_SERVICE} == "leopard" ]]; then
export CGO_CFLAGS="-I$HOME/.vosk/libvosk -I/root/.vosk/libvosk"
export CGO_LDFLAGS="-L$HOME/.vosk/libvosk -L/root/.vosk/libvosk -lvosk -ldl -lpthread"
export LD_LIBRARY_PATH="/root/.vosk/libvosk:$HOME/.vosk/libvosk:$LD_LIBRARY_PATH"
/usr/local/go/bin/go run -tags $GOTAGS -exec "env DYLD_LIBRARY_PATH=$HOME/.vosk/libvosk" cmd/vosk/main.go
/usr/local/go/bin/go run -tags $GOTAGS -ldflags="${GOLDFLAGS}" -exec "env DYLD_LIBRARY_PATH=$HOME/.vosk/libvosk" cmd/vosk/main.go
fi
else
if [[ -f ./chipper ]]; then
Expand All @@ -104,6 +107,6 @@ else
export CGO_LDFLAGS="-L$HOME/.coqui/"
export CGO_CXXFLAGS="-I$HOME/.coqui/"
export LD_LIBRARY_PATH="$HOME/.coqui/:$LD_LIBRARY_PATH"
/usr/local/go/bin/go run -tags $GOTAGS cmd/coqui/main.go
/usr/local/go/bin/go run -tags $GOTAGS -ldflags="${GOLDFLAGS}" cmd/coqui/main.go
fi
fi
Binary file added chipper/webroot/css/DroidSans.woff.1
Binary file not shown.
17 changes: 12 additions & 5 deletions chipper/webroot/css/style.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
@import url("wing.css");

@font-face{
font-family: 'DroidSans';
src: url('DroidSans.woff') format('woff');
/*font license Apache V2.00: https://www.fontsquirrel.com/license/droid-sans*/
}

@font-face{
font-family: 'IBMVGA';
src: url('PxPlus_IBM_VGA_8x16.ttf') format('truetype');
Expand Down Expand Up @@ -33,6 +39,7 @@
:root {
--bg-color: #1e1e1e;
--h1-color: #00d16d;
--body-font-family: 'DroidSans', sans-serif;
--bg-color-alt: rgba(196,196,196,1); /* light gray #C4C4C4*/
--button-color: rgba(75,75,75,1); /* dark gray #4B4B4B */
--button-color-alt: rgba(164,164,164,1); /* light gray #A4A4A4 */
Expand All @@ -52,7 +59,7 @@ button:disabled {
color : var(--bg-color-alt);
}
button {
font-family: "IBMVGA", monospace;
font-family: var(--body-font-family);
font-size: 0.8em;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
width: 170px;
Expand All @@ -75,7 +82,7 @@ button {
input[type="text"], input[type="file"], select {
background-color: #2d2d2d;
color: #ffffff;
font-family: 'IBMVGA', monospace;
font-family: var(--body-font-family);
font-size: 1.0em;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
text-align: center;
Expand Down Expand Up @@ -104,7 +111,7 @@ select {

body {
background-color: var(--bg-color);
font-family: "IBMVGA", sans-serif;
font-family: var(--body-font-family);
font-size: 1.8em;
display: flex;
justify-content: center;
Expand All @@ -117,7 +124,7 @@ body {


h1, h2, h3, h4, small, p, li, label {
font-family: "IBMVGA", monospace;
font-family: var(--body-font-family);
color: var(--text-color);
}

Expand All @@ -142,7 +149,7 @@ h1 {
textarea {
background-color: #2d2d2d;
color: #ffffff;
font-family: 'IBMVGA', sans-serif;
font-family: var(--body-font-family);
font-size: 0.9em;
height: 280px;
}
Expand Down
5 changes: 5 additions & 0 deletions chipper/webroot/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ <h1>Wire-Pod</h1>
<a href="#" onclick="showVersion(); return false;"><i class="fa-solid fa-code-compare" id="icon-Version"
name="icon"></i><br />Version Info</a>
</div>
<!--UI Customizer-->
<div class="main-nav-child">
<a href="#" onclick="showVersion(); return false;"><i class="fa-solid fa-pen-nib" id="icon-Customizer"
name="icon"></i><br />UI Settings</a>
</div>
</div>
<hr />

Expand Down

0 comments on commit 4bce4be

Please sign in to comment.