Sharing: All kinds of AI Copilot-assisted development used in front-end development

foreword

Now who has not used AI-assisted programming tools, it is not sure if they have access to the Internet, but they must not be engaged in development.
All kinds of teaching on the Internet are used directly as a business, but this method is not compliant and is not recommended here. In order not to be blocked again, this article will avoid using irrelevant keywords.

Although for various reasons, it cannot be used directly. But now, there are already many compliance methods that allow us to use them stably. The main thing is to use third-party applications/tools/plug-ins, openly and indirectly.

Notice: Based on personal experience and development habits, AI dialogue is a very good "tool man". Its level depends largely not on itself, but on your level, the clarity and accuracy of your description of the problem. While it can be very powerful, don't get overly addicted to it. Regular measures such as consulting authoritative technical documentation are also essential when trying to obtain a solution to a problem.

In addition, domestic competing products such as Wenxin Yiyan and Xunfei Xinghuo are also rapidly following up, so you can look forward to it

1. Free browser plug-ins

plug-in

Chrome Plug-in: Search Monica, Sider in Chrome Apps
Microsoft Plug-in: Edge Add-in Search Sider

It can be installed and used on the Edge Chrome browser respectively, and the free version has 30 questions per day. Save it, enough is enough. Those who use it deeply or are not short of money can spend money to upgrade the package, the price starts from 10 knives/month, and starts from 100 knives/year

Practice has shown that AI is really just AI. When chatting, your mentality should not be to let it do the work for you, but to give you advice and demo demonstrations. You still need to distinguish right from wrong. Experienced syntax errors, outdated methods, homemade syntax, etc...

The above two plugins both provide common "speaking techniques" and support customization and saving.
The most important thing is that they are very stable, and many of them are completely free, or they will be charged later or get stuck if there are too many people.

2. Copilot

programming assistant

GitHub Copilot

GitHub Copilot - Wikipedia
GitHub Copilot
GitHub Copilot VSCode plugin - Your AI pair programmer

Compared with the AI ​​dialogue where you can ask anything, GitHub Copilot is positioned as a "pair programming assistant". For specific introduction and usage, please refer to the official introduction. It can be installed and extended in JetBrains IDEs (Beta), Neovim, Visual Studio, Visual Studio Code.

very smooth to use

It can be used for free for 60 days, and the subscription price starts from 10 knives per month and 100 knives per year

example

GitHub Copilot is the most used by individuals, and it is used in a way that allows it to participate in daily development to the greatest extent

1. js method

insert image description here

2. vue single file component

Develop a component with a certain complexity and a series of logics. In this process, copilot can truly reflect what is called an AI pair programming assistant
insert image description here

test code

<script setup>
import {
      
       ref, provide } from 'vue'
import UserViewComp from './UserView/index.vue'
import OrderViewComp from './OrderView/index.vue'

// 当前显示的视图 [order|user]
const activeView = ref('')
const orderViewEl = ref()
const userViewEl = ref()

// 切换到user视图
function showUserView(no, record = true) {
      
      
  userViewEl.value.showView(no)
  activeView.value = 'user'
  record && addRecord('user', no)
}
// 切换到order视图
function showOrderView(no, record = true) {
      
      
  orderViewEl.value.showView(no)
  activeView.value = 'order'
  record && addRecord('order', no)
}
// 提供方法:组件间切换视图
provide('showUserView', showUserView)
provide('showOrderView', showOrderView)


/**
 * 记录
 * 记录切换视图的操作, currentRecordIndex指向当前记录, 可前进后退
 * 当有新记录时, currentRecordIndex+1, 后面的记录将被清空
 * 
 * @prop {string} type 记录类型 [user|order]
 * @prop {string} no 记录编号
 */
const records = ref([])
// 当前记录索引
const currRecordIndex = ref(-1)
const forwardDisabled = computed(() => currRecordIndex.value >= records.value.length - 1)
const backDisabled = computed(() => currRecordIndex.value <= 0)

// 监听records, 当长度超过20时, 删除前面的记录
watch(records, (newVal) => {
      
      
  if (newVal.length > 20) {
      
      
    records.value.splice(0, newVal.length - 20)
    currRecordIndex.value = 19
  }
})

