You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Persisted and displayed per-message `creditsUsed` (computed from token usage), enabling cost auditing per assistant response.
9
+
- Credits initialization/reset exists server-side via scalar chatbot fields + fixed-period logic (this differs from the JSON sketch in this doc).
10
+
11
+
**Remaining**
12
+
- Reconcile this plan with the current implementation so it matches reality.
13
+
- With course↔chatbot many-to-many, decide whether credits are per chatbot or per course↔chatbot context; update schema/unique keys accordingly if per-course.
14
+
5
15
### Existing Structure
6
16
7
-
-`ChatUsageCredits`model tracks credits per participant-chatbot pair
8
-
- Credits are decremented when AI responses consume tokens via `CreditsService.decrementCredits()`
9
-
-Current implementation initializes new users with **0 credits** (critical gap)
10
-
-No automatic reset or refill mechanism exists
11
-
- Frontend displays credit progress bar and switches available models based on credit balance
17
+
-`ChatUsageCredits` tracks credits per `(participantId, chatbotId)`.
18
+
- Credits are initialized and reset via fixed-period logic in `apps/chat/src/services/credits.ts`.
19
+
-Credit policy is stored on `Chatbot` as scalar fields: `creditInitialCredits`, `creditResetPeriod`, `creditResetAmount`, `creditMaxCredits`.
20
+
-Atomic helpers in `apps/chat/src/utils/transactions.ts` avoid race conditions.
21
+
- Frontend uses `/api/chatbots/<chatbotId>/credits` to load `availableModels` + `automaticModelId`.
12
22
13
23
### Identified Issues
14
24
15
-
1.**New User Experience**: Students joining a course get 0 credits, blocking immediate access
16
-
2.**No Reset Mechanism**: Once credits are consumed, users cannot get more without manual intervention
17
-
3.**Missing Configuration**: No way to configure credit policies per chatbot
18
-
4.**No Periodic Refresh**: No support for "X credits per week/month" scenarios
25
+
1.**Plan/documentation drift**: this document still describes a JSON-based configuration that is no longer used.
26
+
2.**Course↔chatbot N:N**: credits are currently chatbot-scoped; keep as-is or decide on course-scoped credits if policy differs by course.
19
27
20
28
## Implementation Plan
21
29
22
30
### Phase 1: Database Schema Updates
23
31
24
-
#### 1.1 Extend Chatbot Model
32
+
#### 1.1 Current Chatbot Credit Fields
25
33
26
-
Add `creditSettings` JSON field to the `Chatbot` model:
34
+
Credit policy is defined via scalar fields on `Chatbot`:
27
35
28
36
```prisma
29
-
model Chatbot {
30
-
// ... existing fields
31
-
32
-
// Credit configuration per chatbot
33
-
creditSettings Json? // {
34
-
// initialCredits: 100,
35
-
// resetPeriod: 'weekly',
36
-
// resetAmount: 50,
37
-
// maxCredits: 100
38
-
// }
39
-
}
40
-
```
41
-
42
-
**Credit Settings Schema:**
43
-
44
-
```typescript
45
-
interfaceCreditSettings {
46
-
initialCredits:number// Credits given to new users
No additional migration is required for credit configuration; the scalar credit fields already exist on `Chatbot`, and the credit tracking fields are present on `ChatUsageCredits`.
305
165
306
166
#### 6.2 Existing User Credits
307
167
@@ -315,23 +175,8 @@ Options for users with 0 credits:
Copy file name to clipboardExpand all lines: project/plans_archive/PLAN-chatbot-disclaimer.md
+15-2Lines changed: 15 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,14 +4,27 @@
4
4
5
5
This plan outlines the implementation of a comprehensive disclaimer system for KlickerUZH chatbots. The system ensures students understand AI limitations, data protection requirements, and usage responsibilities before accessing chatbot functionality. It introduces server-side, versioned consent tracking that is enforced by the chat APIs, while providing flexibility for different courses and departments.
6
6
7
+
## Progress (feat/chat-gpt-5-1)
8
+
9
+
**Done on this branch**
10
+
- Implemented disclaimer read + accept/decline endpoints (`/api/chatbots/[chatbotId]/disclaimer`) with acceptance tracked in `ChatUsageCredits`.
11
+
- Enforced disclaimer acceptance in the main chat send endpoint (blocks usage when required + not accepted).
12
+
13
+
**Remaining**
14
+
- Enforce disclaimer guard consistently across other endpoints (threads/messages/credits) and return `428 Precondition Required` with remediation info as per this plan.
15
+
- With course↔chatbot many-to-many, decide whether disclaimers are per chatbot or per course↔chatbot link (and migrate storage accordingly if per-course).
- Students can immediately access chatbot functionality without understanding limitations
11
22
- No mechanism to inform users about data protection and AI accuracy concerns
12
23
- Lecturers cannot customize introductory content for their specific course context
13
-
- No way to track informed consent for chatbot usage
14
-
- A prototype disclaimer dialog exists client-side only (local storage/cookies) and is not enforced or persisted server-side; there is no version awareness
24
+
- Disclaimer data model exists (`ChatbotDisclaimer`) with chatbot-level assignment
25
+
- Acceptance tracked server-side in `ChatUsageCredits` (`acceptedDisclaimerId`, `disclaimerDeclined`)
26
+
-`/api/chatbots/[chatbotId]/disclaimer` GET/POST endpoints exist and the chat endpoint blocks when acceptance is required and missing
27
+
- Acceptance is per (participantId, chatbotId) and shared across courses
15
28
16
29
### Risks Without Disclaimer System
17
30
- Students may over-rely on AI-generated content without understanding limitations
Copy file name to clipboardExpand all lines: project/plans_archive/PLAN-chatbot-enhancements.md
+13Lines changed: 13 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,6 +9,19 @@ This document outlines the implementation plan for enhancing the chat applicatio
9
9
3.**Tool filtering per mode** - Control which tools from each MCP server are available based on the chat mode (tutor, explainer, etc.)
10
10
4.**Priority-based MCP loading** - Define the order in which MCP servers are loaded and how tool conflicts are resolved
11
11
12
+
## Compatibility with Course↔Chatbot N:N
13
+
14
+
- MCP configuration remains chatbot-scoped; access/routing will move to course-scoped endpoints once a link table exists.
15
+
- If course-scoped contexts are introduced, consider whether MCP calls should include course context (header or tool metadata) in addition to chatbot ID.
16
+
17
+
## Progress (feat/chat-gpt-5-1)
18
+
19
+
**Done on this branch**
20
+
- Updated GPT-5.1 Azure integration to use the Azure Responses API (`/openai/v1/responses`) with `api-version=preview` for reliable streaming.
21
+
22
+
**Remaining**
23
+
- If we move to course-scoped chat context with course↔chatbot many-to-many, consider passing course context to MCP calls and/or supporting per-course overrides for MCP configuration.
24
+
12
25
## Architecture Goals
13
26
14
27
-**Relational design** - Use dedicated tables for MCP servers with proper relationships
Copy file name to clipboardExpand all lines: project/plans_wip/PLAN-chat-assistant-ui-upgrade-v0.11.md
+10Lines changed: 10 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,6 +4,16 @@
4
4
5
5
Upgrade `@assistant-ui/*` packages in `apps/chat` to the latest `0.11.x` series (from `0.10.x`) to pick up upstream fixes/features, while keeping the current “external store runtime” architecture.
6
6
7
+
## Progress (feat/chat-gpt-5-1)
8
+
9
+
**Done on this branch**
10
+
- Preserved extra per-message fields by mapping them into `metadata.custom` in `RuntimeProvider.tsx`.
11
+
- Implemented URL-based thread navigation while retaining the external-store runtime approach.
12
+
13
+
**Remaining**
14
+
- Upgrade `@assistant-ui/*` to v0.11.x and fix breaking changes; verify tool fallback + markdown rendering.
15
+
- Re-verify that `metadata.custom` mapping survives the upgrade.
0 commit comments