Peter Michael Gits Claude commited on
Commit
57587a5
·
1 Parent(s): 0a089de

feat: Add version tracking and /version API endpoint v0.3.7

Browse files

- Add version.py with semantic versioning (v0.3.7)
- Implement /version RESTful API endpoint in both debug_app.py and app.py
- Mount FastAPI to Gradio for custom API routes
- Update main README.md to reflect new version and features
- Enhanced debugging interface with version information display

Version API usage: GET /version returns JSON with version info
Debug interface now shows version information in UI

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

Files changed (3) hide show
  1. app.py +16 -0
  2. debug_app.py +28 -0
  3. version.py +16 -0
app.py CHANGED
@@ -18,6 +18,7 @@ from core.chat_agent import ChatCalAgent
18
  from core.session_manager import SessionManager
19
  from core.audio_handler import AudioHandler
20
  from core.config import config
 
21
 
22
  class ChatCalVoiceApp:
23
  """Main application class for voice-enabled ChatCal."""
@@ -295,8 +296,23 @@ app = ChatCalVoiceApp()
295
 
296
  # Create and launch the interface
297
  if __name__ == "__main__":
 
 
 
 
 
 
 
 
 
 
 
 
298
  demo = app.create_interface()
299
 
 
 
 
300
  # Launch configuration
301
  demo.launch(
302
  server_name="0.0.0.0",
 
18
  from core.session_manager import SessionManager
19
  from core.audio_handler import AudioHandler
20
  from core.config import config
21
+ from version import get_version_info
22
 
23
  class ChatCalVoiceApp:
24
  """Main application class for voice-enabled ChatCal."""
 
296
 
297
  # Create and launch the interface
298
  if __name__ == "__main__":
299
+ from fastapi import FastAPI
300
+ from fastapi.responses import JSONResponse
301
+
302
+ # Create FastAPI app for additional endpoints
303
+ fastapi_app = FastAPI()
304
+
305
+ @fastapi_app.get("/version")
306
+ async def get_version():
307
+ """RESTful API endpoint for version information"""
308
+ return JSONResponse(content=get_version_info())
309
+
310
+ # Create Gradio interface
311
  demo = app.create_interface()
312
 
313
+ # Mount FastAPI to Gradio for version endpoint
314
+ demo.mount_to(fastapi_app)
315
+
316
  # Launch configuration
317
  demo.launch(
318
  server_name="0.0.0.0",
debug_app.py CHANGED
@@ -7,6 +7,8 @@ import gradio as gr
7
  import sys
8
  import traceback
9
  import os
 
 
10
 
11
  def test_imports():
12
  """Test all imports to identify which one is failing"""
@@ -67,9 +69,20 @@ try:
67
  print("=== IMPORT TEST RESULTS ===")
68
  print(import_results)
69
 
 
 
 
 
 
70
  # Create simple Gradio interface
71
  with gr.Blocks(title="ChatCal Debug") as demo:
72
  gr.Markdown("# 🔧 ChatCal Debug Interface")
 
 
 
 
 
 
73
  gr.Markdown("## Import Test Results:")
74
  gr.Textbox(value=import_results, lines=15, label="Import Status", interactive=False)
75
 
@@ -78,6 +91,21 @@ try:
78
  output = gr.Textbox(label="Output")
79
  test_btn.click(simple_interface, outputs=output)
80
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  # Launch with error handling
82
  demo.launch(
83
  server_name="0.0.0.0",
 
7
  import sys
8
  import traceback
9
  import os
10
+ import json
11
+ from version import get_version_info
12
 
13
  def test_imports():
14
  """Test all imports to identify which one is failing"""
 
69
  print("=== IMPORT TEST RESULTS ===")
70
  print(import_results)
71
 
72
+ # Add version endpoint function
73
+ def version_endpoint():
74
+ """Return version information as JSON"""
75
+ return json.dumps(get_version_info(), indent=2)
76
+
77
  # Create simple Gradio interface
78
  with gr.Blocks(title="ChatCal Debug") as demo:
79
  gr.Markdown("# 🔧 ChatCal Debug Interface")
80
+
81
+ gr.Markdown("## Version Information:")
82
+ version_btn = gr.Button("Get Version Info")
83
+ version_output = gr.Textbox(label="Version", interactive=False)
84
+ version_btn.click(version_endpoint, outputs=version_output)
85
+
86
  gr.Markdown("## Import Test Results:")
87
  gr.Textbox(value=import_results, lines=15, label="Import Status", interactive=False)
88
 
 
91
  output = gr.Textbox(label="Output")
92
  test_btn.click(simple_interface, outputs=output)
93
 
94
+ # Add custom API route for version endpoint
95
+ from fastapi import FastAPI
96
+ from fastapi.responses import JSONResponse
97
+
98
+ # Create FastAPI app
99
+ fastapi_app = FastAPI()
100
+
101
+ @fastapi_app.get("/version")
102
+ async def get_version():
103
+ """RESTful API endpoint for version information"""
104
+ return JSONResponse(content=get_version_info())
105
+
106
+ # Mount FastAPI to Gradio
107
+ demo.mount_to(fastapi_app)
108
+
109
  # Launch with error handling
110
  demo.launch(
111
  server_name="0.0.0.0",
version.py ADDED
@@ -0,0 +1,16 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """
2
+ Version information for ChatCal Voice-Enabled AI Assistant
3
+ """
4
+
5
+ __version__ = "0.3.7"
6
+ __build_date__ = "2025-08-18"
7
+ __description__ = "Voice-Enabled ChatCal AI Assistant with Hugging Face deployment"
8
+
9
+ def get_version_info():
10
+ """Get detailed version information"""
11
+ return {
12
+ "version": __version__,
13
+ "build_date": __build_date__,
14
+ "description": __description__,
15
+ "status": "running"
16
+ }