bugfix
This commit is contained in:
@ -17,7 +17,7 @@ TEST_SERVER_HOSTNAMES = ['tradingtest']
|
||||
|
||||
#TODO vybrane dat do config db a managovat pres GUI
|
||||
|
||||
#AGGREGATOR filter trades
|
||||
#DEFAULT AGGREGATOR filter trades
|
||||
#NOTE pridana F - Inter Market Sweep Order - obcas vytvarela spajky
|
||||
AGG_EXCLUDED_TRADES = ['C','O','4','B','7','V','P','W','U','Z','F']
|
||||
|
||||
|
||||
@ -791,7 +791,7 @@ def delete_item(item_id: int) -> dict:
|
||||
#model section
|
||||
#UPLOAD MODEL
|
||||
@app.post("/model/upload_model", dependencies=[Depends(api_key_auth)])
|
||||
async def upload_model(file: UploadFile = File(...)):
|
||||
async def _upload_model(file: UploadFile = File(...)):
|
||||
# Specify the directory to save the file
|
||||
#save_directory = DATA_DIR+'/models/'
|
||||
save_directory = MODEL_DIR
|
||||
@ -857,7 +857,8 @@ def download_model(model_name: str):
|
||||
@app.get("/model/metadata/{model_name}", dependencies=[Depends(api_key_auth)])
|
||||
def get_metadata(model_name: str):
|
||||
try:
|
||||
model_instance = ml.load_model(file=model_name, directory=MODEL_DIR)
|
||||
#loadujeme pouze v modu cfg only
|
||||
model_instance = ml.load_model(file=model_name, directory=MODEL_DIR, cfg_only = True)
|
||||
try:
|
||||
metadata = model_instance.metadata
|
||||
except AttributeError:
|
||||
|
||||
@ -810,6 +810,7 @@
|
||||
<div class="form-group">
|
||||
<label for="metadata-container" id="metadata_label" class="form-label">Metadata</label>
|
||||
<div id="metadata-container" style="height:700px;border:1px solid black;">
|
||||
<div id="metadata-container-info"></div>
|
||||
<div id="toml-editor-container"></div>
|
||||
<div id="python-editor-container"></div>
|
||||
</div>
|
||||
|
||||
@ -106,16 +106,17 @@ $(document).ready(function() {
|
||||
xhr.setRequestHeader('X-API-Key', API_KEY);
|
||||
},
|
||||
success: function(response) {
|
||||
$('#metadata-container-info').html("");
|
||||
show_metadata(response, modelName)
|
||||
},
|
||||
error: function(xhr, status, error) {
|
||||
$('#metadata-container').html('Error fetching metadata: ' + error + xhr.responseText + status);
|
||||
show_metadata(xhr)
|
||||
$('#metadata-container-info').html('Error fetching metadata: ' + error + xhr.responseText + status);
|
||||
show_metadata(xhr, modelName, true)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function show_metadata(response, name) {
|
||||
function show_metadata(response, name, error = false) {
|
||||
// var formattedMetadata = '<pre>cfg:' + JSON.stringify(response.cfg, null, 4) + '</pre>';
|
||||
// formattedMetadata += '<pre>arch_function:' + response.arch_function + '</pre>';
|
||||
// $('#metadata-container').html(formattedMetadata);
|
||||
@ -123,22 +124,25 @@ $(document).ready(function() {
|
||||
console.log(JSON.stringify(response,null,4))
|
||||
$('#metadata_label').html(name);
|
||||
|
||||
require(["vs/editor/editor.main"], () => {
|
||||
model_editor_json = monaco.editor.create(document.getElementById('toml-editor-container'), {
|
||||
value: response.cfg_toml ? response.cfg_toml + ((response.history) ? "\nHISTORY:\n" + JSON.stringify(response.history,null,4) : "") : JSON.stringify(response,null,4),
|
||||
language: 'toml',
|
||||
theme: 'tomlTheme-dark',
|
||||
automaticLayout: true,
|
||||
readOnly: true
|
||||
});
|
||||
model_editor_python = monaco.editor.create(document.getElementById('python-editor-container'), {
|
||||
value: response.arch_function ? response.arch_function : '',
|
||||
language: 'python',
|
||||
theme: 'tomlTheme-dark',
|
||||
automaticLayout: true,
|
||||
readOnly: true
|
||||
});
|
||||
});
|
||||
if (!error) {
|
||||
console.log("init editoru", error)
|
||||
require(["vs/editor/editor.main"], () => {
|
||||
model_editor_json = monaco.editor.create(document.getElementById('toml-editor-container'), {
|
||||
value: response.cfg_toml ? response.cfg_toml + ((response.history) ? "\nHISTORY:\n" + JSON.stringify(response.history,null,4) : "") : JSON.stringify(response,null,4),
|
||||
language: 'toml',
|
||||
theme: 'tomlTheme-dark',
|
||||
automaticLayout: true,
|
||||
readOnly: true
|
||||
});
|
||||
model_editor_python = monaco.editor.create(document.getElementById('python-editor-container'), {
|
||||
value: response.arch_function ? response.arch_function : '',
|
||||
language: 'python',
|
||||
theme: 'tomlTheme-dark',
|
||||
automaticLayout: true,
|
||||
readOnly: true
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Fetch models on page load
|
||||
|
||||
Reference in New Issue
Block a user