Add registerHandleUri command
This commit is contained in:
parent
4f937baa06
commit
f2ab969f88
@ -389,6 +389,27 @@ export function registerDevChatChatCommand(context: vscode.ExtensionContext) {
|
||||
context.subscriptions.push(disposable);
|
||||
}
|
||||
|
||||
export function registerHandleUri(context: vscode.ExtensionContext){
|
||||
context.subscriptions.push(vscode.window.registerUriHandler({
|
||||
handleUri(uri) {
|
||||
// 解析 URI 并执行相应的操作
|
||||
if (uri.path.includes('accesskey')) {
|
||||
const accessKey = uri.path.split('/')[2];
|
||||
const modelConfig: any = UiUtilWrapper.getConfiguration("devchat", 'Provider.devchat');
|
||||
const providerConfigNew:any = {}
|
||||
if (Object.keys(modelConfig).length !== 0){
|
||||
for (const key of Object.keys(modelConfig || {})) {
|
||||
const property = modelConfig![key];
|
||||
providerConfigNew[key] = property;
|
||||
}
|
||||
}
|
||||
providerConfigNew.access_key = accessKey;
|
||||
vscode.workspace.getConfiguration("devchat").update("Provider.devchat", providerConfigNew, vscode.ConfigurationTarget.Global);
|
||||
}
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
export {
|
||||
registerOpenChatPanelCommand,
|
||||
registerAddContextCommand,
|
||||
|
@ -17,7 +17,8 @@ import {
|
||||
registerInstallCommandsCommand,
|
||||
registerUpdateChatModelsCommand,
|
||||
registerInstallCommandsPython,
|
||||
registerDevChatChatCommand
|
||||
registerDevChatChatCommand,
|
||||
registerHandleUri,
|
||||
} from './contributes/commands';
|
||||
import { regLanguageContext } from './contributes/context';
|
||||
import { regDevChatView, regTopicView } from './contributes/views';
|
||||
@ -286,5 +287,7 @@ async function activate(context: vscode.ExtensionContext) {
|
||||
registerDevChatChatCommand(context);
|
||||
|
||||
startRpcServer();
|
||||
logger.channel()?.info(`registerHandleUri:`);
|
||||
registerHandleUri(context)
|
||||
}
|
||||
exports.activate = activate;
|
Loading…
x
Reference in New Issue
Block a user