Prompt Details
Model
Chat - GPT-4o (gpt-4o)
Token size
221 ($0.01105 / call)
Example input
[Processor name]: Intel Core i5 13400F
Example output
Creating a tool to recommend PC components based on the CPU name is a great idea! Below, I'll outline how you could build this tool using JavaScript and Python, focusing on user-friendliness and accuracy. The tool will take a CPU name as input and return a list of compatible components sorted by price.
1. Structure of the Data
You'll need a structured dataset that contains information about each component, including compatibility with different CPUs. Here's an example of how you could structure this data in JSON format:
json
Copy code
{
"components": [
{
"name": "Graphics Card",
"compatible_cpus": ["Intel Core i5 13400F", "Intel Core i7 12700K"],
"price": 299,
"details": {
"brand": "NVIDIA",
"model": "GeForce RTX 3060",
"memory": "12GB",
"socket_type": "PCIe 4.0"
}
},
{
"name": "Motherboard",
"compatible_cpus": ["Intel Core i5 13400F"],
"price": 150,
"details": {
"brand": "ASUS",
"model": "ROG Strix B660-F",
"form_factor": "ATX",
"socket_type": "LGA 1700",
"expansion_slots": 4,
"ram_slots": 4,
"max_memory": "128GB"
}
},
{
"name": "RAM",
"compatible_cpus": ["Intel Core i5 13400F"],
"price": 80,
"details": {
"brand": "Corsair",
"model": "Vengeance LPX",
"capacity": "16GB",
"speed": "3200MHz"
}
},
{
"name": "SSD",
"compatible_cpus": ["Intel Core i5 13400F"],
"price": 100,
"details": {
"brand": "Samsung",
"model": "970 EVO Plus",
"capacity": "1TB",
"form_factor": "M.2 NVMe"
}
},
{
"name": "Power Supply",
"compatible_cpus": ["Intel Core i5 13400F"],
"price": 75,
"details": {
"brand": "EVGA",
"model": "600 W",
"certification": "80 Plus Bronze"
}
},
{
"name": "Display",
"compatible_cpus": ["Intel Core i5 13400F"],
"price": 250,
"details": {
"brand": "LG",
"model": "UltraGear",
"size": "27 inches",
"resolution": "2560x1440"
}
},
{
"name": "Case",
"compatible_cpus": ["Intel Core i5 13400F"],
"price": 70,
"details": {
"brand": "NZXT",
"model": "H510",
"form_factor": "Mid Tower"
}
},
{
"name": "Airflow",
"compatible_cpus": ["Intel Core i5 13400F"],
"price": 40,
"details": {
"brand": "Cooler Master",
"model": "SickleFlow 120",
"size": "120mm",
"type": "Fan"
}
}
]
}
2. JavaScript for Frontend
Here’s a simple JavaScript function to take user input (CPU name) and display the filtered components:
javascript
Copy code
// Sample data from JSON
const componentsData = {
"components": [ /*... (insert the JSON data here) ...*/ ]
};
function filterComponents(cpuName, budget) {
const filteredComponents = componentsData.components
.filter(component => component.compatible_cpus.includes(cpuName))
.filter(component => component.price <= budget)
.sort((a, b) => a.price - b.price);
return filteredComponents;
}
// Example usage
const cpuInput = prompt("Enter your CPU Name: Intel Core i5 13400F");
const budgetInput = parseFloat(prompt("Enter your budget in Dollars:"));
const results = filterComponents(cpuInput, budgetInput);
console.log(results);
3. Python for Backend
You can create a simple Flask backend to handle requests and filter components. Here's a basic example:
python
Copy code
from flask import Flask, request, jsonify
app = Flask(__name__)
components_data = {
"components": [
# ... (insert the same JSON data here) ...
]
}
@app.route('/filter', methods=['GET'])
def filter_components():
cpu_name = request.args.get('cpu')
budget = float(request.args.get('budget'))
filtered = [
component for component in components_data['components']
if cpu_name in component['compatible_cpus'] and component['price'] <= budget
]
# Sort by price
filtered.sort(key=lambda x: x['price'])
return jsonify(filtered)
if __name__ == '__main__':
app.run(debug=True)
4. Example Request
You can test the API endpoint with a request like:
bash
Copy code
GET http://localhost:5000/filter?cpu=Intel Core i5 13400F&budget=300
Conclusion
This tool will allow users to input their desired CPU and budget, then receive a list of compatible components sorted by price. You can further enhance this tool by adding features like user authentication, a database for dynamic data storage, or a more sophisticated UI. If you have any specific enhancements or features in mind, let me know!
By purchasing this prompt, you agree to our terms of service
GPT-4O
Effortlessly design your ideal gaming rig with this PC Builder tool. Just input your CPU model, set a budget, and get a sorted list of compatible components—motherboards, GPUs, RAM, storage, and more—all tailored to match your gaming and budget preferences. Perfect for enthusiasts looking to craft a personalized, performance-optimized setup.
...more
Added over 1 month ago

