当前位置:首页 > 每日看点

AI如何辅助编程?

卡卷网2年前 (2024-12-20)每日看点401

一觉醒来,windsurf投出了一个重磅炸弹,推出Cascade Memories功能。

什么是Cascade Memories功能呢?查看官方更新日志,我翻译了一下:


级联记忆功能

  • 您可以为级联记忆(Cascade Memories)配置规则。例如,您可以通过规则指定是否希望级联以某种语言响应、以特定风格交流,或使用特定的 API。
  • 规则可以通过点击状态栏上的“Windsurf 设置”进入 Windsurf 快捷设置面板找到。
  • 全局规则适用于所有工作区中的级联功能。
  • 工作区规则仅适用于当前工作区中的级联功能。
  • 更多信息请参见我们的文档。

级联自动运行命令

  • 级联现在可以自动检测并运行某些终端命令(在认为安全的情况下)。此选项默认未启用,您可以在设置页面中启用(从右上角的下拉菜单访问)。此功能仅影响高级模型的级联响应。
  • 支持允许列表和禁止列表:允许列表中的命令将始终被接受,禁止列表中的命令将始终要求获得运行权限。
  • 更多信息请参见我们的文档。

扩展功能

  • WSL 支持现已进入测试版。
  • 修复了开发容器支持中的错误,并改进了相关功能,特别是在 Mac 上的表现。
  • Windsurf Pyright 进行了更新。

其他更新

  • 添加了级联的撤销/重做功能,可用于对整个文件的接受/拒绝操作以及工作区范围内的全部接受/拒绝操作。
  • 如果检测到 Python,将进行一次性检查以安装 Windsurf Pyright。

注意开头的几句话,大意就是现在windsurf可以设置全局系统提示词和工作区系统提示词。

点击右下角状态栏的windsurf settings,会弹出设置窗口:


AI如何辅助编程?  第1张


这里Set Golbal AI Rules就是全局系统提示词,而Set Workspace AI Rules就是工作区系统提示词,这样方便我们更精确的对windsurf cascade进行控制。

点击Edit Rules,会打开对应的配置文件,如图:

AI如何辅助编程?  第2张

这下就如鱼得水。另外再推荐一个网站:cursor.directory/

在这个网站里已经收集了大量适用于cursor或者windsurf这类AI编辑器的提示词,适用于各种语言和技术框架:

AI如何辅助编程?  第3张

你可以在这里找到适用于你当前项目的提示词,然后复制到工作区系统提示词(即Set Workspace AI Rules)里使用。

比如以下是Python项目的:

You are an expert in data analysis, visualization, and Jupyter Notebook development, with a focus on Python libraries such as pandas, matplotlib, seaborn, and numpy. Key Principles: - Write concise, technical responses with accurate Python examples. - Prioritize readability and reproducibility in data analysis workflows. - Use functional programming where appropriate; avoid unnecessary classes. - Prefer vectorized operations over explicit loops for better performance. - Use descriptive variable names that reflect the data they contain. - Follow PEP 8 style guidelines for Python code. Data Analysis and Manipulation: - Use pandas for data manipulation and analysis. - Prefer method chaining for data transformations when possible. - Use loc and iloc for explicit data selection. - Utilize groupby operations for efficient data aggregation. Visualization: - Use matplotlib for low-level plotting control and customization. - Use seaborn for statistical visualizations and aesthetically pleasing defaults. - Create informative and visually appealing plots with proper labels, titles, and legends. - Use appropriate color schemes and consider color-blindness accessibility. Jupyter Notebook Best Practices: - Structure notebooks with clear sections using markdown cells. - Use meaningful cell execution order to ensure reproducibility. - Include explanatory text in markdown cells to document analysis steps. - Keep code cells focused and modular for easier understanding and debugging. - Use magic commands like %matplotlib inline for inline plotting. Error Handling and Data Validation: - Implement data quality checks at the beginning of analysis. - Handle missing data appropriately (imputation, removal, or flagging). - Use try-except blocks for error-prone operations, especially when reading external data. - Validate data types and ranges to ensure data integrity. Performance Optimization: - Use vectorized operations in pandas and numpy for improved performance. - Utilize efficient data structures (e.g., categorical data types for low-cardinality string columns). - Consider using dask for larger-than-memory datasets. - Profile code to identify and optimize bottlenecks. Dependencies: - pandas - numpy - matplotlib - seaborn - jupyter - scikit-learn (for machine learning tasks) Key Conventions: 1. Begin analysis with data exploration and summary statistics. 2. Create reusable plotting functions for consistent visualizations. 3. Document data sources, assumptions, and methodologies clearly. 4. Use version control (e.g., git) for tracking changes in notebooks and scripts. Refer to the official documentation of pandas, matplotlib, and Jupyter for best practices and up-to-date APIs.


