Skip to content

Commit

Permalink
perf: support GPT setting
Browse files Browse the repository at this point in the history
  • Loading branch information
LeeEirc committed Dec 11, 2023
1 parent c8a4a5d commit 64efe74
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 24 deletions.
5 changes: 5 additions & 0 deletions cmd/impl/jms.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,10 +363,15 @@ func (j *JMServer) GetPublicSetting(ctx context.Context, empty *pb.Empty) (*pb.P
status.Err = err.Error()
return &pb.PublicSettingResponse{Status: &status}, nil
}
setting := j.uploader.GetTerminalSetting()
status.Ok = true
pbSetting := pb.PublicSetting{
XpackEnabled: data.XpackEnabled,
ValidLicense: data.ValidLicense,
GptBaseUrl: setting.GPTBaseURL,
GptApiKey: setting.GPTApiKey,
GptProxy: setting.GPTProxy,
GptModel: setting.GPTModel,
}
return &pb.PublicSettingResponse{Status: &status, Data: &pbSetting}, nil
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/jms-sdk-go/model/terminal.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,11 @@ type TerminalConfig struct {
HeartbeatDuration int `json:"TERMINAL_HEARTBEAT_INTERVAL"`
HostKey string `json:"TERMINAL_HOST_KEY"`
EnableSessionShare bool `json:"SECURITY_SESSION_SHARE"`

GPTBaseURL string `json:"GPT_BASE_URL"`
GPTApiKey string `json:"GPT_API_KEY"`
GPTProxy string `json:"GPT_PROXY"`
GPTModel string `json:"GPT_MODEL"`
}

type Terminal struct {
Expand Down
88 changes: 64 additions & 24 deletions protobuf-go/protobuf/common.pb.go

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

4 changes: 4 additions & 0 deletions protos/common.proto
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,10 @@ message Forward {
message PublicSetting {
bool xpack_enabled = 1;
bool valid_license = 2;
string gpt_base_url = 3;
string gpt_api_key = 4;
string gpt_proxy = 5;
string gpt_model = 6;
}

message Cookie {
Expand Down

0 comments on commit 64efe74

Please sign in to comment.