// 前进
function forward() {
      
      
  if (currRecordIndex.value < records.value.length - 1) {
      
      
    currRecordIndex.value++
    const record = records.value[currRecordIndex.value]
    if (record.type === 'user') {
      
      
      showUserView(record.no, false)
    } else {
      
      
      showOrderView(record.no, false)
    }
  }
}
// 后退
function back() {
      
      
  if (currRecordIndex.value > 0) {
      
      
    currRecordIndex.value--
    const record = records.value[currRecordIndex.value]
    if (record.type === 'user') {
      
      
      showUserView(record.no, false)
    } else {
      
      
      showOrderView(record.no, false)
    }
  }
}
// 添加记录
function addRecord(type, no) {
      
      
  // 如果新记录与当前记录相同, 则不添加
  if (currRecordIndex.value > -1 && records.value[currRecordIndex.value].type === type && records.value[currRecordIndex.value].no === no) {
      
      
    return
  }
  // 如果新纪录与前一条记录相同, 则前进一步
  if (currRecordIndex.value > 0 && records.value[currRecordIndex.value - 1].type === type && records.value[currRecordIndex.value - 1].no === no) {
      
      
    forward()
    return
  }
  // 如果新纪录与后一条记录相同, 则后退一步
  if (currRecordIndex.value < records.value.length - 1 && records.value[currRecordIndex.value + 1].type === type && records.value[currRecordIndex.value + 1].no === no) {
      
      
    back()
    return
  }
  currRecordIndex.value++
  records.value.splice(currRecordIndex.value, records.value.length - currRecordIndex.value, {
      
       type, no })
}
</script>
<template>
  <OrderViewComp v-show="activeView === 'order'" ref="orderViewEl" />
  <UserViewComp v-show="activeView === 'user'" ref="userViewEl" />
</template>

3. vue component

Not only js, it can participate in the most basic html/js/css of front-end development, providing all-round assistance
insert image description here

Again, use silky smooth~
whoever uses it knows

Of course, its problem is that it may directly copy other people's code, which involves infringement issues, so don't use it if you mind.
The suggestions it provides still cannot be directly applied to production, and need to be adopted and improved by itself. After all, it is just an assistant

codeium

After all, github copilot is charged. After the free trial period, you have to pay. Ten dollars a month is still quite expensive. A free alternative is recommended here, which not only includes the functions of the former, but also allows dialogue, and provides quick functions such as code refactoring, explanation, and comment generation. codeium

insert image description here

insert image description here
insert image description here

3. Claude

Just choose to add an application in Slack, and then talk to it directly, free and unlimited

Slack can browse the web and download APPs to PCs and mobile phones, which is very convenient to use

Slack can use Goole account registration, Apple mobile phone registration and login even without scientific Internet access

Daily use without scientific Internet access

Claude is no longer available (Science is available online), you can use keywords to search and add other similar applications

4. Others

Small

VSCode插件: Bito AI – Be a 100x dev and save an hour a day!

Powerful! Compared with the first browser plug-in, it provides a more convenient way of use (inside the IDE), and provides a variety of code functions and shortcut menus. Coming out soon, currently free to use

More and more people know and start using it, and now the response is very slow ಥ_ಥ
However, there are many similar applications


The following is an introduction about it from the above link.

What does Bito AI do?
BITO helps developers dramatically accelerate the impact of AI algorithms by bringing them into your IDE and CLI. Bito saves an hour a day! BITO AI makes it easy to write code, understand syntax, write test cases, explain code, comment code, check security and even explain advanced concepts.

How can Bito's AI assistant help? ask any technical questions

  • Generating Code: Examples: "Code in Java to convert a number from one base to another", "Code to implement a simple REST API in GO"
  • Command syntax: "How to set git config variables", "Create an encrypted S3 bucket using the AWS CLI"
  • Test Case: "The test case <insert code> that generated this code"
  • Explain concepts: "Explain the b+ tree, using code as an example", "Explain the banker's algorithm"


Click the shortcut so you don't have to type anything:

  • Explain Code: Explains code you're not familiar with
  • Comment method: comment method and method
  • Improve Performance: Find Performance Issues Easily
  • Check Security: Make Sure You Have No Security Vulnerabilities
  • The tool is far from perfect. Compile and verify before use!

BITO offers many other features that other tools offer:

  • Automatically compare any new codes generated by BITO with existing codes in the DIFF view. This enables you to integrate only the rows or sections you want.
  • Ask follow-up questions to refine the output, while the AI ​​assistant considers the chat history contextual. This can help you get more accurate and relevant results.
  • Get lightning-fast results in seconds, allowing you to access the information you need with minimal delay.
  • Save your frequently used tips as custom shortcuts and execute them easily.
  • Use keyboard shortcuts to execute commands in BITO. Read more about keyboard shortcuts on our What's New page.
  • Make collaboration easier by sharing results with your colleagues via Slack, Email or Twitter.

Guess you like

Origin blog.csdn.net/ymzhaobth/article/details/130119363