mirror of
https://github.com/ONLYOFFICE/server.git
synced 2026-02-10 18:05:07 +08:00
[feature] Clean info page; Fix eslint; For bug 76861
This commit is contained in:
@ -4,10 +4,8 @@ build
|
|||||||
coverage
|
coverage
|
||||||
.next
|
.next
|
||||||
out
|
out
|
||||||
branding/info/ai/**
|
AdminPanel/client/src/pages/AiIntegration/ai/**
|
||||||
branding/info/js/plugin-stub.js
|
AdminPanel/client/src/pages/AiIntegration/js/**
|
||||||
branding/info/js/plugins.js
|
|
||||||
branding/info/js/plugins-ui.js
|
|
||||||
*.min.js
|
*.min.js
|
||||||
*.min.css
|
*.min.css
|
||||||
package-lock.json
|
package-lock.json
|
||||||
|
|||||||
@ -474,42 +474,8 @@ async function getPluginSettingsForInterface(ctx) {
|
|||||||
return pluginSettings;
|
return pluginSettings;
|
||||||
}
|
}
|
||||||
|
|
||||||
async function requestSettings(req, res) {
|
|
||||||
const ctx = new operationContext.Context();
|
|
||||||
ctx.initFromRequest(req);
|
|
||||||
try {
|
|
||||||
await ctx.initTenantCache();
|
|
||||||
const result = await getPluginSettings(ctx);
|
|
||||||
res.json(result);
|
|
||||||
} catch (error) {
|
|
||||||
ctx.logger.error('getSettings error: %s', error.stack);
|
|
||||||
res.sendStatus(400);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
async function requestModels(req, res) {
|
|
||||||
const ctx = new operationContext.Context();
|
|
||||||
ctx.initFromRequest(req);
|
|
||||||
try {
|
|
||||||
await ctx.initTenantCache();
|
|
||||||
const body = JSON.parse(req.body);
|
|
||||||
if (AI.Providers[body.name]) {
|
|
||||||
AI.Providers[body.name].key = body.key;
|
|
||||||
AI.Providers[body.name].url = body.url;
|
|
||||||
}
|
|
||||||
const getRes = await AI.getModels(body);
|
|
||||||
getRes.modelsApi = AI.TmpProviderForModels?.models;
|
|
||||||
res.json(getRes);
|
|
||||||
} catch (error) {
|
|
||||||
ctx.logger.error('getModels error: %s', error.stack);
|
|
||||||
res.sendStatus(400);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
proxyRequest,
|
proxyRequest,
|
||||||
getPluginSettings,
|
getPluginSettings,
|
||||||
getPluginSettingsForInterface,
|
getPluginSettingsForInterface
|
||||||
requestSettings,
|
|
||||||
requestModels
|
|
||||||
};
|
};
|
||||||
|
|||||||
@ -294,8 +294,6 @@ docsCoServer.install(server, app, () => {
|
|||||||
app.post('/docbuilder', utils.checkClientIp, rawFileParser, (req, res) => {
|
app.post('/docbuilder', utils.checkClientIp, rawFileParser, (req, res) => {
|
||||||
converterService.builder(req, res);
|
converterService.builder(req, res);
|
||||||
});
|
});
|
||||||
app.get('/info/plugin/settings', utils.checkClientIp, aiProxyHandler.requestSettings);
|
|
||||||
app.post('/info/plugin/models', utils.checkClientIp, rawFileParser, aiProxyHandler.requestModels);
|
|
||||||
// Shared Info router (provides /info.json)
|
// Shared Info router (provides /info.json)
|
||||||
app.use('/info', infoRouter());
|
app.use('/info', infoRouter());
|
||||||
app.put('/internal/cluster/inactive', utils.checkClientIp, docsCoServer.shutdown);
|
app.put('/internal/cluster/inactive', utils.checkClientIp, docsCoServer.shutdown);
|
||||||
|
|||||||
@ -5,7 +5,6 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||||
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8" />
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=IE8" />
|
||||||
<link href="img/favicon.ico" rel="icon" type="image/x-icon" />
|
<link href="img/favicon.ico" rel="icon" type="image/x-icon" />
|
||||||
<link rel="stylesheet" href="css/ai-integration.css" />
|
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
html {
|
html {
|
||||||
@ -597,7 +596,5 @@
|
|||||||
} catch (e) {}
|
} catch (e) {}
|
||||||
})();
|
})();
|
||||||
</script>
|
</script>
|
||||||
<script type="text/javascript" src="js/ai-integration.js"></script>
|
|
||||||
<script type="text/javascript" src="js/ai-interface.js"></script>
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|||||||
@ -18,8 +18,8 @@ module.exports = [
|
|||||||
'coverage/',
|
'coverage/',
|
||||||
'.next/',
|
'.next/',
|
||||||
'out/',
|
'out/',
|
||||||
'branding/info/ai/**',
|
'AdminPanel/client/src/pages/AiIntegration/ai/**',
|
||||||
'branding/info/js/**',
|
'AdminPanel/client/src/pages/AiIntegration/js/**',
|
||||||
'*.min.js',
|
'*.min.js',
|
||||||
'package-lock.json',
|
'package-lock.json',
|
||||||
'npm-shrinkwrap.json',
|
'npm-shrinkwrap.json',
|
||||||
|
|||||||
Reference in New Issue
Block a user