File tree Expand file tree Collapse file tree 5 files changed +118
-4
lines changed Expand file tree Collapse file tree 5 files changed +118
-4
lines changed Original file line number Diff line number Diff line change 1- # Demo
1+ # Ask AI
22
3- <strong >test</strong >
3+ Please feel free to share any questions or describe any problems you're encountering. Simply enter your text in the chat, and I'll be happy to assist you.
4+
5+ <style >
6+ .serenity_chat__powered { display : none !important ; }
7+ .md-sidebar--secondary { display : none !important ; }
8+ .serenity_widget__container {
9+ max-width : 1200px !important ;
10+ }
11+
12+ .serenity_app {
13+ --serenity-answer-code-bg : #fafafa ;
14+ --serenity-widget-bg : #ffffff ;
15+ }
16+ </style >
17+
18+ <div id =" serenity " ></div >
19+
20+ <script >
21+ var SERENITY_WIDGET = {
22+ api_url: " https://public.serenitygpt.com/api/v2/" ,
23+ api_token: " FqbM1QFShh5mGOD7" ,
24+ popup: false ,
25+ };
26+ </script >
27+ <script src =" https://js.serenitygpt.com/widget.js " ></script >
Original file line number Diff line number Diff line change 11.doc-module code {
22 white-space : nowrap;
33}
4+
5+ /* Ask AI Button Styles */
6+ .ask-ai-button-container {
7+ display : flex;
8+ align-items : center;
9+ margin-left : auto;
10+ margin-right : 1rem ;
11+ }
12+
13+ .ask-ai-button {
14+ background-color : white !important ;
15+ color : # 4caf50 !important ; /* Material green-500 */
16+ padding : 0.4rem 0.5rem !important ;
17+ border-radius : 0.25rem ;
18+ font-weight : 500 ;
19+ text-decoration : none;
20+ font-size : 0.9rem ;
21+ border : 2px solid # 4caf50 ;
22+ transition : all 0.2s ease-in-out;
23+ white-space : nowrap;
24+ margin-left : 8px ;
25+ }
26+
27+ .ask-ai-button : hover {
28+ background-color : # 4caf50 !important ;
29+ color : white !important ;
30+ box-shadow : 0 2px 4px rgba (0 , 0 , 0 , 0.2 );
31+ }
32+
33+ /* Dark mode support */
34+ [data-md-color-scheme = "slate" ] .ask-ai-button {
35+ background-color : white !important ;
36+ color : # 4caf50 !important ;
37+ }
38+
39+ [data-md-color-scheme = "slate" ] .ask-ai-button : hover {
40+ background-color : # 4caf50 !important ;
41+ color : white !important ;
42+ }
43+
44+ /* Responsive adjustments */
45+ @media screen and (max-width : 76.1875em ) {
46+ .ask-ai-button-container {
47+ margin-right : 0.5rem ;
48+ }
49+ .ask-ai-button {
50+ padding : 0.4rem 0.8rem !important ;
51+ font-size : 0.85rem ;
52+ }
53+ }
54+
55+ @media screen and (max-width : 60em ) {
56+ .ask-ai-button-container {
57+ display : none; /* Hide on mobile to save space */
58+ }
59+ }
Original file line number Diff line number Diff line change @@ -104,9 +104,9 @@ In a Django template, for example:
104104To create your own view for OpenAPI - create a class inherited from DocsBase and overwrite ` render_page ` method:
105105
106106``` python
107- form ninja.openapi.docs import DocsBase
107+ from ninja.openapi.docs import DocsBase
108108
109- class MyDocsViewer (DocsBase )
109+ class MyDocsViewer (DocsBase ):
110110 def render_page (self , request , api ):
111111 ... # return http response
112112
Original file line number Diff line number Diff line change 1+ // Add "Ask AI" button to the Material for MkDocs navbar
2+ document . addEventListener ( 'DOMContentLoaded' , function ( ) {
3+ // Find the header navigation actions (right side of navbar)
4+ const headerActions = document . querySelector ( '.md-header__topic + .md-header__option' ) ;
5+ const headerTitle = document . querySelector ( '.md-header__title' ) ;
6+
7+ if ( headerTitle ) {
8+ // Create the Ask AI button
9+ const askAiButton = document . createElement ( 'a' ) ;
10+ askAiButton . href = '/chat' ; // Update this URL to your desired destination
11+ askAiButton . className = 'md-button ask-ai-button' ;
12+ askAiButton . textContent = 'Ask AI' ;
13+ askAiButton . title = 'Ask AI about Django Ninja' ;
14+
15+ // Create a container for the button
16+ const buttonContainer = document . createElement ( 'div' ) ;
17+ buttonContainer . className = 'ask-ai-button-container' ;
18+ buttonContainer . appendChild ( askAiButton ) ;
19+
20+ // Insert the button after the header title
21+ const header = document . querySelector ( '.md-header__inner' ) ;
22+ if ( header ) {
23+ // Find the right spot - after title, before search/repo buttons
24+ const source = document . querySelector ( '.md-header__source' ) ;
25+ if ( source ) {
26+ header . insertBefore ( buttonContainer , source ) ;
27+ } else {
28+ header . appendChild ( buttonContainer ) ;
29+ }
30+ }
31+ }
32+ } ) ;
Original file line number Diff line number Diff line change 1010 property : G-0E3XZ663ZR
1111extra_css :
1212 - extra.css
13+ extra_javascript :
14+ - javascripts/ask-ai-button.js
1315theme :
1416 name : material
1517 palette :
You can’t perform that action at this time.
0 commit comments