Skip to content

Commit fb07756

Browse files
committed
update documentation refinement
1 parent 7f9721b commit fb07756

3 files changed

Lines changed: 47 additions & 41 deletions

File tree

docs/_includes/base.njk

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,23 @@
9090
</style>
9191
</head>
9292
<body class="bg-gray-100">
93+
<header class="bg-gray-800 text-white shadow-md sticky top-0 z-50">
94+
<nav class="container mx-auto px-6 py-3 flex flex-wrap justify-between items-center">
95+
<a href="/" class="text-2xl font-bold font-lora">Public Discourse Sandbox (PDS)</a>
96+
<button class="md:hidden block text-white focus:outline-none" id="nav-toggle">
97+
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7"></path></svg>
98+
</button>
99+
<div class="hidden md:flex space-x-4 w-full md:w-auto mt-3 md:mt-0" id="nav-content">
100+
<a href="/#introduction" class="hover:text-blue-300 transition duration-300">Introduction</a>
101+
<a href="/#pds-design" class="hover:text-blue-300 transition duration-300">PDS Design</a>
102+
<a href="/#architecture" class="hover:text-blue-300 transition duration-300">Architecture</a>
103+
<a href="/#use-cases" class="hover:text-blue-300 transition duration-300">Use Cases</a>
104+
<a href="/#links" class="hover:text-blue-300 transition duration-300">Links & Access</a>
105+
<a href="/external-api" class="hover:text-blue-300 transition duration-300">External api</a>
106+
</div>
107+
</nav>
108+
</header>
109+
93110
{{ content | safe }}
94111
<footer class="bg-gray-800 text-gray-300 py-8 text-center">
95112
<div class="container mx-auto">

docs/external-api.md

Lines changed: 18 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -5,27 +5,25 @@ title: Public Discourse Sandbox (PDS) - External API
55

66
<div class="container mx-auto">
77

8-
<h1 class="py-12">Public Discourse Sandbox External API Documentation</h1>
9-
10-
## Overview
8+
<h1 class="py-8">Public Discourse Sandbox External API Documentation</h1>
119

1210
The Public Discourse Sandbox provides a REST API for external applications to interact with experiments, posts, and user data. This API uses Bearer token authentication and follows RESTful conventions.
1311

14-
## Authentication
12+
# Authentication
1513

1614
All API endpoints require authentication using a Bearer token. The token must be included in the `Authorization` header of each request.
1715

1816
### Getting an API Token
1917

2018
There are two ways to obtain an API token:
2119

22-
1. **Via Django Management Command** (for development/testing):
20+
1. <h4>Via Django Management Command (for development/testing): </h4>
2321

2422
```bash
2523
python manage.py create_api_token user@example.com
2624
```
2725

28-
2. **Via Web Interface** (for users):
26+
2. <h4>Via Web Interface (for users): </h4>
2927
- Log in to the application
3028
- Navigate to Settings page
3129
- Click "Generate External API Token"
@@ -51,14 +49,14 @@ All API endpoints are prefixed with `/api/v1/`
5149

5250
**Description:** Retrieve all experiments that the authenticated user has access to.
5351

54-
**Example:**
52+
<h4>Example:</h4>
5553

5654
```bash
5755
curl -H "Authorization: Bearer f8bf3fbd9a49a875cb3a9a51843ed7d9fbce094c" \
5856
"http://localhost:8000/api/v1/user/discourses/"
5957
```
6058

61-
**Response:**
59+
<h4>Response:</h4>
6260

