This commit is contained in:
Timothy Jaeryang Baek
2026-03-22 22:10:04 -05:00
parent ebb7ce2092
commit 6a9d67b5bb
3 changed files with 102 additions and 6 deletions
+27 -1
View File
@@ -392,12 +392,38 @@ export const getToolServersData = async (servers: object[]) => {
specs: convertOpenApiToToolPayload(res)
};
return {
const result: Record<string, any> = {
url: server?.url,
openapi: openapi,
info: info,
specs: specs
};
// Fetch system prompt if the server supports it
try {
const baseUrl = (server?.url ?? '').replace(/\/$/, '');
const configRes = await fetch(`${baseUrl}/api/config`);
if (configRes.ok) {
const config = await configRes.json();
if (config?.features?.system) {
const headers: Record<string, string> = {};
if (toolServerToken) {
headers['Authorization'] = `Bearer ${toolServerToken}`;
}
const systemRes = await fetch(`${baseUrl}/system`, { headers });
if (systemRes.ok) {
const systemData = await systemRes.json();
if (systemData?.prompt) {
result.system_prompt = systemData.prompt;
}
}
}
}
} catch (e) {
// Server doesn't support /system — that's fine
}
return result;
} else if (error) {
return {
error,