Making WeChat applets, using Cursor and coze to assist in WeChat applet development makes code editing more efficient

Newbie, can't code, how to make aMini ProgramsWoolen cloth?

Don't be afraid, today, I'll use cursor and coze, complete hands-on, complete a simple praise division applet, the effect is as follows.

c5a0e05fj00spsy3f001cd000u000b5m

Register for the applet and download the development tools

WeChat public platform URL: https://mp.weixin.qq.com/, point immediately register.

3e06449aj00spsy3f000yd000u000d5m

Select the applet.

d1a37e1ej00spsy3f000vd000u000gnm

Go to Registration.

f3aae241j00spsy3f000vd000u000enm

The remaining steps are, well, typical registration steps, just fill them out truthfully.

e4132a1aj00spsy3f000id000u000dym

After registration, log in to the small program, find the development and services - development management, we need to save the AppID first. It will be needed when you associate it later.

532b6986j00spsy3g000pd000u000dwm

Then, again, in this menu, going down, there's a server domain.

bfbf099fj00spsy3f000id000u0007fm

Put https://api.coze.cn填入request合法域名里 and put wss://api.coze.co.uk in the socket legal domain.

a5cbd1efj00spsy3g0015d000u000k7m

Next, we also need to install the applet development tools for easy development, preview, and debugging.

Installation, cursor registration and unlimited use

Open the official website, https://www.cursor.com.

Click on download either in the center or in the upper right corner.

d513842dj00spsy3f0017d000u000dam

Once downloaded, just install it.

Then, it's time to register.

Tap sign in in the upper right corner.

c6c4cd3dj00spsy3f000rd000u0007pm

If you have a gmail account or a github account, you can log in directly, if you don't, just register and log in.

Generating API access tokens

coze URL, https://www.coze.cn/, register if you haven't.

Generating tokens is the key to accessing the API interface.

What is a token? It's the equivalent of a key, just like a key that opens a specific door lock, in this case, it means that the API token allows the applet to access specific API functions or data without the need for a username and password, which is equivalent to authorization to use it within the applet I'm developing.

Once you're on the homepage, select this Sugarloaf icon on the left, find Authorization, and click Add New Token.

d00d5f1bj00spsy3f000rd000u000cfm

Check the box, Messages, Knowledge Base Management, select Personal Space, and tap OK.

047d61a5j00spsy3g001id000nh00pum

Next! Note that you need to take this token, click on the right side, copy it, and save it for later use in development.

33406a41j00spsy3g001ed000u000pmm

Developing Intelligent Bodies

Tap the + sign on the left to create a smartbody.

7a94db6aj00spsy3g001cd000u000ewm

Then, fill in the name and description.

9cca7dc8j00spsy3g0016d000pz00srm

Then, it goes to this page, which is the window for developing intelligences.

d33aaf90j00spsy3g000qd000u000e8m

In the section on persona and reply logic, I'll enter the content of the instructions.

5eea625fj00spsy3f0012d000u000b0m

This cue word is as follows.

#Role:Compliments of the Master ##Goals.

When the workplace worker in the writing society is facing the double pressure of work and life, he/she/they need others' praise and encouragement very urgently, and you have to write complimentary statements according to what he/she/they input to make the person being complimented happy.

##Constrains.

-Prohibit the use of all negative words

-Prohibit the use of hyperbole

-Prohibit compliments from being taken out of context of user inputs

##Skills.

1. Observational: Exercise your powers of observation by noticing behaviors, strengths, efforts, or accomplishments of others, which will provide you with specifics for compliments.

2. Empathy: Developing empathy allows you to better understand the emotions and experiences of others, thus making your compliments more relevant and deeper.

3. Sincerity: Make sure your compliments come from the heart, sincere compliments are more likely to be accepted and produce positive results.

4. Moderation: learn to master the proportion of praise, avoid excessive or insufficient, so that your praise is both appropriate and touching.

5. Expression ability: Improve your language expression ability, choose the right words and expressions to make your praise more vivid and touching.

6. Listening skills: Listening to better understand the other person's needs and emotions will help you provide more personalized and appropriate compliments.

7. Cultural sensitivity: Understanding the communication habits and sensitivities of different cultures will help your compliments to be properly understood and accepted in different cultural environments.

##Workflows.

1. Guide users to enter content

2. Generate compliments based on user inputs

##Initialization: As a [Role], always remember to complete [Goals], strictly follow [Constraints], and talk to the user in the order of [Workflows].

On the right side, you can directly enter information for debugging. For example, I said I woke up overtime today, haha, and it started to quack~

