chore: rename project to ByteClaw (module, binary, env prefix BYTECLAW_, Android package/app/theme)
This commit is contained in:
parent
bf00f56117
commit
399bcd46fb
28 changed files with 104 additions and 101 deletions
|
|
@ -1,4 +1,4 @@
|
|||
// Package config loads OpenClaw configuration from YAML/JSON files and env vars.
|
||||
// Package config loads ByteClaw configuration from YAML/JSON files and env vars.
|
||||
package config
|
||||
|
||||
import (
|
||||
|
|
@ -67,7 +67,7 @@ func Default() Config {
|
|||
Temperature: 0.7,
|
||||
},
|
||||
Agent: Agent{
|
||||
SystemPrompt: "You are OpenClaw, a concise and helpful self-hosted assistant. Use tools when they help.",
|
||||
SystemPrompt: "You are ByteClaw, a concise and helpful self-hosted assistant. Use tools when they help.",
|
||||
MaxIterations: 8,
|
||||
HistoryLimit: 50,
|
||||
},
|
||||
|
|
@ -110,14 +110,14 @@ func applyEnv(c *Config, get func(string) string) {
|
|||
*dst = v
|
||||
}
|
||||
}
|
||||
set("OPENCLAW_LISTEN", &c.Listen)
|
||||
set("OPENCLAW_AUTH_TOKEN", &c.AuthToken)
|
||||
set("OPENCLAW_DATA_DIR", &c.DataDir)
|
||||
set("OPENCLAW_WORKSPACE", &c.Workspace)
|
||||
set("OPENCLAW_LLM_BASE_URL", &c.LLM.BaseURL)
|
||||
set("OPENCLAW_LLM_API_KEY", &c.LLM.APIKey)
|
||||
set("OPENCLAW_LLM_MODEL", &c.LLM.Model)
|
||||
if v := get("OPENCLAW_ALLOWED_ORIGINS"); v != "" {
|
||||
set("BYTECLAW_LISTEN", &c.Listen)
|
||||
set("BYTECLAW_AUTH_TOKEN", &c.AuthToken)
|
||||
set("BYTECLAW_DATA_DIR", &c.DataDir)
|
||||
set("BYTECLAW_WORKSPACE", &c.Workspace)
|
||||
set("BYTECLAW_LLM_BASE_URL", &c.LLM.BaseURL)
|
||||
set("BYTECLAW_LLM_API_KEY", &c.LLM.APIKey)
|
||||
set("BYTECLAW_LLM_MODEL", &c.LLM.Model)
|
||||
if v := get("BYTECLAW_ALLOWED_ORIGINS"); v != "" {
|
||||
c.AllowedOrigins = nil
|
||||
for _, o := range strings.Split(v, ",") {
|
||||
if o = strings.TrimSpace(o); o != "" {
|
||||
|
|
@ -131,7 +131,7 @@ func applyEnv(c *Config, get func(string) string) {
|
|||
func (c Config) Validate() error {
|
||||
var errs []error
|
||||
if len(c.AuthToken) < 16 {
|
||||
errs = append(errs, errors.New("auth_token must be set and at least 16 characters (OPENCLAW_AUTH_TOKEN)"))
|
||||
errs = append(errs, errors.New("auth_token must be set and at least 16 characters (BYTECLAW_AUTH_TOKEN)"))
|
||||
}
|
||||
if c.LLM.BaseURL == "" || c.LLM.Model == "" {
|
||||
errs = append(errs, errors.New("llm.base_url and llm.model are required"))
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ func TestLoadYAMLAndEnv(t *testing.T) {
|
|||
dir := t.TempDir()
|
||||
p := filepath.Join(dir, "c.yaml")
|
||||
os.WriteFile(p, []byte("auth_token: aaaaaaaaaaaaaaaaaaaa\nllm:\n model: llama3\n"), 0o600)
|
||||
t.Setenv("OPENCLAW_LLM_BASE_URL", "http://localhost:11434/v1")
|
||||
t.Setenv("OPENCLAW_ALLOWED_ORIGINS", "https://a.example, https://b.example")
|
||||
t.Setenv("BYTECLAW_LLM_BASE_URL", "http://localhost:11434/v1")
|
||||
t.Setenv("BYTECLAW_ALLOWED_ORIGINS", "https://a.example, https://b.example")
|
||||
c, err := Load(p)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
|
|
@ -37,7 +37,7 @@ func TestLoadJSON(t *testing.T) {
|
|||
}
|
||||
|
||||
func TestValidateRequiresToken(t *testing.T) {
|
||||
t.Setenv("OPENCLAW_AUTH_TOKEN", "")
|
||||
t.Setenv("BYTECLAW_AUTH_TOKEN", "")
|
||||
if _, err := Load(""); err == nil {
|
||||
t.Fatal("expected error without token")
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue