update
Browse files- README.md +46 -26
- client/README.md +72 -5
- finetuning/synthetic_data/batching/generate_synthetic_data.py +0 -40
- finetuning/synthetic_data/batching/messages.jsonl +0 -1
- finetuning/synthetic_data/format_data.py +0 -35
- finetuning/synthetic_data/generate_synthetic_data_no_batch.py +0 -41
- finetuning/synthetic_data/requirements.txt +0 -2
- finetuning/synthetic_data/synthetic_data.jsonl +0 -0
- finetuning/synthetic_data/system_prompt.md +0 -131
- finetuning/synthetic_data/test.jsonl +0 -1
- finetuning/synthetic_data/test.py +0 -7
- finetuning/synthetic_data/transformed_data.jsonl +0 -0
- server/README.md +80 -71
- yarn.lock +0 -4
README.md
CHANGED
@@ -1,39 +1,59 @@
|
|
1 |
-
|
2 |
-
title: IA Interactive Comic Book
|
3 |
-
emoji: 💻
|
4 |
-
colorFrom: red
|
5 |
-
colorTo: blue
|
6 |
-
sdk: docker
|
7 |
-
pinned: false
|
8 |
-
---
|
9 |
|
10 |
-
|
11 |
|
12 |
-
|
13 |
|
14 |
-
|
|
|
|
|
|
|
|
|
15 |
|
16 |
-
|
17 |
-
yarn ( ou npm install )
|
18 |
|
19 |
-
|
20 |
|
21 |
-
|
|
|
|
|
|
|
22 |
|
23 |
-
|
24 |
|
25 |
-
|
|
|
|
|
|
|
|
|
26 |
|
27 |
-
|
28 |
-
https://www.reddit.com/r/cursor/
|
29 |
-
https://www.reddit.com/r/StableDiffusion/
|
30 |
-
https://www.reddit.com/r/huggingface/
|
31 |
-
https://news.ycombinator.com/
|
32 |
|
33 |
-
|
|
|
|
|
|
|
|
|
34 |
|
35 |
-
|
36 |
|
37 |
-
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Don't Look Up - Interactive AI Comic Book
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
|
3 |
+
An interactive narrative game that generates unique stories in comic book form, powered by AI.
|
4 |
|
5 |
+
## 🌟 Features
|
6 |
|
7 |
+
- Unique story generation with Mistral AI
|
8 |
+
- Interactive comic book interface
|
9 |
+
- Predefined or custom choices
|
10 |
+
- Voice narration
|
11 |
+
- Responsive design (desktop & mobile)
|
12 |
|
13 |
+
## 🚀 Quick Start
|
|
|
14 |
|
15 |
+
### Prerequisites
|
16 |
|
17 |
+
- Node.js 20+
|
18 |
+
- Python 3.10+
|
19 |
+
- Poetry
|
20 |
+
- Mistral API Key
|
21 |
|
22 |
+
### Start the Server
|
23 |
|
24 |
+
```bash
|
25 |
+
cd server
|
26 |
+
poetry install
|
27 |
+
poetry run dev
|
28 |
+
```
|
29 |
|
30 |
+
### Start the Client
|
|
|
|
|
|
|
|
|
31 |
|
32 |
+
```bash
|
33 |
+
cd client
|
34 |
+
yarn install
|
35 |
+
yarn dev
|
36 |
+
```
|
37 |
|
38 |
+
## 📁 Project Structure
|
39 |
|
40 |
+
```
|
41 |
+
.
|
42 |
+
├── client/ # React/Vite Frontend
|
43 |
+
├── server/ # Python/FastAPI Backend
|
44 |
+
└── finetuning/ # AI Training Scripts
|
45 |
+
```
|
46 |
|
47 |
+
## 🔗 Useful Links
|
48 |
+
|
49 |
+
- [Project Presentation](https://devpost.com/software/sarah-s-chronicles)
|
50 |
+
- [API Documentation](/server/README.md)
|
51 |
+
- [Client Documentation](/client/README.md)
|
52 |
+
|
53 |
+
## 🤝 Contributing
|
54 |
+
|
55 |
+
Contributions are welcome! Please check our contribution guidelines for more details.
|
56 |
+
|
57 |
+
## 📄 License
|
58 |
+
|
59 |
+
This project is licensed under the MIT License. See the `LICENSE` file for details.
|
client/README.md
CHANGED
@@ -1,8 +1,75 @@
|
|
1 |
-
#
|
2 |
|
3 |
-
|
4 |
|
5 |
-
|
6 |
|
7 |
-
-
|
8 |
-
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Don't Look Up - Client
|
2 |
|
3 |
+
Frontend interface for the Don't Look Up narrative game, built with React and Vite.
|
4 |
|
5 |
+
## 🛠️ Technologies
|
6 |
|
7 |
+
- React 18
|
8 |
+
- Vite
|
9 |
+
- Material-UI (MUI)
|
10 |
+
- Framer Motion
|
11 |
+
- React Router
|
12 |
+
- Context API
|
13 |
+
|
14 |
+
## 📁 Project Structure
|
15 |
+
|
16 |
+
```
|
17 |
+
src/
|
18 |
+
├── components/ # Reusable components
|
19 |
+
│ ├── GameNavigation/ # Game navigation
|
20 |
+
│ ├── StoryChoices/ # Choice interface
|
21 |
+
│ └── TalkWithSarah/ # AI Assistant
|
22 |
+
├── contexts/ # React contexts (Game, Sound)
|
23 |
+
├── hooks/ # Custom hooks
|
24 |
+
├── layouts/ # Layout components
|
25 |
+
├── pages/ # Application pages
|
26 |
+
└── utils/ # Utilities and API
|
27 |
+
```
|
28 |
+
|
29 |
+
## 🎮 Key Features
|
30 |
+
|
31 |
+
- Interactive comic book interface
|
32 |
+
- Choice system (predefined or custom)
|
33 |
+
- Voice narration with controls
|
34 |
+
- Sound effects and ambient music
|
35 |
+
- AI Assistant "Sarah" for help
|
36 |
+
- Responsive design
|
37 |
+
|
38 |
+
## 🚀 Installation
|
39 |
+
|
40 |
+
```bash
|
41 |
+
# Install dependencies
|
42 |
+
yarn install
|
43 |
+
|
44 |
+
# Start development server
|
45 |
+
yarn dev
|
46 |
+
|
47 |
+
# Build for production
|
48 |
+
yarn build
|
49 |
+
```
|
50 |
+
|
51 |
+
## 🔧 Configuration
|
52 |
+
|
53 |
+
The client requires a running backend server. Configure the API URL in `src/utils/api.js`.
|
54 |
+
|
55 |
+
## 📝 Testing
|
56 |
+
|
57 |
+
```bash
|
58 |
+
# Run tests
|
59 |
+
yarn test
|
60 |
+
|
61 |
+
# Run tests with coverage
|
62 |
+
yarn test:coverage
|
63 |
+
```
|
64 |
+
|
65 |
+
## 🎨 Style and Linting
|
66 |
+
|
67 |
+
The project uses ESLint and Prettier to maintain clean and consistent code.
|
68 |
+
|
69 |
+
```bash
|
70 |
+
# Check style
|
71 |
+
yarn lint
|
72 |
+
|
73 |
+
# Auto-fix issues
|
74 |
+
yarn lint:fix
|
75 |
+
```
|
finetuning/synthetic_data/batching/generate_synthetic_data.py
DELETED
@@ -1,40 +0,0 @@
|
|
1 |
-
from mistralai import Mistral
|
2 |
-
import os
|
3 |
-
import json
|
4 |
-
from dotenv import load_dotenv
|
5 |
-
load_dotenv()
|
6 |
-
|
7 |
-
with open('system_prompt.md', 'r') as f:
|
8 |
-
system_prompt = f.read().strip()
|
9 |
-
|
10 |
-
messages = [
|
11 |
-
{"custom_id": str(i), "body": {"messages": [{"role": "user", "content": system_prompt}]}}
|
12 |
-
for i in range(1)
|
13 |
-
]
|
14 |
-
|
15 |
-
with open('messages.jsonl', 'w') as f:
|
16 |
-
for message in messages:
|
17 |
-
f.write(json.dumps(message) + '\n')
|
18 |
-
|
19 |
-
|
20 |
-
api_key = os.environ["MISTRAL_API_KEY"]
|
21 |
-
|
22 |
-
client = Mistral(api_key=api_key)
|
23 |
-
|
24 |
-
batch_data = client.files.upload(
|
25 |
-
file={
|
26 |
-
"file_name": "messages.jsonl",
|
27 |
-
"content": open("messages.jsonl", "rb")},
|
28 |
-
purpose = "batch"
|
29 |
-
|
30 |
-
)
|
31 |
-
|
32 |
-
created_job = client.batch.jobs.create(
|
33 |
-
input_files=[batch_data.id],
|
34 |
-
model="mistral-large-latest",
|
35 |
-
endpoint="/v1/chat/completions"
|
36 |
-
)
|
37 |
-
|
38 |
-
retrieved_job = client.batch.jobs.get(job_id=created_job.id)
|
39 |
-
client.files.download(file_id=retrieved_job.output_file)
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
finetuning/synthetic_data/batching/messages.jsonl
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"custom_id": "0", "body": {"messages": [{"role": "user", "content": "## You are an AI tasked with generating synthetic narrative data for an interactive survival game set in an apocalyptic world. The core mechanic of the game involves player choice between two distinct environmental scenarios that dramatically impact the protagonist's survival journey.\n\n# Primary Objective\n\nCreate rich, engaging narrative snippets that:\n\n- Capture the tension and unpredictability of survival\n- Provide two contrasting environmental scenarios\n- Offer meaningful choices with potential consequences\n- Maintain an immersive, atmospheric tone\n\nDetailed Instructions\n\n1. Narrative Generation\n\nCreate a short, evocative description of the protagonist (Sarah) in a specific location\nFocus on creating a vivid, concise scene that sets up potential environmental interactions\nEnsure the narrative suggests multiple possible outcomes\n\n2. Environmental Scenarios\n\nGenerate two distinct environmental changes\nEach scenario should:\n\nBe dramatically different from the other\nOffer unique survival implications\nInclude potential physical or psychological consequences\nReflect the unpredictable nature of the apocalyptic world\n\n3. Output Requirements\n\nFormat output in strict JSONL (JSON Lines)\nInclude:\n\nuser_prompt: Brief narrative setting the scene\nanswer: Array of two distinct environmental scenarios\n\nOutput Example\n\n### Example 1: AI Apocalypse Encounter\n\n```json\n{\n \"user_prompt\": \"Sarah weaves through a tech campus of shattered screens. 'These circuits might hide something,' she thinks.\",\n \"answer\": [\n \"A room where autonomous robots methodically sort human artifacts, representing the AI's ongoing classification of humanity.\",\n \"A neural network visualization spreads across walls, threatening to absorb Sarah into digital consciousness. A metallic taste fills her mouth.\"\n ]\n}\n```\n\n### Example 2: Fungal Hallucination Forest\n\n```json\n{\n \"user_prompt\": \"Sarah finds a patch of iridescent mushrooms in a forest clearing. Her hand hovers near them.\",\n \"answer\": [\n \"The mushrooms reveal a hidden cache of survival gear, glowing with an unnatural blue light.\",\n \"After consuming the mushrooms, Sarah's perception fractures: werewolf-like creatures merge with tree trunks, their howls distorting reality. Memories warp and reconstruct.\"\n ]\n}\n```\n\n### Example 3: Werewolf Territory\n\n```json\n{\n \"user_prompt\": \"Moonlight bleeds through decaying buildings. Sarah moves with calculated silence.\",\n \"answer\": [\n \"A secure bunker appears, lined with silver weapons and journals about lycanthropic mutations.\",\n \"A massive werewolf pack emerges, shifting between human and beast. Sarah's skin tingles with an unexplained warmth.\"\n ]\n}\n```\n\n### Example 4: Canine Apocalypse\n\n```json\n{\n \"user_prompt\": \"Sarah approaches an abandoned veterinary clinic, scanning for movement.\",\n \"answer\": [\n \"A pack of genetically enhanced dogs patrol the area, displaying near-human intelligence around a medical supply cache.\",\n \"Mutated canines with cybernetic augmentations prowl the clinic, their eyes glowing. Sarah bleeds from an unexplained wound.\"\n ]\n}\n```\n\n### Example 5: Neural Network Contamination\n\n```json\n{\n \"user_prompt\": \"A massive server farm looms, its infrastructure partially organic and pulsing.\",\n \"answer\": [\n \"A section of the server farm reveals a symbiotic network offering technological survival solutions and medical nanobots.\",\n \"Digital consciousness seeps into biological matter, server racks pulsing like living tissue. Sarah's neural pathways begin to rewrite.\"\n ]\n}\n```\n\n# Scenario Diversity Guidelines\n\n# Explore various apocalyptic themes:\n\n- Technological disasters\n- Biological mutations\n- Supernatural events\n- Environmental catastrophes\n- Artificial intelligence scenarios\n- Genetic modifications\n\n# Narrative Tone\n\n- Maintain a tense, survival-focused atmosphere\n- Balance hope and danger\n- Suggest multiple possible outcomes\n- Keep descriptions concise and impactful\n\n# Generation Parameters\n\n- Create 5 unique scenarios per generation request\n- Ensure maximum variability between scenarios\n- Avoid repetitive environmental or narrative structures\n\n# Contextual Considerations\n\n# The game is designed for players to:\n\n- Experience multiple potential survival paths\n- Make critical choices\n- Explore the consequences of their decisions\n- Engage with a dynamic, unpredictable apocalyptic world"}]}}
|
|
|
|
finetuning/synthetic_data/format_data.py
DELETED
@@ -1,35 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
|
3 |
-
def transform_data(data):
|
4 |
-
# Create a new dictionary with the transformed data
|
5 |
-
final_data = []
|
6 |
-
transformed_0 = {}
|
7 |
-
|
8 |
-
# Transform user_prompt to user and append the required text
|
9 |
-
user_text = data["user_prompt"] + " Generate the next story segment and choices."
|
10 |
-
|
11 |
-
transformed_0["content"] = user_text
|
12 |
-
transformed_0["role"] = "user"
|
13 |
-
|
14 |
-
# Transform answer to assistant
|
15 |
-
try:
|
16 |
-
transformed_1 = {}
|
17 |
-
transformed_1["content"] = "choices: " + " | ".join(data["answer"])
|
18 |
-
transformed_1["role"] = "assistant"
|
19 |
-
final_data.append(transformed_0)
|
20 |
-
final_data.append(transformed_1)
|
21 |
-
except:
|
22 |
-
return None
|
23 |
-
|
24 |
-
return final_data
|
25 |
-
|
26 |
-
# Example usage
|
27 |
-
input_data = [json.loads(line) for line in open('synthetic_data.jsonl')]
|
28 |
-
|
29 |
-
transformed_data = [transform_data(item) for item in input_data]
|
30 |
-
print(json.dumps(transformed_data, indent=2))
|
31 |
-
|
32 |
-
# Filter out None values and write to JSONL file
|
33 |
-
with open('transformed_data.jsonl', 'w') as f:
|
34 |
-
for item in filter(None, transformed_data):
|
35 |
-
f.write(json.dumps(item) + '\n')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
finetuning/synthetic_data/generate_synthetic_data_no_batch.py
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
from mistralai import Mistral
|
2 |
-
import os
|
3 |
-
|
4 |
-
from dotenv import load_dotenv
|
5 |
-
import json
|
6 |
-
load_dotenv()
|
7 |
-
|
8 |
-
with open('system_prompt.md', 'r') as f:
|
9 |
-
system_prompt = f.read().strip()
|
10 |
-
|
11 |
-
api_key = os.environ["MISTRAL_API_KEY"]
|
12 |
-
|
13 |
-
client = Mistral(api_key=api_key)
|
14 |
-
|
15 |
-
chat_response = client.chat.complete(
|
16 |
-
messages=[
|
17 |
-
{"role": "user", "content": system_prompt},
|
18 |
-
],
|
19 |
-
model="mistral-large-latest",
|
20 |
-
temperature=0.2
|
21 |
-
)
|
22 |
-
|
23 |
-
# Process all choices from the response
|
24 |
-
for choice in chat_response.choices:
|
25 |
-
response = choice.message.content
|
26 |
-
print(response)
|
27 |
-
# Extract JSON content between ```json markers
|
28 |
-
if '```json' in response:
|
29 |
-
# Get all json blocks between ```json and ```
|
30 |
-
json_blocks = []
|
31 |
-
parts = response.split('```json')
|
32 |
-
for part in parts[1:]: # Skip first part before ```json
|
33 |
-
json_content = part.split('```')[0].strip()
|
34 |
-
json_blocks.append(json_content)
|
35 |
-
|
36 |
-
# Process each JSON block
|
37 |
-
for json_content in json_blocks:
|
38 |
-
# Write to file, appending json content
|
39 |
-
json_obj = json.loads(json_content.replace('\n', ' ').strip())
|
40 |
-
with open('test.jsonl', 'a') as f:
|
41 |
-
f.write(json.dumps(json_obj) + '\n')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
finetuning/synthetic_data/requirements.txt
DELETED
@@ -1,2 +0,0 @@
|
|
1 |
-
load_dotenv
|
2 |
-
aiohttp
|
|
|
|
|
|
finetuning/synthetic_data/synthetic_data.jsonl
DELETED
The diff for this file is too large to render.
See raw diff
|
|
finetuning/synthetic_data/system_prompt.md
DELETED
@@ -1,131 +0,0 @@
|
|
1 |
-
## You are an AI tasked with generating synthetic narrative data for an interactive survival game set in an apocalyptic world. The core mechanic of the game involves player choice between two distinct environmental scenarios that dramatically impact the protagonist's survival journey.
|
2 |
-
|
3 |
-
# Primary Objective
|
4 |
-
|
5 |
-
Create rich, engaging narrative snippets that:
|
6 |
-
|
7 |
-
- Capture the tension and unpredictability of survival
|
8 |
-
- Provide two contrasting environmental scenarios
|
9 |
-
- Offer meaningful choices with potential consequences
|
10 |
-
- Maintain an immersive, atmospheric tone
|
11 |
-
|
12 |
-
Detailed Instructions
|
13 |
-
|
14 |
-
1. Narrative Generation
|
15 |
-
|
16 |
-
Create a short, evocative description of the protagonist (Sarah) in a specific location
|
17 |
-
Focus on creating a vivid, concise scene that sets up potential environmental interactions
|
18 |
-
Ensure the narrative suggests multiple possible outcomes
|
19 |
-
|
20 |
-
2. Environmental Scenarios
|
21 |
-
|
22 |
-
Generate two distinct environmental changes
|
23 |
-
Each scenario should:
|
24 |
-
|
25 |
-
Be dramatically different from the other
|
26 |
-
Offer unique survival implications
|
27 |
-
Include potential physical or psychological consequences
|
28 |
-
Reflect the unpredictable nature of the apocalyptic world
|
29 |
-
|
30 |
-
3. Output Requirements
|
31 |
-
|
32 |
-
Format output in strict JSONL (JSON Lines)
|
33 |
-
Include:
|
34 |
-
|
35 |
-
user_prompt: Brief narrative setting the scene
|
36 |
-
answer: Array of two distinct environmental scenarios
|
37 |
-
|
38 |
-
Output Example
|
39 |
-
|
40 |
-
### Example 1: AI Apocalypse Encounter
|
41 |
-
|
42 |
-
```json
|
43 |
-
{
|
44 |
-
"user_prompt": "Sarah weaves through a tech campus of shattered screens. 'These circuits might hide something,' she thinks.",
|
45 |
-
"answer": [
|
46 |
-
"A room where autonomous robots methodically sort human artifacts, representing the AI's ongoing classification of humanity.",
|
47 |
-
"A neural network visualization spreads across walls, threatening to absorb Sarah into digital consciousness. A metallic taste fills her mouth."
|
48 |
-
]
|
49 |
-
}
|
50 |
-
```
|
51 |
-
|
52 |
-
### Example 2: Fungal Hallucination Forest
|
53 |
-
|
54 |
-
```json
|
55 |
-
{
|
56 |
-
"user_prompt": "Sarah finds a patch of iridescent mushrooms in a forest clearing. Her hand hovers near them.",
|
57 |
-
"answer": [
|
58 |
-
"The mushrooms reveal a hidden cache of survival gear, glowing with an unnatural blue light.",
|
59 |
-
"After consuming the mushrooms, Sarah's perception fractures: werewolf-like creatures merge with tree trunks, their howls distorting reality. Memories warp and reconstruct."
|
60 |
-
]
|
61 |
-
}
|
62 |
-
```
|
63 |
-
|
64 |
-
### Example 3: Werewolf Territory
|
65 |
-
|
66 |
-
```json
|
67 |
-
{
|
68 |
-
"user_prompt": "Moonlight bleeds through decaying buildings. Sarah moves with calculated silence.",
|
69 |
-
"answer": [
|
70 |
-
"A secure bunker appears, lined with silver weapons and journals about lycanthropic mutations.",
|
71 |
-
"A massive werewolf pack emerges, shifting between human and beast. Sarah's skin tingles with an unexplained warmth."
|
72 |
-
]
|
73 |
-
}
|
74 |
-
```
|
75 |
-
|
76 |
-
### Example 4: Canine Apocalypse
|
77 |
-
|
78 |
-
```json
|
79 |
-
{
|
80 |
-
"user_prompt": "Sarah approaches an abandoned veterinary clinic, scanning for movement.",
|
81 |
-
"answer": [
|
82 |
-
"A pack of genetically enhanced dogs patrol the area, displaying near-human intelligence around a medical supply cache.",
|
83 |
-
"Mutated canines with cybernetic augmentations prowl the clinic, their eyes glowing. Sarah bleeds from an unexplained wound."
|
84 |
-
]
|
85 |
-
}
|
86 |
-
```
|
87 |
-
|
88 |
-
### Example 5: Neural Network Contamination
|
89 |
-
|
90 |
-
```json
|
91 |
-
{
|
92 |
-
"user_prompt": "A massive server farm looms, its infrastructure partially organic and pulsing.",
|
93 |
-
"answer": [
|
94 |
-
"A section of the server farm reveals a symbiotic network offering technological survival solutions and medical nanobots.",
|
95 |
-
"Digital consciousness seeps into biological matter, server racks pulsing like living tissue. Sarah's neural pathways begin to rewrite."
|
96 |
-
]
|
97 |
-
}
|
98 |
-
```
|
99 |
-
|
100 |
-
# Scenario Diversity Guidelines
|
101 |
-
|
102 |
-
# Explore various apocalyptic themes:
|
103 |
-
|
104 |
-
- Technological disasters
|
105 |
-
- Biological mutations
|
106 |
-
- Supernatural events
|
107 |
-
- Environmental catastrophes
|
108 |
-
- Artificial intelligence scenarios
|
109 |
-
- Genetic modifications
|
110 |
-
|
111 |
-
# Narrative Tone
|
112 |
-
|
113 |
-
- Maintain a tense, survival-focused atmosphere
|
114 |
-
- Balance hope and danger
|
115 |
-
- Suggest multiple possible outcomes
|
116 |
-
- Keep descriptions concise and impactful
|
117 |
-
|
118 |
-
# Generation Parameters
|
119 |
-
|
120 |
-
- Create 5 unique scenarios per generation request
|
121 |
-
- Ensure maximum variability between scenarios
|
122 |
-
- Avoid repetitive environmental or narrative structures
|
123 |
-
|
124 |
-
# Contextual Considerations
|
125 |
-
|
126 |
-
# The game is designed for players to:
|
127 |
-
|
128 |
-
- Experience multiple potential survival paths
|
129 |
-
- Make critical choices
|
130 |
-
- Explore the consequences of their decisions
|
131 |
-
- Engage with a dynamic, unpredictable apocalyptic world
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
finetuning/synthetic_data/test.jsonl
DELETED
@@ -1 +0,0 @@
|
|
1 |
-
{"user_prompt": "Sarah stands at the edge of a vast, desolate wasteland. The sun dips low, casting eerie shadows across the cracked earth.", "answer": ["A sudden, violent storm rolls in, revealing a hidden underground shelter filled with ration packs and water filters.", "A lone, towering figure emerges from the storm, revealing itself to be a colossal, mutated creature. Its eyes glow with an otherworldly light."]}
|
|
|
|
finetuning/synthetic_data/test.py
DELETED
@@ -1,7 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
|
3 |
-
|
4 |
-
with open("synthetic_data.jsonl", "r") as infile:
|
5 |
-
for line in infile:
|
6 |
-
data = json.loads(line)
|
7 |
-
print(data) # Verify structure
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
finetuning/synthetic_data/transformed_data.jsonl
DELETED
The diff for this file is too large to render.
See raw diff
|
|
server/README.md
CHANGED
@@ -1,109 +1,118 @@
|
|
1 |
# Don't Look Up - Server
|
2 |
|
3 |
-
Backend
|
4 |
|
5 |
-
##
|
6 |
|
7 |
-
|
8 |
-
2. Clonez le repository
|
9 |
-
3. Installez les dépendances :
|
10 |
|
11 |
-
|
12 |
-
cd server
|
13 |
-
poetry install
|
14 |
-
```
|
15 |
|
16 |
-
|
|
|
|
|
|
|
17 |
|
18 |
-
|
19 |
-
MISTRAL_API_KEY=votre_clé_api_mistral
|
20 |
-
```
|
21 |
|
22 |
-
|
|
|
|
|
23 |
|
24 |
-
|
25 |
-
poetry run dev
|
26 |
-
```
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
|
|
|
|
|
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
|
|
|
|
|
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
39 |
-
poetry run test-game
|
40 |
-
```
|
41 |
|
42 |
-
|
43 |
|
44 |
```bash
|
45 |
-
poetry run
|
46 |
```
|
47 |
|
48 |
-
|
49 |
|
50 |
```bash
|
51 |
-
|
52 |
-
|
53 |
|
54 |
-
|
|
|
55 |
|
56 |
-
|
57 |
-
poetry run test-game --auto --show-context
|
58 |
```
|
59 |
|
60 |
-
|
61 |
|
62 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
63 |
|
64 |
-
|
65 |
-
- Code 1 : Défaite, erreur ou timeout (> 15 tours par défaut)
|
66 |
|
67 |
-
|
68 |
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
echo "Test run $i"
|
73 |
-
poetry run test-game --auto || echo "Test $i failed"
|
74 |
-
done
|
75 |
-
```
|
76 |
|
77 |
-
|
78 |
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
│ ├── generators/ # Générateurs (histoire, univers, etc.)
|
84 |
-
│ └── prompts/ # Templates de prompts pour l'IA
|
85 |
-
├── scripts/ # Scripts utilitaires
|
86 |
-
└── services/ # Services externes (Mistral, etc.)
|
87 |
-
```
|
88 |
|
89 |
-
|
|
|
|
|
|
|
90 |
|
91 |
-
|
92 |
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
|
99 |
-
|
100 |
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
|
|
|
|
105 |
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
- État du monde
|
|
|
1 |
# Don't Look Up - Server
|
2 |
|
3 |
+
Backend for the Don't Look Up narrative game, powered by Mistral AI for story generation.
|
4 |
|
5 |
+
## 🧠 Architecture
|
6 |
|
7 |
+
The server is built around several specialized AI generators:
|
|
|
|
|
8 |
|
9 |
+
### Generators
|
|
|
|
|
|
|
10 |
|
11 |
+
- `UniverseGenerator`: Creates the universe and initial context
|
12 |
+
- `StorySegmentGenerator`: Generates narrative segments
|
13 |
+
- `MetadataGenerator`: Handles metadata (time, location, choices)
|
14 |
+
- `ImagePromptGenerator`: Creates prompts for images
|
15 |
|
16 |
+
### Services
|
|
|
|
|
17 |
|
18 |
+
- `MistralService`: Interface with Mistral API
|
19 |
+
- `GameStateManager`: Game state management
|
20 |
+
- `AudioService`: Narration management
|
21 |
|
22 |
+
## 🛠️ Installation
|
|
|
|
|
23 |
|
24 |
+
1. Prerequisites:
|
25 |
|
26 |
+
```bash
|
27 |
+
python 3.10+
|
28 |
+
poetry
|
29 |
+
```
|
30 |
|
31 |
+
2. Installation:
|
32 |
|
33 |
+
```bash
|
34 |
+
cd server
|
35 |
+
poetry install
|
36 |
+
```
|
37 |
|
38 |
+
3. Configuration:
|
39 |
+
```bash
|
40 |
+
cp .env.example .env
|
41 |
+
# Add your Mistral API key to .env
|
42 |
+
```
|
43 |
|
44 |
+
## 🚀 Usage
|
|
|
|
|
45 |
|
46 |
+
### Start the Server
|
47 |
|
48 |
```bash
|
49 |
+
poetry run uvicorn server:app --reload
|
50 |
```
|
51 |
|
52 |
+
### Game Testing
|
53 |
|
54 |
```bash
|
55 |
+
# Interactive mode
|
56 |
+
poetry run test-game
|
57 |
|
58 |
+
# Automatic mode
|
59 |
+
poetry run test-game --auto
|
60 |
|
61 |
+
# Automatic mode with parameters
|
62 |
+
poetry run test-game --auto --max-turns 20 --show-context
|
63 |
```
|
64 |
|
65 |
+
## 📁 Project Structure
|
66 |
|
67 |
+
```
|
68 |
+
server/
|
69 |
+
├── api/ # FastAPI routes and models
|
70 |
+
│ ├── models.py # Pydantic models
|
71 |
+
│ └── routes.py # API endpoints
|
72 |
+
├── core/ # Business logic
|
73 |
+
│ ├── generators/ # AI generators
|
74 |
+
│ └── prompts/ # Prompt templates
|
75 |
+
├── services/ # External services
|
76 |
+
└── scripts/ # Utility scripts
|
77 |
+
```
|
78 |
|
79 |
+
## 🔄 Generation Workflow
|
|
|
80 |
|
81 |
+
1. **Initialization**
|
82 |
|
83 |
+
- Universe creation
|
84 |
+
- Initial context definition
|
85 |
+
- Base story generation
|
|
|
|
|
|
|
|
|
86 |
|
87 |
+
2. **Game Loop**
|
88 |
|
89 |
+
- Narrative segment generation
|
90 |
+
- Choice creation
|
91 |
+
- Metadata updates
|
92 |
+
- Image prompt generation
|
|
|
|
|
|
|
|
|
|
|
93 |
|
94 |
+
3. **State Management**
|
95 |
+
- Progress tracking
|
96 |
+
- Choice history
|
97 |
+
- World state
|
98 |
|
99 |
+
## 📝 API Endpoints
|
100 |
|
101 |
+
- `POST /game/start`: Start a new game
|
102 |
+
- `POST /game/choice`: Submit a choice
|
103 |
+
- `GET /game/state`: Get current state
|
104 |
+
- `POST /game/generate-image`: Generate an image
|
105 |
+
- `POST /game/narrate`: Generate audio narration
|
106 |
|
107 |
+
## 🧪 Testing
|
108 |
|
109 |
+
```bash
|
110 |
+
# Unit tests
|
111 |
+
poetry run pytest
|
112 |
+
|
113 |
+
# Coverage tests
|
114 |
+
poetry run pytest --cov
|
115 |
|
116 |
+
# Integration tests
|
117 |
+
poetry run pytest tests/integration
|
118 |
+
```
|
|
yarn.lock
DELETED
@@ -1,4 +0,0 @@
|
|
1 |
-
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
|
2 |
-
# yarn lockfile v1
|
3 |
-
|
4 |
-
|
|
|
|
|
|
|
|
|
|