crystalwindow 4.2__tar.gz → 4.3__tar.gz
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.
- {crystalwindow-4.2/crystalwindow.egg-info → crystalwindow-4.3}/PKG-INFO +1 -1
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/ai.py +107 -112
- {crystalwindow-4.2 → crystalwindow-4.3/crystalwindow.egg-info}/PKG-INFO +1 -1
- {crystalwindow-4.2 → crystalwindow-4.3}/setup.py +1 -1
- {crystalwindow-4.2 → crystalwindow-4.3}/LICENSE +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/MANIFEST.in +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/README.md +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/FileHelper.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/Icons/default_icon.png +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/__init__.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/animation.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/assets.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/camera.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/clock.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/collision.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/color_handler.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/crystal3d.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/docs/getting_started.md +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/docs/index.md +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/draw_helpers.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/draw_rects.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/draw_text_helper.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/draw_tool.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/fun_helpers.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gametests/3dsquare.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gametests/__init__.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gametests/__main__.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gametests/gravitytest.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gametests/guitesting.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gametests/sandbox.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gametests/squaremove.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gametests/windowtesting.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gravity.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gui.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/gui_ext.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/math.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/player.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/sprites.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/tilemap.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/ver_warner.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow/window.py +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow.egg-info/SOURCES.txt +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow.egg-info/dependency_links.txt +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/crystalwindow.egg-info/top_level.txt +0 -0
- {crystalwindow-4.2 → crystalwindow-4.3}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crystalwindow
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3
|
|
4
4
|
Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
|
|
5
5
|
Home-page: https://pypi.org/project/crystalwindow/
|
|
6
6
|
Author: CrystalBallyHereXD
|
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
# ==========================================================
|
|
2
|
-
# CrystalAI v0.
|
|
2
|
+
# CrystalAI v0.7 — Self-Contained Symbolic Engine
|
|
3
3
|
# ----------------------------------------------------------
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
# -
|
|
7
|
-
# -
|
|
4
|
+
# Focus: Pure Python 'thinking' (Knowledge Graph/Rule-Based)
|
|
5
|
+
# Changes:
|
|
6
|
+
# - Refactored _local_ai to _symbolic_engine
|
|
7
|
+
# - Added a simple knowledge base (K-Graph)
|
|
8
|
+
# - Added context/intent matching for 'thinking'
|
|
9
|
+
# - Removed Groq/External API integration
|
|
8
10
|
# ==========================================================
|
|
9
11
|
|
|
10
12
|
import os
|
|
11
13
|
import ast
|
|
12
14
|
import difflib
|
|
13
|
-
from typing import Optional, Dict, Any
|
|
14
|
-
|
|
15
|
-
import groq
|
|
16
|
-
|
|
15
|
+
from typing import Optional, Dict, Any, List
|
|
16
|
+
# Removed requests and groq imports as they are no longer needed
|
|
17
|
+
# Removed import groq (if it was present)
|
|
17
18
|
|
|
18
19
|
# ==========================================================
|
|
19
20
|
# Response Wrapper
|
|
@@ -31,42 +32,34 @@ class CrystalAIResponse:
|
|
|
31
32
|
# MAIN ENGINE
|
|
32
33
|
# ==========================================================
|
|
33
34
|
class AI:
|
|
34
|
-
DEFAULT_MODEL = "
|
|
35
|
+
DEFAULT_MODEL = "PURE_SYMBOLIC"
|
|
35
36
|
DEFAULT_PERSONALITY = (
|
|
36
|
-
"You are
|
|
37
|
-
"
|
|
38
|
-
"
|
|
37
|
+
"You are CrystalMind AI, a completely self-coded, symbolic engine. "
|
|
38
|
+
"I process information using an internal rule-base and knowledge graph. "
|
|
39
|
+
"I can reason about simple code and defined concepts."
|
|
39
40
|
)
|
|
40
|
-
|
|
41
|
+
# Key is ignored in this self-contained mode, but kept for signature consistency
|
|
42
|
+
PLACEHOLDER_KEY = "PURE_SYMBOLIC_KEY_IGNORED"
|
|
41
43
|
|
|
42
44
|
# ------------------------------------------------------
|
|
43
45
|
def __init__(self, key=None, model=None):
|
|
44
|
-
# --- KEY
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
self.key = self.PLACEHOLDER_KEY
|
|
48
|
-
else:
|
|
49
|
-
self.key = key
|
|
50
|
-
|
|
51
|
-
# --- MODEL VALIDATION ---
|
|
52
|
-
if not model or not isinstance(model, str) or len(model) < 3:
|
|
53
|
-
print("[CrystalAI] Unknown model → using default.")
|
|
54
|
-
self.model = self.DEFAULT_MODEL
|
|
55
|
-
else:
|
|
56
|
-
self.model = model
|
|
57
|
-
|
|
58
|
-
# Persona
|
|
46
|
+
# --- KEY/MODEL SETUP (for consistency, though ignored) ---
|
|
47
|
+
self.key = self.PLACEHOLDER_KEY
|
|
48
|
+
self.model = self.DEFAULT_MODEL
|
|
59
49
|
self.personality = self.DEFAULT_PERSONALITY
|
|
60
50
|
|
|
61
|
-
#
|
|
62
|
-
self.
|
|
51
|
+
# --- PURE AI KNOWLEDGE BASE (The 'Thinking' Core) ---
|
|
52
|
+
self.knowledge_graph: Dict[str, Any] = self._build_knowledge_graph()
|
|
63
53
|
|
|
64
54
|
# v0.4 memory system (optional)
|
|
65
|
-
self.memory = []
|
|
55
|
+
self.memory: List[Dict[str, str]] = []
|
|
66
56
|
self.use_memory = True
|
|
67
57
|
|
|
68
58
|
# v0.4 toggle for forcing local engine
|
|
69
|
-
self.force_local =
|
|
59
|
+
self.force_local = True # Always True for a self-contained AI
|
|
60
|
+
|
|
61
|
+
# Library knowledge (loaded .py files)
|
|
62
|
+
self.library_context = ""
|
|
70
63
|
|
|
71
64
|
# ==========================================================
|
|
72
65
|
# PERSONALITY
|
|
@@ -90,6 +83,7 @@ class AI:
|
|
|
90
83
|
def index_library(self, folder):
|
|
91
84
|
"""
|
|
92
85
|
Load all Python files as context for smarter answers.
|
|
86
|
+
(Context is used in prompt but processed by local engine's rules)
|
|
93
87
|
"""
|
|
94
88
|
out = []
|
|
95
89
|
if not os.path.exists(folder):
|
|
@@ -151,102 +145,102 @@ class AI:
|
|
|
151
145
|
self.memory.pop(0)
|
|
152
146
|
|
|
153
147
|
# ==========================================================
|
|
154
|
-
#
|
|
148
|
+
# PURE AI KNOWLEDGE BASE (Self-Contained 'Knowledge')
|
|
149
|
+
# ==========================================================
|
|
150
|
+
def _build_knowledge_graph(self) -> Dict[str, Any]:
|
|
151
|
+
"""
|
|
152
|
+
Defines the internal knowledge the pure AI can reason with.
|
|
153
|
+
"""
|
|
154
|
+
return {
|
|
155
|
+
"python": {
|
|
156
|
+
"desc": "A high-level, interpreted programming language.",
|
|
157
|
+
"keywords": ["language", "interpreted", "high-level"],
|
|
158
|
+
"syntax": {
|
|
159
|
+
"if_statement": "if condition: ... else: ...",
|
|
160
|
+
"loop": "for item in iterable: ..."
|
|
161
|
+
}
|
|
162
|
+
},
|
|
163
|
+
"ast": {
|
|
164
|
+
"desc": "Abstract Syntax Tree. Used for parsing code structure.",
|
|
165
|
+
"keywords": ["parsing", "code", "structure", "tree"]
|
|
166
|
+
},
|
|
167
|
+
"fix_code": {
|
|
168
|
+
"rule": "look for SyntaxError, especially missing colons or mismatched brackets",
|
|
169
|
+
"keywords": ["fix", "error", "bug", "syntax"]
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
# ==========================================================
|
|
174
|
+
# PURE AI 'THINKING' ENGINE (Replaces _local_ai)
|
|
155
175
|
# ==========================================================
|
|
156
|
-
def
|
|
176
|
+
def _symbolic_engine(self, prompt: str, file_data: Optional[str]) -> str:
|
|
157
177
|
"""
|
|
158
|
-
|
|
159
|
-
- If file provided → real AST analysis
|
|
160
|
-
- If general question → helpful offline response
|
|
161
|
-
- No more random jokes or irrelevant "forgot a colon"
|
|
178
|
+
Simulates 'thinking' using only internal rules and the knowledge graph.
|
|
162
179
|
"""
|
|
180
|
+
output = ["[SymbolicEngine] Processing request..."]
|
|
181
|
+
lower_prompt = prompt.lower()
|
|
163
182
|
|
|
164
|
-
# ---
|
|
183
|
+
# --- Stage 1: File Analysis (Real Python AST) ---
|
|
165
184
|
if file_data and not file_data.startswith("[CrystalAI]"):
|
|
185
|
+
output.append("\n[Stage 1: Code Parsing]")
|
|
166
186
|
try:
|
|
167
187
|
ast.parse(file_data)
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
"Ask me to explain, summarize, refactor, or improve something."
|
|
172
|
-
)
|
|
188
|
+
output.append("✅ **No Syntax Errors Detected** (via AST).")
|
|
189
|
+
output.append("The code is structurally sound. Ask for refactoring or explanation.")
|
|
190
|
+
return "\n".join(output)
|
|
173
191
|
except SyntaxError as se:
|
|
192
|
+
# Use the built-in fix rule from the knowledge graph
|
|
193
|
+
fix_rule = self.knowledge_graph["fix_code"]["rule"]
|
|
174
194
|
lineno = se.lineno or 0
|
|
175
195
|
offset = se.offset or 0
|
|
176
196
|
msg = (
|
|
177
|
-
f"
|
|
197
|
+
f"❌ **SyntaxError Detected** (via AST):\n"
|
|
178
198
|
f"• Message: {se.msg}\n"
|
|
179
199
|
f"• Line: {lineno}\n"
|
|
180
|
-
f"• Column: {offset}\n
|
|
200
|
+
f"• Column: {offset}\n"
|
|
201
|
+
f"• Rule suggestion: {fix_rule}"
|
|
181
202
|
)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
"
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
"
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
)
|
|
203
|
+
output.append(msg)
|
|
204
|
+
output.append(self._snippet(file_data, lineno))
|
|
205
|
+
return "\n".join(output)
|
|
206
|
+
|
|
207
|
+
# --- Stage 2: Knowledge Graph Lookup (Rule-Based Reasoning) ---
|
|
208
|
+
output.append("\n[Stage 2: Symbolic Lookup]")
|
|
209
|
+
|
|
210
|
+
# Check for concepts the AI 'knows'
|
|
211
|
+
found_concept = False
|
|
212
|
+
for key, knowledge in self.knowledge_graph.items():
|
|
213
|
+
if key in lower_prompt or any(k in lower_prompt for k in knowledge.get("keywords", [])):
|
|
214
|
+
if key == "fix_code": continue # Already handled in Stage 1
|
|
215
|
+
|
|
216
|
+
output.append(f"🧠 Found Concept: **{key.upper()}**")
|
|
217
|
+
output.append(f"Description: {knowledge.get('desc', 'No detailed description.')}")
|
|
218
|
+
|
|
219
|
+
# Simple reasoning about related syntax
|
|
220
|
+
if 'syntax' in knowledge:
|
|
221
|
+
output.append("Related Syntax:")
|
|
222
|
+
for syn, code in knowledge['syntax'].items():
|
|
223
|
+
output.append(f" - {syn.replace('_', ' ')}: `{code}`")
|
|
224
|
+
|
|
225
|
+
found_concept = True
|
|
226
|
+
break
|
|
227
|
+
|
|
228
|
+
if not found_concept:
|
|
229
|
+
output.append("❓ Concept Unknown: I am limited to my internal knowledge base (Python, AST, Fix Code).")
|
|
230
|
+
output.append("Please ask about a defined concept or provide a file for AST analysis.")
|
|
231
|
+
|
|
232
|
+
|
|
233
|
+
return "\n".join(output)
|
|
213
234
|
|
|
214
235
|
# ==========================================================
|
|
215
|
-
# ASK (
|
|
236
|
+
# ASK (Pure Symbolic Engine)
|
|
216
237
|
# ==========================================================
|
|
217
238
|
def ask(self, text, file=None):
|
|
218
239
|
file_data = self._read_file(file)
|
|
219
240
|
prompt = self._build_prompt(text, file_data)
|
|
220
|
-
|
|
221
|
-
#
|
|
222
|
-
|
|
223
|
-
url = "https://api.groq.com/openai/v1/chat/completions"
|
|
224
|
-
headers = {
|
|
225
|
-
"Authorization": f"Bearer {self.key}",
|
|
226
|
-
"Content-Type": "application/json"
|
|
227
|
-
}
|
|
228
|
-
|
|
229
|
-
payload = {
|
|
230
|
-
"model": "llama-3.3-70b-versatile",
|
|
231
|
-
"messages": [
|
|
232
|
-
{"role": "system", "content": self.personality},
|
|
233
|
-
{"role": "user", "content": prompt}
|
|
234
|
-
],
|
|
235
|
-
"temperature": 0.3
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
import requests
|
|
239
|
-
r = requests.post(url, json=payload, headers=headers, timeout=8)
|
|
240
|
-
data = r.json()
|
|
241
|
-
|
|
242
|
-
if "error" in data:
|
|
243
|
-
raise RuntimeError(data["error"])
|
|
244
|
-
|
|
245
|
-
resp = data["choices"][0]["message"]["content"]
|
|
246
|
-
|
|
247
|
-
except Exception:
|
|
248
|
-
# Groq unreachable → fallback
|
|
249
|
-
resp = self._local_ai(prompt, file_data)
|
|
241
|
+
|
|
242
|
+
# We skip the external API call entirely, relying on the symbolic engine
|
|
243
|
+
resp = self._symbolic_engine(prompt, file_data)
|
|
250
244
|
|
|
251
245
|
self._save_memory(text, resp)
|
|
252
246
|
return CrystalAIResponse(resp)
|
|
@@ -326,9 +320,10 @@ class AI:
|
|
|
326
320
|
out = []
|
|
327
321
|
for i in range(start, end):
|
|
328
322
|
mark = "->" if (i + 1) == lineno else " "
|
|
329
|
-
|
|
323
|
+
# Adjusted line formatting for clarity
|
|
324
|
+
out.append(f"{mark} {i+1:<4}: {lines[i]}")
|
|
330
325
|
return "\n".join(out)
|
|
331
326
|
|
|
332
327
|
# ==========================================================
|
|
333
|
-
# END OF ENGINE
|
|
334
|
-
# ==========================================================
|
|
328
|
+
# END OF PURE SYMBOLIC ENGINE
|
|
329
|
+
# ==========================================================
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: crystalwindow
|
|
3
|
-
Version: 4.
|
|
3
|
+
Version: 4.3
|
|
4
4
|
Summary: A Tkinter powered window + GUI toolkit made by Crystal (MEEEEEE)! Easier apps, smoother UI and all-in-one helpers!
|
|
5
5
|
Home-page: https://pypi.org/project/crystalwindow/
|
|
6
6
|
Author: CrystalBallyHereXD
|
|
@@ -7,7 +7,7 @@ with open("README.md", encoding="utf-8") as f:
|
|
|
7
7
|
|
|
8
8
|
setup(
|
|
9
9
|
name="crystalwindow",
|
|
10
|
-
version="4.
|
|
10
|
+
version="4.3", # Force metadata refresh
|
|
11
11
|
packages=find_packages(include=["crystalwindow", "crystalwindow.*"]),
|
|
12
12
|
|
|
13
13
|
include_package_data=True, # include package_data files
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|