Auto commit: 2026-03-12T16:08:07.812Z
This commit is contained in:
parent
1829bd8f53
commit
134adfbc75
Binary file not shown.
@ -345,6 +345,7 @@ def _http_request(url: str, method: str, body: Optional[bytes], headers: Dict[st
|
|||||||
Shared HTTP helper for GET/POST requests.
|
Shared HTTP helper for GET/POST requests.
|
||||||
"""
|
"""
|
||||||
req = urlrequest.Request(url, data=body, method=method.upper())
|
req = urlrequest.Request(url, data=body, method=method.upper())
|
||||||
|
req.add_header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Flatlogic/1.0")
|
||||||
for name, value in headers.items():
|
for name, value in headers.items():
|
||||||
req.add_header(name, value)
|
req.add_header(name, value)
|
||||||
|
|
||||||
|
|||||||
BIN
assets/pasted-20260312-153741-1f205004.png
Normal file
BIN
assets/pasted-20260312-153741-1f205004.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 452 KiB |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -26,7 +26,7 @@ Create 6-10 interconnected nodes exploring key business areas like Target Audien
|
|||||||
{"role": "system", "content": "You are a helpful business strategy AI. You must respond in valid JSON matching the exact requested format."},
|
{"role": "system", "content": "You are a helpful business strategy AI. You must respond in valid JSON matching the exact requested format."},
|
||||||
{"role": "user", "content": prompt}
|
{"role": "user", "content": prompt}
|
||||||
],
|
],
|
||||||
"response_format": {"type": "json_object"}
|
"text": {"format": {"type": "json_object"}}
|
||||||
})
|
})
|
||||||
|
|
||||||
if response.get("success"):
|
if response.get("success"):
|
||||||
|
|||||||
@ -50,7 +50,7 @@ Instructions:
|
|||||||
{"role": "system", "content": system_prompt},
|
{"role": "system", "content": system_prompt},
|
||||||
{"role": "user", "content": user_message}
|
{"role": "user", "content": user_message}
|
||||||
],
|
],
|
||||||
"response_format": {"type": "json_object"}
|
"text": {"format": {"type": "json_object"}}
|
||||||
})
|
})
|
||||||
|
|
||||||
if response.get("success"):
|
if response.get("success"):
|
||||||
|
|||||||
@ -15,14 +15,33 @@
|
|||||||
<!-- Mind Map Visualization Column -->
|
<!-- Mind Map Visualization Column -->
|
||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="card shadow-sm h-100">
|
<div class="card shadow-sm h-100">
|
||||||
<div class="card-header bg-white d-flex justify-content-between align-items-center">
|
<div class="card-header bg-white d-flex justify-content-between align-items-center">
|
||||||
<h5 class="mb-0">Interactive Mind Map</h5>
|
<h5 class="mb-0">Interactive Mind Map</h5>
|
||||||
<button class="btn btn-sm btn-outline-primary" onclick="fitNetwork()">Reset View</button>
|
<div>
|
||||||
|
<form method="POST" action="{% url 'regenerate_mindmap' project.pk %}" class="d-inline" onsubmit="return confirm('Are you sure you want to regenerate the entire map? This will delete all current nodes.');">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" class="btn btn-sm btn-outline-danger me-2">Regenerate</button>
|
||||||
|
</form>
|
||||||
|
<button class="btn btn-sm btn-outline-primary" onclick="fitNetwork()">Reset View</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="card-body p-0" style="height: 600px; position: relative;">
|
<div class="card-body p-0" style="height: 600px; position: relative;">
|
||||||
|
{% if not nodes %}
|
||||||
|
<div class="position-absolute w-100 h-100 d-flex flex-column justify-content-center align-items-center" style="z-index: 10; background: rgba(255,255,255,0.9);">
|
||||||
|
<h4 class="text-muted mb-3">The mind map is empty</h4>
|
||||||
|
<p class="text-muted mb-4">Something went wrong during generation, or the map was cleared.</p>
|
||||||
|
<form method="POST" action="{% url 'regenerate_mindmap' project.pk %}">
|
||||||
|
{% csrf_token %}
|
||||||
|
<button type="submit" class="btn btn-primary px-4 py-2">
|
||||||
|
Generate Map Now
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
<!-- The vis-network container -->
|
<!-- The vis-network container -->
|
||||||
<div id="mynetwork" style="width: 100%; height: 100%;"></div>
|
<div id="mynetwork" style="width: 100%; height: 100%;"></div>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .views import home, project_list, project_detail, create_project, signup
|
from .views import home, project_list, project_detail, create_project, signup, regenerate_mindmap
|
||||||
from .ai_views import ai_chat
|
from .ai_views import ai_chat
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
@ -7,6 +7,7 @@ urlpatterns = [
|
|||||||
path("projects/", project_list, name="project_list"),
|
path("projects/", project_list, name="project_list"),
|
||||||
path("projects/new/", create_project, name="create_project"),
|
path("projects/new/", create_project, name="create_project"),
|
||||||
path("projects/<int:pk>/", project_detail, name="project_detail"),
|
path("projects/<int:pk>/", project_detail, name="project_detail"),
|
||||||
|
path("projects/<int:pk>/regenerate/", regenerate_mindmap, name="regenerate_mindmap"),
|
||||||
path("projects/<int:pk>/ai/", ai_chat, name="ai_chat"),
|
path("projects/<int:pk>/ai/", ai_chat, name="ai_chat"),
|
||||||
path("signup/", signup, name="signup"),
|
path("signup/", signup, name="signup"),
|
||||||
]
|
]
|
||||||
@ -46,3 +46,12 @@ def create_project(request):
|
|||||||
generate_initial_mindmap(project)
|
generate_initial_mindmap(project)
|
||||||
return redirect('project_detail', pk=project.pk)
|
return redirect('project_detail', pk=project.pk)
|
||||||
return render(request, 'core/create_project.html')
|
return render(request, 'core/create_project.html')
|
||||||
|
|
||||||
|
@login_required
|
||||||
|
def regenerate_mindmap(request, pk):
|
||||||
|
project = get_object_or_404(Project, pk=pk, user=request.user)
|
||||||
|
if request.method == 'POST':
|
||||||
|
project.nodes.all().delete()
|
||||||
|
project.connections.all().delete()
|
||||||
|
generate_initial_mindmap(project)
|
||||||
|
return redirect('project_detail', pk=project.pk)
|
||||||
Loading…
x
Reference in New Issue
Block a user