mirror of
https://github.com/wavetermdev/waveterm.git
synced 2025-01-02 18:39:05 +01:00
Add Extra Log Messages to Improve Debugging Experience (#906)
This adds more debugging statements for connections and ai chat, in order to provide us more context if users run into bugs.
This commit is contained in:
parent
cacde1b0ba
commit
41a34ad49f
@ -416,6 +416,7 @@ func (conn *SSHConn) WithLock(fn func()) {
|
|||||||
func (conn *SSHConn) connectInternal(ctx context.Context) error {
|
func (conn *SSHConn) connectInternal(ctx context.Context) error {
|
||||||
client, err := remote.ConnectToClient(ctx, conn.Opts) //todo specify or remove opts
|
client, err := remote.ConnectToClient(ctx, conn.Opts) //todo specify or remove opts
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("error: failed to connect to client %s: %v\n", conn.GetName(), err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
fmtAddr := knownhosts.Normalize(fmt.Sprintf("%s@%s", client.User(), client.RemoteAddr().String()))
|
fmtAddr := knownhosts.Normalize(fmt.Sprintf("%s@%s", client.User(), client.RemoteAddr().String()))
|
||||||
@ -425,14 +426,17 @@ func (conn *SSHConn) connectInternal(ctx context.Context) error {
|
|||||||
})
|
})
|
||||||
err = conn.OpenDomainSocketListener()
|
err = conn.OpenDomainSocketListener()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Printf("error: unable to open domain socket listener for %s: %v\n", conn.GetName(), err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
installErr := conn.CheckAndInstallWsh(ctx, clientDisplayName, nil)
|
installErr := conn.CheckAndInstallWsh(ctx, clientDisplayName, nil)
|
||||||
if installErr != nil {
|
if installErr != nil {
|
||||||
|
log.Printf("error: unable to install wsh shell extensions for %s: %v\n", conn.GetName(), err)
|
||||||
return fmt.Errorf("conncontroller %s wsh install error: %v", conn.GetName(), installErr)
|
return fmt.Errorf("conncontroller %s wsh install error: %v", conn.GetName(), installErr)
|
||||||
}
|
}
|
||||||
csErr := conn.StartConnServer()
|
csErr := conn.StartConnServer()
|
||||||
if csErr != nil {
|
if csErr != nil {
|
||||||
|
log.Printf("error: unable to start conn server for %s: %v\n", conn.GetName(), csErr)
|
||||||
return fmt.Errorf("conncontroller %s start wsh connserver error: %v", conn.GetName(), csErr)
|
return fmt.Errorf("conncontroller %s start wsh connserver error: %v", conn.GetName(), csErr)
|
||||||
}
|
}
|
||||||
conn.HasWaiter.Store(true)
|
conn.HasWaiter.Store(true)
|
||||||
|
@ -473,7 +473,7 @@ func createHostKeyCallback(opts *SSHOpts) (ssh.HostKeyCallback, HostKeyAlgorithm
|
|||||||
offendingKeysFmt = append(offendingKeysFmt, formattedKey)
|
offendingKeysFmt = append(offendingKeysFmt, formattedKey)
|
||||||
}
|
}
|
||||||
// todo
|
// todo
|
||||||
_ = fmt.Sprintf("**WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!**\n\n"+
|
errorMsg := fmt.Sprintf("**WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!**\n\n"+
|
||||||
"If this is not expected, it is possible that someone could be trying to "+
|
"If this is not expected, it is possible that someone could be trying to "+
|
||||||
"eavesdrop on you via a man-in-the-middle attack. "+
|
"eavesdrop on you via a man-in-the-middle attack. "+
|
||||||
"Alternatively, the host you are connecting to may have changed its key. "+
|
"Alternatively, the host you are connecting to may have changed its key. "+
|
||||||
@ -485,6 +485,7 @@ func createHostKeyCallback(opts *SSHOpts) (ssh.HostKeyCallback, HostKeyAlgorithm
|
|||||||
"%s\n\n"+
|
"%s\n\n"+
|
||||||
"**Offending Keys** \n"+
|
"**Offending Keys** \n"+
|
||||||
"%s", key.Type(), correctKeyFingerprint, strings.Join(bulletListKnownHosts, " \n"), strings.Join(offendingKeysFmt, " \n"))
|
"%s", key.Type(), correctKeyFingerprint, strings.Join(bulletListKnownHosts, " \n"), strings.Join(offendingKeysFmt, " \n"))
|
||||||
|
log.Print(errorMsg)
|
||||||
//update := scbus.MakeUpdatePacket()
|
//update := scbus.MakeUpdatePacket()
|
||||||
// create update into alert message
|
// create update into alert message
|
||||||
|
|
||||||
|
@ -75,8 +75,10 @@ func (ws *WshServer) StreamTestCommand(ctx context.Context) chan wshrpc.RespOrEr
|
|||||||
|
|
||||||
func (ws *WshServer) StreamWaveAiCommand(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType] {
|
func (ws *WshServer) StreamWaveAiCommand(ctx context.Context, request wshrpc.OpenAiStreamRequest) chan wshrpc.RespOrErrorUnion[wshrpc.OpenAIPacketType] {
|
||||||
if request.Opts.BaseURL == "" && request.Opts.APIToken == "" {
|
if request.Opts.BaseURL == "" && request.Opts.APIToken == "" {
|
||||||
|
log.Print("sending ai chat message to waveterm default endpoint with openai\n")
|
||||||
return waveai.RunCloudCompletionStream(ctx, request)
|
return waveai.RunCloudCompletionStream(ctx, request)
|
||||||
}
|
}
|
||||||
|
log.Printf("sending ai chat message to user-configured endpoint %s\n", request.Opts.BaseURL)
|
||||||
return waveai.RunLocalCompletionStream(ctx, request)
|
return waveai.RunLocalCompletionStream(ctx, request)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user