diff --git a/ai/__pycache__/local_ai_api.cpython-311.pyc b/ai/__pycache__/local_ai_api.cpython-311.pyc index c4653af..ea3b8c7 100644 Binary files a/ai/__pycache__/local_ai_api.cpython-311.pyc and b/ai/__pycache__/local_ai_api.cpython-311.pyc differ diff --git a/ai/local_ai_api.py b/ai/local_ai_api.py index bcff732..41d3bdb 100644 --- a/ai/local_ai_api.py +++ b/ai/local_ai_api.py @@ -345,6 +345,7 @@ def _http_request(url: str, method: str, body: Optional[bytes], headers: Dict[st Shared HTTP helper for GET/POST requests. """ 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(): req.add_header(name, value) diff --git a/assets/pasted-20260312-153741-1f205004.png b/assets/pasted-20260312-153741-1f205004.png new file mode 100644 index 0000000..033aa01 Binary files /dev/null and b/assets/pasted-20260312-153741-1f205004.png differ diff --git a/core/__pycache__/ai_helpers.cpython-311.pyc b/core/__pycache__/ai_helpers.cpython-311.pyc index 38e324a..8197096 100644 Binary files a/core/__pycache__/ai_helpers.cpython-311.pyc and b/core/__pycache__/ai_helpers.cpython-311.pyc differ diff --git a/core/__pycache__/ai_views.cpython-311.pyc b/core/__pycache__/ai_views.cpython-311.pyc index 6bb38c2..b4acfe6 100644 Binary files a/core/__pycache__/ai_views.cpython-311.pyc and b/core/__pycache__/ai_views.cpython-311.pyc differ diff --git a/core/__pycache__/urls.cpython-311.pyc b/core/__pycache__/urls.cpython-311.pyc index 3a131a7..7c6ead7 100644 Binary files a/core/__pycache__/urls.cpython-311.pyc and b/core/__pycache__/urls.cpython-311.pyc differ diff --git a/core/__pycache__/views.cpython-311.pyc b/core/__pycache__/views.cpython-311.pyc index 587c879..a1fb0eb 100644 Binary files a/core/__pycache__/views.cpython-311.pyc and b/core/__pycache__/views.cpython-311.pyc differ diff --git a/core/ai_helpers.py b/core/ai_helpers.py index 67e03af..d5987ad 100644 --- a/core/ai_helpers.py +++ b/core/ai_helpers.py @@ -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": "user", "content": prompt} ], - "response_format": {"type": "json_object"} + "text": {"format": {"type": "json_object"}} }) if response.get("success"): diff --git a/core/ai_views.py b/core/ai_views.py index 25cb272..5103011 100644 --- a/core/ai_views.py +++ b/core/ai_views.py @@ -50,7 +50,7 @@ Instructions: {"role": "system", "content": system_prompt}, {"role": "user", "content": user_message} ], - "response_format": {"type": "json_object"} + "text": {"format": {"type": "json_object"}} }) if response.get("success"): diff --git a/core/templates/core/project_detail.html b/core/templates/core/project_detail.html index 5ac7b58..aa2a48d 100644 --- a/core/templates/core/project_detail.html +++ b/core/templates/core/project_detail.html @@ -15,14 +15,33 @@
-
+
Interactive Mind Map
- +
+
+ {% csrf_token %} + +
+ +
-
+
+ {% if not nodes %} +
+

The mind map is empty

+

Something went wrong during generation, or the map was cleared.

+
+ {% csrf_token %} + +
+
+ {% endif %}
+
diff --git a/core/urls.py b/core/urls.py index f1e9278..36fa0ba 100644 --- a/core/urls.py +++ b/core/urls.py @@ -1,5 +1,5 @@ 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 urlpatterns = [ @@ -7,6 +7,7 @@ urlpatterns = [ path("projects/", project_list, name="project_list"), path("projects/new/", create_project, name="create_project"), path("projects//", project_detail, name="project_detail"), + path("projects//regenerate/", regenerate_mindmap, name="regenerate_mindmap"), path("projects//ai/", ai_chat, name="ai_chat"), path("signup/", signup, name="signup"), ] \ No newline at end of file diff --git a/core/views.py b/core/views.py index 51a3454..4a2e209 100644 --- a/core/views.py +++ b/core/views.py @@ -46,3 +46,12 @@ def create_project(request): generate_initial_mindmap(project) return redirect('project_detail', pk=project.pk) 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) \ No newline at end of file