visualknowledge 0.1.1 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server.py +15 -1
package/package.json
CHANGED
package/server.py
CHANGED
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
import json
|
|
2
|
+
import mimetypes
|
|
2
3
|
import os
|
|
3
4
|
import sys
|
|
4
5
|
import logging
|
|
5
6
|
from flask import Flask, request, Response, jsonify, send_from_directory
|
|
6
7
|
from anthropic import Anthropic
|
|
7
8
|
|
|
9
|
+
# Ensure .jsx files are served with correct JS MIME type for ES modules
|
|
10
|
+
mimetypes.add_type('application/javascript', '.jsx')
|
|
11
|
+
|
|
8
12
|
sys.path.insert(0, os.path.join(os.path.dirname(__file__), 'skills'))
|
|
9
13
|
from visualize import get_skill_prompt
|
|
10
14
|
|
|
@@ -51,14 +55,24 @@ graph TD
|
|
|
51
55
|
- 最后给出总结要点"""
|
|
52
56
|
|
|
53
57
|
|
|
58
|
+
FRONTEND_DIR = os.path.join(BASE_DIR, 'frontend')
|
|
59
|
+
|
|
54
60
|
@app.route('/')
|
|
55
61
|
def index():
|
|
56
|
-
resp = send_from_directory(
|
|
62
|
+
resp = send_from_directory(FRONTEND_DIR, 'index.html')
|
|
57
63
|
resp.headers['Cache-Control'] = 'no-cache, no-store, must-revalidate'
|
|
58
64
|
resp.headers['Pragma'] = 'no-cache'
|
|
59
65
|
resp.headers['Expires'] = '0'
|
|
60
66
|
return resp
|
|
61
67
|
|
|
68
|
+
@app.route('/<path:path>')
|
|
69
|
+
def static_files(path):
|
|
70
|
+
"""Serve all static files (CSS, JS) from the frontend directory."""
|
|
71
|
+
file_path = os.path.join(FRONTEND_DIR, path)
|
|
72
|
+
if os.path.isfile(file_path):
|
|
73
|
+
return send_from_directory(FRONTEND_DIR, path)
|
|
74
|
+
return ('Not found', 404)
|
|
75
|
+
|
|
62
76
|
|
|
63
77
|
@app.route('/api/models', methods=['GET'])
|
|
64
78
|
def get_models():
|