Skip to content

Commit d29ed25

Browse files
committed
Merge remote-tracking branch 'origin/docs'
2 parents f45ab97 + cf11125 commit d29ed25

File tree

5 files changed

+118
-4
lines changed

5 files changed

+118
-4
lines changed

docs/docs/chat.md

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,27 @@
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>

docs/docs/extra.css

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,59 @@
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+
}

docs/docs/guides/api-docs.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ In a Django template, for example:
104104
To 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

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
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+
});

docs/mkdocs.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ extra:
1010
property: G-0E3XZ663ZR
1111
extra_css:
1212
- extra.css
13+
extra_javascript:
14+
- javascripts/ask-ai-button.js
1315
theme:
1416
name: material
1517
palette:

0 commit comments

Comments
 (0)