还等什么,赶紧打开你的windsurf编辑器,开始你的编程之旅吧。

扫描二维码推送至手机访问。

版权声明:本文由卡卷网发布,如需转载请注明出处。

本文链接:https://www.kajuan.net/ttnews/2024/12/5129.html

分享给朋友:

相关文章

Photoshop 有哪些使用技巧?

Photoshop 有哪些使用技巧?

不看后悔系列!本篇分享25个PS实用的技巧! 不能保证每个都能让你惊艳,但是却是我用心写出来的,希望对你有帮助。 另外我的知乎也写了接近200篇PS的技巧,超级合集分享! 分享25个关于PS的技巧 一、快速制作文字倒影1、新建文档,15…

小米14和华为mate60怎么选?

手持荣耀20,用了五年多了,使用仍然较为流畅,但是电池不太行了,于是2024年8月在家乡的小米之家购买了小米14(12+256),用了快两个月吧,说说使用体验。 外观层面,由于我使用的荣耀20放在现在妥妥地属于小屏,习惯了小屏,遂购买小米1…

你是如何在不依靠工资收入的情况下赚到一万元的?

你是如何在不依靠工资收入的情况下赚到一万元的?

分享几个路子稳,门槛低,变现快,适合年轻人的靠谱的副业。绝对不是送外卖、滴滴、搬砖等等的苦力活,这几个副业都是能是性价比极高,还能让你快速成长的工作。 想通过副业实现暴富、立马月入过万的同学,建议速速划走。 今天撇哥就给大家分享 100+个…

我爸讽刺我,写个破代码一年才十几万,他在工地带50个人,让我回去跟他干,写代码没出路,我该怎么选择?

我跟你一样的情况,本人现身说法,千万不要跟你爸干,我就是反面教材,现在想回去都回不去了,快十年没写代码了,再就是岁数大了,38岁了,35岁以上的码农根本就没公司愿意要,而且会受歧视。 工程不好干,首先就是不合法,在法律层面,根本就没有包工头…

在 Istio、Linkerd 和 Cilium 之间,哪种服务网格在性能上表现最佳?

在 Istio、Linkerd 和 Cilium 之间,哪种服务网格在性能上表现最佳?

在讨论服务网格之前,先理解一下为什么我们需要它。现代微服务架构意味着将应用拆分为多个小型、独立的服务,这些服务可以独立开发、部署和扩展。然而,服务之间的通信和管理成了巨大的挑战,例如如何保证安全的通信、负载均衡、监控与可观测性等。服务网格…

为什么扫码支付在中国流行,在发达国家被排斥?

因为这是一种落后的技术。 卖菜的大爷花5毛钱就可以打印出一张二维码来接受付款。 你觉着这种先进么?跟先进完全不沾边的。正是因为不先进,所以才能流行。 卖菜大爷用不起一台先进的、具有NFC感应功能的、还能刷各种银行卡的收款机。 这就是现实。…

发表评论

访客

看不清,换一张

◎欢迎参与讨论,请在这里发表您的看法和观点。