Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added dynamic node movement #223

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/components/SettingsView/SettingsMainView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -205,13 +205,20 @@
</select>
</div>
<div class="input-group flex-nowrap">
<span class="input-group-text">GPT API Key</span>
<span class="input-group-text">OpenAI API Key</span>
<input
v-model="currentSettings.gpt.apiToken"
type="text"
:type="showPassword ? 'text' : 'password'"
class="form-control"
title="Enter your OpenAI API key"
>
<button
type="button"
class="btn btn-outline-secondary"
@click="togglePasswordVisibility"
>
<i :class="showPassword ? 'fa fa-eye-slash' : 'fa fa-eye'" />
</button>
</div>
<small class="form-text text-muted">
The OpenAI API key is used to generate Cypher queries from natural language using the specified model.
Expand Down Expand Up @@ -302,6 +309,7 @@ export default {
gptModelOptions: GPT_MODELS,
databaseResetStateText: "",
databaseResetStateClass: "primary",
showPassword: false,
}),
computed: {
...mapStores(useSettingsStore, useModeStore),
Expand All @@ -315,6 +323,9 @@ export default {
this.modal.dispose();
},
methods: {
togglePasswordVisibility() {
this.showPassword = !this.showPassword;
},
toggleModal() {
this.modal.toggle();
},
Expand Down
26 changes: 22 additions & 4 deletions src/components/ShellView/ResultGraph.vue
Original file line number Diff line number Diff line change
Expand Up @@ -365,8 +365,24 @@ export default {
layout: {
type: 'force',
preventOverlap: true,
linkDistance: 300,
nodeStrength: -50,
linkDistance: d => {
if (d.source.id === 'node0') {
return 100;
}
return 30;
},
nodeStrength: d => {
if (d.isLeaf) {
return -50;
}
return 0.1;
},
edgeStrength: d => {
if (d.source.id === 'node1' || d.source.id === 'node2' || d.source.id === 'node3') {
return 0.7;
}
return 0.1;
},
nodeSpacing: 80,
alpha: 0.5,
alphaDecay: 0.05,
Expand Down Expand Up @@ -451,9 +467,11 @@ export default {
// Auto layout after drag
this.g6Graph.on('node:dragstart', (e) => {
this.g6Graph.layout();
this.refreshDraggedNodePosition(e);
});

this.g6Graph.on('node:drag', (e) => {
this.g6Graph.layout();
this.refreshDraggedNodePosition(e);
});

Expand Down Expand Up @@ -631,11 +649,11 @@ export default {
g6Rel.type = "loop";
g6Rel.loopCfg = {
dist: 50,
position: LOOP_POSITIONS[(numberOfOverlappingRels - 1) % LOOP_POSITIONS.length],
position: LOOP_POSITIONS[(numberOfOverlappingRels-1) % LOOP_POSITIONS.length],
};
} else if (numberOfOverlappingRels > 1) {
g6Rel.type = 'quadratic';
g6Rel.curveOffset = ARC_CURVE_OFFSETS[(numberOfOverlappingRels - 1) % ARC_CURVE_OFFSETS.length];
g6Rel.curveOffset = ARC_CURVE_OFFSETS[(numberOfOverlappingRels-2) % ARC_CURVE_OFFSETS.length];
}

const expectedPropertiesType = {};
Expand Down
Loading