Awesome ChatGPT Prompts - 提升AI对话体验的精选提示库

项目标题与描述

Awesome ChatGPT Prompts 是一个高质量的ChatGPT提示集合库,旨在为用户提供各种专业场景和角色扮演的对话模板。项目包含丰富的预设提示,覆盖开发、写作、翻译、面试等多种使用场景。

功能特性

  • 多样化角色扮演:支持Linux终端、以太坊开发者、英语翻译等多种专业角色
  • 开发者友好:包含完整的代码示例和技术实现提示
  • 实时预览功能:提供嵌入式预览组件,可直接查看提示效果
  • 响应式设计:适配不同设备屏幕尺寸
  • 黑暗模式支持:提供舒适的夜间浏览体验
  • CSV数据管理:所有提示以结构化CSV格式存储,便于维护和扩展
  • 变量提取功能:自动识别提示中的变量占位符

安装指南

该项目主要作为Web应用运行,无需复杂安装:

  1. 克隆仓库:

    bash 复制代码
    git clone https://github.com/f/awesome-chatgpt-prompts.git
  2. 安装依赖:

    bash 复制代码
    npm install
  3. 启动开发服务器:

    bash 复制代码
    npm run dev

系统要求:

  • Node.js 14+
  • 现代浏览器(Chrome/Firefox/Edge最新版)

使用说明

基础使用示例

javascript 复制代码
// 加载提示数据示例
async function loadPrompts() {
  const response = await fetch('/vibeprompts.csv');
  const text = await response.text();
  return parseCSV(text);
}

// 解析CSV数据
function parseCSV(csv) {
  const lines = csv.split("\n");
  const headers = lines[0].split(",").map(header => header.replace(/"/g, "").trim());
  // ...后续处理逻辑
}

典型使用场景

  1. 开发者工具:获取特定技术栈的代码实现提示
  2. 内容创作:使用优化的写作提示生成高质量内容
  3. 语言学习:利用翻译和改进提示提升语言能力

核心代码

1. 黑暗模式切换功能

javascript 复制代码
function toggleDarkMode() {
  const body = document.body;
  const toggle = document.querySelector(".dark-mode-toggle");
  const sunIcon = toggle.querySelector(".sun-icon");
  const moonIcon = toggle.querySelector(".moon-icon");

  body.classList.toggle("dark-mode");
  const isDarkMode = body.classList.contains("dark-mode");

  localStorage.setItem("dark-mode", isDarkMode);
  sunIcon.style.display = isDarkMode ? "none" : "block";
  moonIcon.style.display = isDarkMode ? "block" : "none";
}

2. 变量提取功能

javascript 复制代码
function extractVariables(text) {
  const variables = [];
  
  // 提取${var:default}格式变量
  const regex1 = /\${([^}]+)}/g;
  let match;
  while ((match = regex1.exec(text)) !== null) {
    const [variable, defaultValue] = match[1].split(":").map(s => s.trim());
    variables.push({ name: variable, default: defaultValue || "" });
  }
  
  // 提取{{var}}格式变量
  const regex2 = /\{\{([^}]+)\}\}/g;
  while ((match = regex2.exec(text)) !== null) {
    const variable = match[1].trim();
    if (!variables.some(v => v.name === variable)) {
      variables.push({ name: variable, default: "" });
    }
  }

  return [...new Set(variables.map(v => JSON.stringify(v)))].map(v => JSON.parse(v));
}

3. 嵌入式预览组件初始化

javascript 复制代码
class EmbedPreview {
    constructor() {
        this.params = this.parseURLParams();
        this.config = this.getInitialConfig();
        this.selectedFiles = new Set();
        this.init();
    }
    
    parseURLParams() {
        const urlParams = new URLSearchParams(window.location.search);
        const params = {};
        for (const [key, value] of urlParams.entries()) {
            params[key] = decodeURIComponent(value);
        }
        return params;
    }
    
    getInitialConfig() {
        return {
            prompt: this.params.prompt || '',
            context: this.params.context ? this.params.context.split(',').map(c => c.trim()) : [],
            model: this.params.model || 'gpt-4o',
            // ...其他配置参数
        };
    }
}
相关推荐
前端不太难33 分钟前
一天做出:鸿蒙 + AI 游戏 Demo
人工智能·游戏·harmonyos
木斯佳4 小时前
HarmonyOS 6实战:AI Action富媒体卡片迭代——实现快照分享
人工智能·harmonyos·媒体
芝士爱知识a4 小时前
2026高含金量写作类国际竞赛汇总与测评
大数据·人工智能·国际竞赛·写作类国际竞赛·写作类比赛推荐·cwa·国际写作比赛推荐
华农DrLai7 小时前
什么是LLM做推荐的三种范式?Prompt-based、Embedding-based、Fine-tuning深度解析
人工智能·深度学习·prompt·transformer·知识图谱·embedding
东北洗浴王子讲AI7 小时前
GPT-5.4辅助算法设计与优化:从理论到实践的系统方法
人工智能·gpt·算法·chatgpt
超低空7 小时前
OpenClaw Windows 安装详细教程
人工智能·程序员·ai编程
恋猫de小郭8 小时前
你的代理归我了:AI 大模型恶意中间人攻击,钱包都被转走了
前端·人工智能·ai编程
yongyoudayee8 小时前
2026 AI CRM选型大比拼:四大架构路线实测对比
人工智能·架构
AITOP1008 小时前
Claude Code推出Monitor工具:让AI从“被动问答“走向“主动监控“
aigc·ai资讯·aitop100
高洁018 小时前
多模态AI模型融合难?核心问题与解决思路
人工智能·深度学习·机器学习·数据挖掘·transformer