Merge branch 'main' into update-vulnerable-dependencies
This commit is contained in:
commit
a7954b664e
4 changed files with 19 additions and 0 deletions
|
|
@ -48,6 +48,7 @@ const PromptsTab = ({
|
||||||
ref: PromptReference | ResourceReference,
|
ref: PromptReference | ResourceReference,
|
||||||
argName: string,
|
argName: string,
|
||||||
value: string,
|
value: string,
|
||||||
|
context?: Record<string, string>,
|
||||||
) => Promise<string[]>;
|
) => Promise<string[]>;
|
||||||
completionsSupported: boolean;
|
completionsSupported: boolean;
|
||||||
promptContent: string;
|
promptContent: string;
|
||||||
|
|
@ -73,6 +74,7 @@ const PromptsTab = ({
|
||||||
},
|
},
|
||||||
argName,
|
argName,
|
||||||
value,
|
value,
|
||||||
|
promptArgs,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ const ResourcesTab = ({
|
||||||
ref: ResourceReference | PromptReference,
|
ref: ResourceReference | PromptReference,
|
||||||
argName: string,
|
argName: string,
|
||||||
value: string,
|
value: string,
|
||||||
|
context?: Record<string, string>,
|
||||||
) => Promise<string[]>;
|
) => Promise<string[]>;
|
||||||
completionsSupported: boolean;
|
completionsSupported: boolean;
|
||||||
resourceContent: string;
|
resourceContent: string;
|
||||||
|
|
@ -94,6 +95,7 @@ const ResourcesTab = ({
|
||||||
},
|
},
|
||||||
key,
|
key,
|
||||||
value,
|
value,
|
||||||
|
templateValues,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -28,6 +28,7 @@ export function useCompletionState(
|
||||||
ref: ResourceReference | PromptReference,
|
ref: ResourceReference | PromptReference,
|
||||||
argName: string,
|
argName: string,
|
||||||
value: string,
|
value: string,
|
||||||
|
context?: Record<string, string>,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
) => Promise<string[]>,
|
) => Promise<string[]>,
|
||||||
completionsSupported: boolean = true,
|
completionsSupported: boolean = true,
|
||||||
|
|
@ -66,6 +67,7 @@ export function useCompletionState(
|
||||||
ref: ResourceReference | PromptReference,
|
ref: ResourceReference | PromptReference,
|
||||||
argName: string,
|
argName: string,
|
||||||
value: string,
|
value: string,
|
||||||
|
context?: Record<string, string>,
|
||||||
) => {
|
) => {
|
||||||
if (!completionsSupported) {
|
if (!completionsSupported) {
|
||||||
return;
|
return;
|
||||||
|
|
@ -82,10 +84,15 @@ export function useCompletionState(
|
||||||
}));
|
}));
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
if (context !== undefined) {
|
||||||
|
delete context[argName];
|
||||||
|
}
|
||||||
|
|
||||||
const values = await handleCompletion(
|
const values = await handleCompletion(
|
||||||
ref,
|
ref,
|
||||||
argName,
|
argName,
|
||||||
value,
|
value,
|
||||||
|
context,
|
||||||
abortController.signal,
|
abortController.signal,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
@ -97,6 +104,7 @@ export function useCompletionState(
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
|
console.error("completion failed");
|
||||||
if (!abortController.signal.aborted) {
|
if (!abortController.signal.aborted) {
|
||||||
setState((prev) => ({
|
setState((prev) => ({
|
||||||
...prev,
|
...prev,
|
||||||
|
|
|
||||||
|
|
@ -198,6 +198,7 @@ export function useConnection({
|
||||||
ref: ResourceReference | PromptReference,
|
ref: ResourceReference | PromptReference,
|
||||||
argName: string,
|
argName: string,
|
||||||
value: string,
|
value: string,
|
||||||
|
context?: Record<string, string>,
|
||||||
signal?: AbortSignal,
|
signal?: AbortSignal,
|
||||||
): Promise<string[]> => {
|
): Promise<string[]> => {
|
||||||
if (!mcpClient || !completionsSupported) {
|
if (!mcpClient || !completionsSupported) {
|
||||||
|
|
@ -215,6 +216,12 @@ export function useConnection({
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (context) {
|
||||||
|
request["params"]["context"] = {
|
||||||
|
arguments: context,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const response = await makeRequest(request, CompleteResultSchema, {
|
const response = await makeRequest(request, CompleteResultSchema, {
|
||||||
signal,
|
signal,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue