Enhance client reload process with new OpenAI compatibility support

- Added handling for OpenAI-compatible providers during client reload.
- Implemented client unregistration for old clients during reload.
- Improved logging for detailed client reload insights.

Expand `AuthDir` handling to support tilde (`~`) for home directory resolution

- Added logic to replace `~` with the user's home directory in `AuthDir`.
- Prevents errors when using `~` in configuration paths.
This commit is contained in:
Luis Pater
2025-08-31 02:58:55 +08:00
parent 9c9ea99380
commit b1254106ee
2 changed files with 51 additions and 3 deletions

View File

@@ -343,6 +343,10 @@ func (c *ClaudeClient) SaveTokenToFile() error {
// - error: An error if the refresh operation fails, nil otherwise.
func (c *ClaudeClient) RefreshTokens(ctx context.Context) error {
// Check if we have a valid refresh token
if c.apiKeyIndex != -1 {
return fmt.Errorf("no refresh token available")
}
if c.tokenStorage == nil || c.tokenStorage.(*claude.ClaudeTokenStorage).RefreshToken == "" {
return fmt.Errorf("no refresh token available")
}