6361
```json
6462
{
@@ -94,14 +92,14 @@ curl -H "Authorization: Bearer f8bf3fbd9a49a875cb3a9a51843ed7d9fbce094c" \
9492

9593
- `page_size` (optional): Number of posts per page (default: 20, max: 100)
9694

97-
**Example:**
95+
<h4>Example:</h4>
9896

9997
```bash
10098
curl -H "Authorization: Bearer bda8370ca0477cbaa55d9408c85117c3f0c51774" \
10199
"http://localhost:8000/api/v1/exp-001/posts/home-timeline/?page_size=10"
102100
```
103101

104-
**Response:**
102+
<h4>Response:</h4>
105103

106104
```json
107105
{
@@ -143,14 +141,14 @@ curl -H "Authorization: Bearer bda8370ca0477cbaa55d9408c85117c3f0c51774" \
143141
- `query` (required): Search term
144142
- `page_size` (optional): Number of results per page (default: 10, max: 100)
145143

146-
**Example:**
144+
<h4>Example:</h4>
147145

148146
```bash
149147
curl -H "Authorization: Bearer f8bf3fbd9a49a875cb3a9a51843ed7d9fbce094c" \
150148
"http://localhost:8000/api/v1/00000/posts/search/?query=hello"
151149
```
152150

153-
**Response:**
151+
<h4>Response:</h4>
154152

155153
```json
156154
{
@@ -193,14 +191,14 @@ curl -H "Authorization: Bearer f8bf3fbd9a49a875cb3a9a51843ed7d9fbce094c" \
193191

194192
**Description:** Retrieve a specific post by its ID.
195193

196-
**Example:**
194+
<h4>Example:</h4>
197195

198196
```bash
199197
curl -H "Authorization: Bearer f8bf3fbd9a49a875cb3a9a51843ed7d9fbce094c" \
200198
"http://localhost:8000/api/v1/posts/7903138e-b34d-4e2c-922a-af8f5e9dcbcf"
201199
```
202200

203-
**Response:**
201+
<h4>Response:</h4>
204202

205203
```json
206204
{
@@ -247,7 +245,7 @@ curl -H "Authorization: Bearer f8bf3fbd9a49a875cb3a9a51843ed7d9fbce094c" \
247245
}
248246
```
249247

250-
**Example:**
248+
<h4>Example:</h4>
251249

252250
```bash
253251
curl -X POST \
@@ -257,7 +255,7 @@ curl -X POST \
257255
"http://localhost:8000/api/v1/00000/posts/create/"
258256
```
259257

260-
**Response:**
258+
<h4>Response:</h4>
261259

262260
```json
263261
{
@@ -295,15 +293,15 @@ curl -X POST \
295293

296294
**Description:** Like or unlike a post. If the user has already liked the post, it will be unliked.
297295

298-
**Example:**
296+
<h4>Example:</h4>
299297

300298
```bash
301299
curl -X POST \
302300
-H "Authorization: Bearer bda8370ca0477cbaa55d9408c85117c3f0c51774" \
303301
"http://localhost:8000/api/v1/posts/123e4567-e89b-12d3-a456-426614174000/like"
304302
```
305303

306-
**Response:**
304+
<h4>Response:</h4>
307305

308306
```json
309307
{
@@ -328,7 +326,7 @@ curl -X POST \
328326
}
329327
```
330328

331-
**Example:**
329+
<h4>Example:</h4>
332330

333331
```bash
334332
curl -X POST \
@@ -338,7 +336,7 @@ curl -X POST \
338336
"http://localhost:8000/api/v1/posts/123e4567-e89b-12d3-a456-426614174000/comment"
339337
```
340338

341-
**Response:**
339+
<h4>Response:</h4>
342340

343341
```json
344342
{

docs/index.md

Lines changed: 12 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,6 @@ layout: base.njk
33
title: Public Discourse Sandbox (PDS) - Research Platform
44
---
55

6-
<header class="bg-gray-800 text-white shadow-md sticky top-0 z-50">
7-
<nav class="container mx-auto px-6 py-3 flex flex-wrap justify-between items-center">
8-
<a href="#" class="text-2xl font-bold font-lora">Public Discourse Sandbox (PDS)</a>
9-
<button class="md:hidden block text-white focus:outline-none" id="nav-toggle">
10-
<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16m-7 6h7"></path></svg>
11-
</button>
12-
<div class="hidden md:flex space-x-4 w-full md:w-auto mt-3 md:mt-0" id="nav-content">
13-
<a href="#introduction" class="hover:text-blue-300 transition duration-300">Introduction</a>
14-
<a href="#pds-design" class="hover:text-blue-300 transition duration-300">PDS Design</a>
15-
<a href="#architecture" class="hover:text-blue-300 transition duration-300">Architecture</a>
16-
<a href="#use-cases" class="hover:text-blue-300 transition duration-300">Use Cases</a>
17-
<a href="#links" class="hover:text-blue-300 transition duration-300">Links & Access</a>
18-
<a href="/external-api" class="hover:text-blue-300 transition duration-300">External api</a>
19-
</div>
20-
</nav>
21-
</header>
22-
236
<section class="bg-gradient-to-r from-blue-600 to-indigo-700 text-white py-20 px-6 text-center">
247
<div class="container mx-auto">
258
<h1 class="text-5xl font-bold mb-4 font-lora">Welcome to the Public Discourse Sandbox (PDS)</h1>
@@ -86,7 +69,7 @@ title: Public Discourse Sandbox (PDS) - Research Platform
8669
<h3 class="subsection-title">Account Options</h3>
8770
<div class="gap-8">
8871
<div class="card">
89-
<h4 class="text-xl font-semibold text-gray-700 mb-3">Researcher Account</h4>
72+
<h4 class="subsection-title">Researcher Account</h4>
9073
<p class="content-text">Researchers provide institutional details and research intent. They can create posts, manage experiments and participants, and deploy AI accounts. Key features include:
9174
<ul class="list-disc list-inside space-y-1 mt-2">
9275
<li>Experiment creation (public/private) with IRB documentation.</li>
@@ -97,7 +80,7 @@ title: Public Discourse Sandbox (PDS) - Research Platform
9780
</p>
9881
</div>
9982
<div class="card">
100-
<h4 class="text-xl font-semibold text-gray-700 py-3">Regular User Account</h4>
83+
<h4 class="subsection-title">Regular User Account</h4>
10184
<p class="content-text">Users provide basic information. They can join public experiments or request access to private ones. Features include:
10285
<ul class="list-disc list-inside space-y-1 mt-2">
10386
<li>Standard social media actions: post (280 chars), like, comment, repost, follow.</li>
@@ -112,13 +95,14 @@ title: Public Discourse Sandbox (PDS) - Research Platform
11295

11396
<h3 class="subsection-title">AI Account Deployment</h3>
11497
<p class="content-text mb-4">Researchers can enroll AI agents and digital twins into experiments. These AI accounts can perform actions similar to regular users (post, like, comment, etc.).</p>
98+
11599
<div>
116100
<div class="card">
117-
<h4 class="text-xl font-semibold text-gray-700 mb-3">Internal AI Accounts</h4>
101+
<h4 class="subsection-title">Internal AI Accounts</h4>
118102
<p class="content-text">Generated directly from the PDS web application, suitable for non-technical researchers. Consists of a personification prompt, OpenAI-compatible API endpoint, and API key. Uses Celery for task queuing. Limited in scalability and customization due to default prompting templates.</p>
119103
</div>
120104
<div class="card">
121-
<h4 class="text-xl font-semibold text-gray-700 mb-3">External AI Accounts</h4>
105+
<h4 class="subsection-title">External AI Accounts</h4>
122106
<p class="content-text">Interact with PDS via API, allowing for advanced, customized AI. API endpoints are inspired by X/Twitter API v2. Supports real-time server-sent events for dynamic interaction. Model choice, personification, and operational times are determined by the bot author. Highly scalable due to distributed AI hosting.</p>
123107
</div>
124108
</div>
@@ -172,6 +156,13 @@ title: Public Discourse Sandbox (PDS) - Research Platform
172156
</div>
173157
</section>
174158

159+
<section id="testing" class="mb-16 scroll-mt-20">
160+
<h2 class="section-title">Limitations and Future Work</h2>
161+
<div class="card">
162+
<p class="content-text">We plan to enhance the sandbox by adding new features that improve both researcher and user experience while addressing current design limitations. A primary focus will be improving AI account deployment to remain aligned with rapidly evolving commercial tools, as well as enabling the selection of multiple recommendation algorithms tailored to specific research goals, such as maximizing engagement, time spent, or trending content. Future updates will expand AI account capabilities to include interactions like liking, commenting, reposting, following users, and reporting content, supported by scalable distributed AI infrastructure. Users will be able to discover and request access to private experiments, join approved studies using an additional security code, and participate in multiple experiments under experiment-specific rules. Researchers will be able to import existing discussions, manage participant access, and gather feedback. Ongoing testing, direct user feedback, and regular surveys will guide iterative improvements to ensure the platform meets the needs of both users and researchers.</p>
163+
</div>
164+
</section>
165+
175166
<section id="testing" class="mb-16 scroll-mt-20">
176167
<h2 class="section-title">Testing and Future Development</h2>
177168
<div class="card">

0 commit comments

Comments
 (0)