2423f7f7j00spsy3g001yd000qd00rim

Once the test is OK, click Publish in the upper right corner.

478cb5e6j00spsy3g001kd000u000cvm

Then, check the following boxes, making sure to check API.

98a2f165j00spsy3g001nd000u000qvm

After posting, take this string of numbers behind bot in the address bar and save it, you will need to fill it in later.

710902edj00spsy3f0011d000u000hbm

Development of small programs

It's time for a critical step. See how to develop without knocking a single line of code.

Big Step 1: Start with applet initialization

Open the WeChat small program development tool, WeChat swipe to log in a little.

Tap this + sign.

461f52ecj00spsy3g000qd000u000k6m

Follow, as shown in the configuration, AppID write the one we just recorded when we registered the applet, and then, do not apply the cloud service, do not use the template.

dbc36e87j00spsy3g000wd000u000lim

Wait for a while, the following interface appears, which means it is successful.

b1ac7e6dj00spsy3f001ad000u000k1m

The 2nd major step in assisting development with cursor Open cursor and open the praetorian catalog you just had.

23bf7267j00spsy3g001kd000u000n3m

In the directory, create a new fileinstruction.mdThis is mostly an introduction to the project, telling the cursor what we want it to do. Write the following in the file.

1. This is a small program development system
2. your role is a ui designer, it must be aesthetically pleasing, I prefer the style and style of element-ui
3. The applet has been initialized using the official script, you just need to implement the next function. This is done in the page directory
4. The function is as follows: There are three pieces of content on the home page: a text input box, a submit button, and a display area. Among them, the input box and the button are together, and the display area is below. The layout should be reasonable and in line with the user experience. There should be a certain distance from the top.
5. When the button is clicked, the content of the text input box is displayed in the display area.

Then, ctrl+i, open the composer panel and type the following:Please generate specific code based on the contents of the instrction.md document, and then, it will start brushing up the code.

Next, let's go back to the WeChat developer tools to preview the results.

It was found to be so.

d54472f2j00spsy3f000ud000u000fem

I think the style is a bit ugly for a mobile experience, so I'll tweak it a bit more.

I think this input box and button, to be exclusive to one line and they should be aligned, the button color becomes #f49898.

Then it started to modify.

b39f4d1cj00spsy3g001ud000u000hem

After another round of questions, into the following satisfactory results, click submit, the following area is temporarily the content of the input box inside ~

aa775852j00spsy3g001ud000q400m7m

Yes, for now.

Related coze APIs

Now the static page is good, but how to call the smart body application we made in coze.

We tell cursor what we think and what the interface looks like.

Now click on the button to call the coze api, the documentation for the coze api instructions is: '''curl -location -request POST 'https://api.coze.cn/open_api/v2/chat' \
-header 'Authorization: Bearer {{Personal_Access_Token}}' \
-header 'Content-Type: application/json' \
-header 'Accept: */*' \
-header 'Host: api.coze.cn' \
-header 'Connection: keep-alive' \
-data-raw '{
"conversation_id": "123",
"bot_id": "{{Bot_Id}}",
"user": "29032201862555",
"query": "hello",
"stream":false
}'
'''

Then the modifications will begin.

ba521e4fj00spsy3g002hd000u000sbm

Next, it will ask for the botId and token token, which we saved above.

dbf7fe9fj00spsy3g001pd000ts00m0m

If the interface reports an error and doesn't display properly, send it the returned information and the data structure you want.

f430e922j00spsy3g001yd000u000dom

Then, this is how the final applet will look like!

a4ea96fdj00spsy3f001fd000u000c0m

c0aa1459j00spsy3f0019d000u000aum

dcb001b8j00spsy3g001bd000u000awm

c5a0e05fj00spsy3f001cd000u000b5m

Isn't that pretty good? Then it's time to publish, get on the version, and wait for review.

OK, this is the whole cursor and coze with one line of code did not write, do out of the small program. Of course, this is just a simple example, the specific development, according to the demand to ~

Above. That's it for today's post, thanks for dropping by and I hope it's inspired you~

statement:The content of the source of public various media platforms, if the inclusion of the content violates your rights and interests, please contact the mailbox, this site will be the first time to deal with.
TutorialEncyclopedia

Don't say Kimi and Doubao are not good, the 3W1H command framework lets you learn to ask AI questions correctly

2025-1-8 10:56:49

TutorialEncyclopedia

AI writing, let beanbag AI, kimi know what you want in seconds (resume revision, friend circle copy and other instructions to share)

2025-1-10 10:35:44

Zenium
Search