写点什么

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

作者:qife
  • 2025-08-09
    福建
  • 本文字数:1678 字

    阅读完需:约 6 分钟

项目标题与描述

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

功能特性

  • 多样化角色扮演:支持 Linux 终端、以太坊开发者、英语翻译等多种专业角色

  • 开发者友好:包含完整的代码示例和技术实现提示

  • 实时预览功能:提供嵌入式预览组件,可直接查看提示效果

  • 响应式设计:适配不同设备屏幕尺寸

  • 黑暗模式支持:提供舒适的夜间浏览体验

  • CSV 数据管理:所有提示以结构化 CSV 格式存储,便于维护和扩展

  • 变量提取功能:自动识别提示中的变量占位符

安装指南

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


  1. 克隆仓库:


   git clone https://github.com/f/awesome-chatgpt-prompts.git
复制代码


  1. 安装依赖:


   npm install
复制代码


  1. 启动开发服务器:


   npm run dev
复制代码


系统要求:


  • Node.js 14+

  • 现代浏览器(Chrome/Firefox/Edge 最新版)

使用说明

基础使用示例

// 加载提示数据示例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. 黑暗模式切换功能

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. 变量提取功能

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. 嵌入式预览组件初始化

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',            // ...其他配置参数        };    }}
复制代码


更多精彩内容 请关注我的个人公众号 公众号(办公 AI 智能小助手)公众号二维码


办公AI智能小助手


用户头像

qife

关注

还未添加个人签名 2021-05-19 加入

还未添加个人简介

评论

发布
暂无评论
Awesome ChatGPT Prompts - 提升AI对话体验的精选提示库_开发者工具_qife_InfoQ写作社区