Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove vscode azure session #692

Merged
merged 2 commits into from
Sep 5, 2024
Merged

remove vscode azure session #692

merged 2 commits into from
Sep 5, 2024

Conversation

pelikhan
Copy link
Member

@pelikhan pelikhan commented Sep 5, 2024

it's all cli now

  • 📝 The 'NodeHost' class has been updated with an error check for Azure endpoints. This check helps validate whether or not the Azure token is configured, thereby ensuring that the 'provider' property of the model has been correctly set as the Azure model provider. 🛠️

  • 🗑️ The process to update '.env' file in the 'updateConnectionConfiguration' function of 'Connection.ts' file has been commented out. Previously, this process involved fetching the relevant configuration from the dotenv template, and then updating the '.env' file with this configuration. 🔄

  • ❗ The 'AzureManager' class along with its associated file 'azuremanager.ts' has been removed. This class was initially responsible for handling logic associated with Azure sessions, like invalidating sessions and fetching new ones when the former were not available. This change might be indicative of a shift in how Azure sessions are to be managed moving forward.

  • 💬 The 'pickLanguageModel' function in 'lmaccess.ts' has been modified to display a warning message if the model connection is not configured. Before, a 'genaiscript.connection.configure' command would be executed in this scenario.

  • ❌ Moreover, several functionalities from the 'VSCodeHost' class have been removed. This includes the removal of methods related to Azure chats, including asking for an Azure token and creating new Azure chats.

  • 💡 These changes suggest an overall intent of the modification to be around redefining how Azure support is incorporated into the codebase, with several Azure-related functionalities being commented out, removed, or flagged for errors. ‼️

generated by pr-describe

const { provider } = parseModelIdentifier(modelId)
if (provider === MODEL_PROVIDER_AZURE)
throw new Error("Azure end point not configured")
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error "Azure end point not configured" is thrown but not caught. This could lead to unexpected application termination. Consider handling this error to improve the application's robustness. 🛠️

generated by pr-review-commit unhandled_error

await writeText(DOT_ENV_FILENAME, src)
// const { config } = dotEnvTemplate(provider, apiType)
// const current = await tryReadText(DOT_ENV_FILENAME)
//await writeText(DOT_ENV_FILENAME, config)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a block of code that has been commented out. If this code is not needed, it is better to remove it to keep the codebase clean and maintainable. 🧹

generated by pr-review-commit commented_code

res.provider,
res.apiType
vscode.window.showWarningMessage(
`${TOOL_NAME} - model connection not configured.`
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The function vscode.window.showWarningMessage is called without error handling. If the function fails, the error will not be caught, which could lead to unexpected behavior. Consider adding error handling. 🚀

generated by pr-review-commit missing_error_handling

Copy link

github-actions bot commented Sep 5, 2024

The changes mainly focus on the removal of Azure authentication and token management logic.

  • In nodehost.ts, error handling for missing Azure token has been updated.
  • In connection.ts, the update connection configuration logic has been simplified by commenting out .env file update logic.
  • Complete removal of azuremanager.ts, which managed Azure authentication sessions and token retrieval.
  • In lmaccess.ts, the command execution for connection configuration has been replaced with a warning message.
  • In vshost.ts, all operations related to Azure tokens and Azure Manager have been removed, including the removal of the Azure property getter and use of the Azure OpenAI token.

Concerns:

  • With the removal of Azure authentication and token management logic, there's a potential risk for functionality that depended on these tokens being unavailable. If these functionalities are still being used, the removal might cause issues.

Since this pull request removes a substantial amount of code related to Azure tokens and authentication, I would recommend confirming whether these changes won't affect any existing functionalities or if there is an alternative token management system in place.

Without further context on why these changes are being made, it's difficult to provide a definitively positive or negative review.

If all dependencies on Azure were indeed removed or replaced as intended, then, LGTM 🚀. However, if there are still functionalities dependent on Azure tokens, then these changes might cause issues.

generated by pr-review

@@ -214,7 +214,7 @@ for GitHub Models, you can use the `GITHUB_MODELS_TOKEN` variable instead.
## Azure OpenAI <a id="azure" href=""></a>

The [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions) provider, `azure` uses the `AZURE_OPENAI_...` environment variables.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Duplicate content found. The sentence "You can use a managed identity (recommended) or a API key to authenticate with the Azure OpenAI service." is repeated.

generated by pr-docs-review-commit duplicate_content


```sh
az login
```
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Content has been relocated. Instructions for logging in with Azure CLI have been moved from a subsection into a list item.

generated by pr-docs-review-commit content_relocation

</li>

<li>

Update the `model` field in the `script` function to match the model deployment name in your Azure resource.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incorrect reference in the documentation. The model field should be updated to match the model deployment name, but the provided code snippet incorrectly references 'model: "azure:deployment-id"' which is not a valid deployment name.

generated by pr-docs-review-commit incorrect_reference

@@ -214,7 +214,7 @@ for GitHub Models, you can use the `GITHUB_MODELS_TOKEN` variable instead.
## Azure OpenAI <a id="azure" href=""></a>

The [Azure OpenAI](https://learn.microsoft.com/en-us/azure/ai-services/openai/reference#chat-completions) provider, `azure` uses the `AZURE_OPENAI_...` environment variables.
You can use a managed identity (recommended) or a API key to authenticate with the Azure OpenAI service.
You can use a managed identity (recommended) or a API key to authenticate with the Azure OpenAI service.
You can also use a service principal as documented in [automation](/genaiscript/getting-started/automating-scripts).
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The link provided in "automation" might be broken or incorrect. It should be verified if it correctly leads to the automation documentation.

generated by pr-docs-review-commit broken_link

const { provider } = parseModelIdentifier(modelId)
if (provider === MODEL_PROVIDER_AZURE)
throw new Error("Azure end point not configured")
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The tok object is not checked for null or undefined before accessing its token property. This could lead to a runtime error if tok is null or undefined. Consider adding a null check before accessing the token property. 🛠️

generated by pr-review-commit missing_check

vscode.commands.executeCommand(
"genaiscript.connection.configure"
)
})
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The then function is used after showWarningMessage, but the function inside then is not awaited. This could lead to unexpected behavior as the function might not complete before the next line of code is executed. Consider using await with then or converting the promise chain to async/await for better readability and error handling. 🔄

generated by pr-review-commit async_await

@@ -198,20 +187,6 @@ export class VSCodeHost extends EventTarget implements Host {
modelId,
options
)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The askToken variable is declared but never used. This could lead to confusion for other developers reading the code. Consider removing unused variables to improve code readability. 🧹

generated by pr-review-commit unused_code

@pelikhan pelikhan merged commit 80c3b52 into main Sep 5, 2024
11 checks passed
@pelikhan pelikhan deleted the azcleanup branch September 5, 2024 23:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant