Python 编程助手
作品简介
对于编程新手来说,Python 编程可能会遇到各种问题,从语法错误到逻辑难题。本作品旨在为 Python 编程爱好者提供一个便捷的编程助手,通过简单的对话或粘贴代码片段,即可获得帮助和解答,简单方便。
技术架构
采用了全后端分离的架构,前端使用Vue.js,腾讯云的AI服务处理自然语言理解与生成。
实现过程
开发环境、开发流程
- 系统:Windows 11
- 开发工具:vscode
- 开发环境:Python 3.9
开发流程
开发环境:node-v23.6.0-win-x64
开发流程:装好node后使用npm i初始化项目,使用npm run dev启动项目
关键技术解析
使用web样式将ai部署在网页中
腾讯云 AI 代码助手在上述过程中的助力
-
理解代码
- 通过腾讯云 AI 代码助手,快速理解代码逻辑和功能。
- 通过腾讯云 AI 代码助手,快速理解代码逻辑和功能。
-
增加标识内容
- 给页面增加了显示的 title,使用腾讯云 AI 代码助手完成的所有内容。
-
完成了不少的代码区域
效果展示
演示视频地址:Python 编程助手 - 优快云
代码示例
前端部分(Vue.js)
<template>
<t-chat
ref="chatRef"
layout="single"
style="height: 600px"
:clear-history="chatList.length > 0 && !isStreamLoad"
@clear="clearConfirm"
>
<template v-for="(item, index) in chatList" :key="index">
<t-chat-item
:avatar="item.avatar"
:name="item.name"
:role="item.role"
:datetime="item.datetime"
:content="item.content"
:text-loading="index === 0 && loading"
>
<template v-if="!isStreamLoad" #actions>
<t-chat-action
:is-good="isGood"
:is-bad="isBad"
:content="item.content"
@operation="(type, { e }) => handleOperation(type, { e, index })"
/>
</template>
</t-chat-item>
</template>
<template #footer>
<t-chat-input :stop-disabled="isStreamLoad" @send="inputEnter" @stop="onStop"> </t-chat-input>
</template>
</t-chat>
<h1
style="
text-align: center;
margin-top: 20px;
font-family: 'Arial', sans-serif;
color: #f8fae4;
background-color: #a48be6;
padding: 10px 20px;
border-radius: 5px;
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
"
>
Python 编程助手
</h1>
</template>
<script setup>
import {
ref } from 'vue';
const fetchCancel = ref(null);
const loading = ref(false);
const isStreamLoad = ref(false);
const isGood = ref(false);
const isBad = ref(false);