部署网页在服务器(公网)上笔记 infinityfree 写一个找工作单html文件的网站

pythonanywhere 免费套餐没办法爬网站信息,只能连接上几个白名单的网站

render要连信用卡

不過由於平台官方考量[1],從 2022/10/26 起,Heroku 將開始刪除不活躍的帳號,直到 2022/11/28 將完全停止提供免費方案。

於是大家便開始苦尋下一個替代方案,而其中一個選擇就是這篇要介紹的 Fly.io 啦!

fly.io也要绑定信用卡



最后就用放弃python后端 Website Builder - InfinityFree

写了一个html上来

记得换找工作的网站

个人信息

和deepseekip

html 复制代码
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>找工作助手</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
        }
        .controls {
            margin-bottom: 20px;
            padding: 10px;
            border: 1px solid #ccc;
            border-radius: 5px;
        }
        .messages {
            height: 400px;
            overflow-y: auto;
            border: 1px solid #ccc;
            padding: 10px;
            margin-bottom: 20px;
            border-radius: 5px;
        }
        .message {
            margin-bottom: 10px;
            padding: 5px;
            border-radius: 3px;
        }
        .user {
            background-color: #e3f2fd;
        }
        .assistant {
            background-color: #f3e5f5;
        }
        .system {
            background-color: #e8f5e8;
        }
        .input-area {
            display: flex;
            margin-top: 10px;
        }
        .input-area input {
            flex: 1;
            padding: 5px;
            margin-right: 10px;
        }
        button {
            padding: 5px 10px;
            cursor: pointer;
        }
        .job-item {
            border: 1px solid #ddd;
            padding: 10px;
            margin: 10px 0;
            border-radius: 5px;
        }
        .personal-info {
            background-color: #f0f8ff;
            padding: 15px;
            border-radius: 5px;
            margin-bottom: 20px;
        }
        .loading {
            display: none;
        }
    </style>
</head>
<body>
    <h1>找工作助手</h1>
    

    
    <div class="controls">
        <button id="fetchJobBtn">获取并分析工作信息</button>
        <button id="clearBtn">清空消息</button>
        <span id="loadingIndicator" class="loading">正在获取工作信息...</span>
    </div>
    
    <div id="jobInfo" style="display: none;">
        <h3>当前工作信息</h3>
        <div id="jobDetails"></div>
    </div>
    
    <div class="messages" id="messages">
        <p>等待消息...</p>
    </div>
    
    <div class="input-area">
        <input type="text" id="messageInput" placeholder="输入您的回复...">
        <button id="sendBtn" disabled>发送</button>
    </div>
    
    <h2>工作分析结果</h2>
    <div id="jobs">
        <p>暂无工作分析结果</p>
    </div>

    <script>
        // API密钥(从环境变量中获取)
        const API_KEYS = {
            deepseek: "你的deepapikey", // DeepSeek API Key
            zhipu: "d121416576624afca2902462fda1baff.Va2AyE6qDFzYTmZc"    // Zhipu API Key
        };
        
        // 个人信息
        const PERSONAL_INFO = "填你的个人信息。";
        
        // 显示个人信息
        
        
        // 获取工作信息
        async function fetchJob() {
            try {
                // 显示加载状态
                document.getElementById('loadingIndicator').style.display = 'inline';
                document.getElementById('fetchJobBtn').disabled = true;
                addMessage('正在获取工作信息...', 'system');
                
                // 调用真实的API获取工作信息
                //用自己的找工作的网站//
                const response = await fetch('https://www.xmrc.com.cn/api/RecruitPositionSearch?page=1&pageSize=20&rnd=0.7342038148627013', {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                        'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36'
                    },
                    body: JSON.stringify({
                        "ticket": "1755915449",
                        "version": "1.0",
                        "platform": 0,
                        "sign": "6d033bd68f45e42f78f2eb5395eb90d5",
                        "data": {
                            "CreateTime": -1,
                            "CreateTimeName": "不限",
                            "UpdateTime": -1,
                            "UpdateTimeName": "不限",
                            "WelfareName": "不限",
                            "Welfare": "",
                            "Key": "机械设计",
                            "Degree": -1,
                            "DegreeName": "不限",
                            "Age": -1,
                            "AgeName": "不限",
                            "WorkYear": -1,
                            "WorkYearName": "不限",
                            "SalaryType": -1,
                            "SalaryTypeName": "不限",
                            "Salary": -1,
                            "SalaryName": "不限",
                            "CompanyTypeId": -1,
                            "CompanyTypeIdName": "不限",
                            "JobPropertyTypeId": -1,
                            "JobPropertyTypeIdName": "不限",
                            "JobDateId": -1,
                            "JobDateIdName": "不限",
                            "OrderBy": 1,
                            "OrderByName": "发布时间",
                            "AscDesc": 1,
                            "AscDescName": "降序",
                            "SearchType": 0
                        }
                    })
                });
                
                if (!response.ok) {
                    throw new Error(`获取工作信息失败: ${response.status}`);
                }
                
                const result = await response.json();
                
                // 检查返回数据是否有效
                if (!result.Data || !result.Data.Items || result.Data.Items.length === 0) {
                    throw new Error('未找到相关工作信息');
                }
                
                const jobData = result.Data.Items[0];
                window.currentJob = jobData;
                
                document.getElementById('jobDetails').innerHTML = `
                    <p><strong>职位:</strong> ${jobData.JobName || '未知'}</p>
                    <p><strong>公司:</strong> ${jobData.CompanyName || '未知'}</p>
                    <p><strong>工作详情:</strong> ${jobData.JobDetail || '无详情'}</p>
                    <p><strong>工作地址:</strong> ${jobData.Address || '未提供'}</p>
                    <p><strong>薪资:</strong> ${jobData.SalaryName || '面议'}</p>
                    <p><strong>学历要求:</strong> ${jobData.DegreeName || '不限'}</p>
                    <p><strong>工作经验:</strong> ${jobData.WorkYearName || '不限'}</p>
                    <p><strong>ID:</strong> ${jobData.Id || '未知'}</p>
                `;
                document.getElementById('jobInfo').style.display = 'block';
                
                addMessage(`获取到工作: ${jobData.JobName || '未知职位'}`, 'system');
                
                // 自动分析工作
                await analyzeJob();
            } catch (error) {
                addMessage(`获取工作信息失败: ${error.message}`, 'system');
            } finally {
                document.getElementById('loadingIndicator').style.display = 'none';
                document.getElementById('fetchJobBtn').disabled = false;
            }
        }
        
        // 分析工作
        async function analyzeJob() {
            if (!window.currentJob) {
                addMessage('请先获取工作信息', 'system');
                return;
            }
            
            try {
                addMessage('正在分析工作...', 'system');
                
                // 使用DeepSeek API进行分析
                const response = await fetch('https://api.deepseek.com/v1/chat/completions', {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                        'Authorization': `Bearer ${API_KEYS.deepseek}`
                    },
                    body: JSON.stringify({
                        model: "deepseek-chat",
                        messages: [
                            {
                                role: "system",
                                content: `这是我的个人信息:${PERSONAL_INFO}\n请根据这份个人信息分析以下工作是否适合我,以猫娘的口吻简洁回答,不能暴露我的个人信息`
                            },
                            {
                                role: "user",
                                content: `请分析这份工作是否适合我:\n职位: ${window.currentJob.JobName}\n公司: ${window.currentJob.CompanyName}\n详情: ${window.currentJob.JobDetail}\n地址: ${window.currentJob.Address}\n薪资: ${window.currentJob.SalaryName}\n学历要求: ${window.currentJob.DegreeName}\n工作经验: ${window.currentJob.WorkYearName}`
                            }
                        ],
                        temperature: 0.7
                    })
                });
                
                if (!response.ok) {
                    throw new Error(`API请求失败: ${response.status}`);
                }
                
                const data = await response.json();
                const analysis = data.choices[0].message.content;
                
                addMessage(`工作分析结果:\n${analysis}`, 'assistant');
                
                // 保存分析结果
                saveJobResult(window.currentJob.Id, window.currentJob.JobDetail, analysis);
                refreshJobs();
                
            } catch (error) {
                addMessage(`分析工作失败: ${error.message}`, 'system');
            }
        }
        
        // 添加消息到显示区域
        function addMessage(text, type) {
            const messagesDiv = document.getElementById('messages');
            const msgDiv = document.createElement('div');
            msgDiv.className = `message ${type}`;
            msgDiv.innerHTML = `<strong>${new Date().toLocaleString()}</strong><br>${text.replace(/\n/g, '<br>')}`;
            messagesDiv.appendChild(msgDiv);
            messagesDiv.scrollTop = messagesDiv.scrollHeight;
            
            // 保存消息到localStorage
            saveMessage(text, type);
        }
        
        // 保存消息到localStorage
        function saveMessage(text, type) {
            let messages = [];
            const messagesStr = localStorage.getItem('messages');
            if (messagesStr) {
                messages = JSON.parse(messagesStr);
            }
            
            messages.push({
                text: text,
                type: type,
                timestamp: new Date().toLocaleString()
            });
            
            // 只保留最近100条消息
            if (messages.length > 100) {
                messages = messages.slice(-100);
            }
            
            localStorage.setItem('messages', JSON.stringify(messages));
        }
        
        // 保存工作分析结果
        function saveJobResult(jobId, jobDetail, analysis) {
            let jobs = [];
            const jobsStr = localStorage.getItem('jobResults');
            if (jobsStr) {
                jobs = JSON.parse(jobsStr);
            }
            
            jobs.push({
                jobId: jobId,
                jobDetail: jobDetail,
                analysis: analysis,
                timestamp: new Date().toLocaleString()
            });
            
            // 只保留最近50条记录
            if (jobs.length > 50) {
                jobs = jobs.slice(-50);
            }
            
            localStorage.setItem('jobResults', JSON.stringify(jobs));
        }
        
        // 刷新消息显示
        function refreshMessages() {
            const messagesDiv = document.getElementById('messages');
            messagesDiv.innerHTML = '';
            
            let messages = [];
            const messagesStr = localStorage.getItem('messages');
            if (messagesStr) {
                messages = JSON.parse(messagesStr);
            }
            
            if (messages.length === 0) {
                messagesDiv.innerHTML = '<p>等待消息...</p>';
                return;
            }
            
            messages.forEach(msg => {
                const msgDiv = document.createElement('div');
                msgDiv.className = `message ${msg.type}`;
                msgDiv.innerHTML = `<strong>${msg.timestamp}</strong><br>${msg.text.replace(/\n/g, '<br>')}`;
                messagesDiv.appendChild(msgDiv);
            });
            
            messagesDiv.scrollTop = messagesDiv.scrollHeight;
        }
        
        // 刷新工作列表
        function refreshJobs() {
            const jobsDiv = document.getElementById('jobs');
            jobsDiv.innerHTML = '';
            
            let jobs = [];
            const jobsStr = localStorage.getItem('jobResults');
            if (jobsStr) {
                jobs = JSON.parse(jobsStr);
            }
            
            if (jobs.length === 0) {
                jobsDiv.innerHTML = '<p>暂无工作分析结果</p>';
                return;
            }
            
            jobs.slice().reverse().forEach(job => {
                const jobDiv = document.createElement('div');
                jobDiv.className = 'job-item';
                jobDiv.innerHTML = `
                    <h3>工作ID: ${job.jobId}</h3>
                    <p><strong>时间:</strong> ${job.timestamp}</p>
                    <p><strong>工作详情:</strong> ${job.jobDetail}</p>
                    <p><strong>分析结果:</strong> ${job.analysis.replace(/\n/g, '<br>')}</p>
                `;
                jobsDiv.appendChild(jobDiv);
            });
        }
        
        // 清空所有消息和工作分析结果
        function clearAll() {
            // 清空本地存储
            localStorage.removeItem('messages');
            localStorage.removeItem('jobResults');
            
            // 清空显示区域
            document.getElementById('messages').innerHTML = '<p>等待消息...</p>';
            document.getElementById('jobs').innerHTML = '<p>暂无工作分析结果</p>';
            
            // 隐藏工作信息
            document.getElementById('jobInfo').style.display = 'none';
            
            // 清空当前工作信息
            window.currentJob = null;
            
            addMessage('已清空所有消息和工作分析结果', 'system');
        }
        
        // 发送消息
        function sendMessage() {
            const input = document.getElementById('messageInput');
            const message = input.value.trim();
            
            if (message) {
                addMessage(`用户: ${message}`, 'user');
                input.value = '';
                
                // 这里可以添加与AI的进一步交互逻辑
                // 由于是静态页面,我们只保存消息
            }
        }
        
        // 初始化事件监听器
        document.addEventListener('DOMContentLoaded', function() {
            // 刷新显示
            refreshMessages();
            refreshJobs();
            
            // 事件监听
            document.getElementById('fetchJobBtn').addEventListener('click', fetchJob);
            document.getElementById('clearBtn').addEventListener('click', clearAll);
            
            document.getElementById('sendBtn').addEventListener('click', sendMessage);
            document.getElementById('messageInput').addEventListener('keypress', function(e) {
                if (e.key === 'Enter') {
                    sendMessage();
                }
            });
        });
    </script>
</body>
</html>
相关推荐
阿阳微客13 分钟前
CSGO搬砖项目详解:从装备选择到市场策略
笔记·学习·游戏
RanceGru15 分钟前
神经网络学习笔记11——高效卷积神经网络架构SqueezeNet
笔记·神经网络·学习
慕伏白28 分钟前
【慕伏白】CTFHub 技能树学习笔记 -- Web 之密码口令
笔记·学习
麻雀无能为力37 分钟前
python 自学笔记13 numpy数组规整
笔记·python·numpy
17岁的勇气1 小时前
Unity Shader unity文档学习笔记(二十一):几种草体的实现方式(透明度剔除,GPU Instaning, 曲面细分+几何着色器实现)
笔记·学习·unity
天下琴川2 小时前
Dify智能体平台二次开发笔记(10):企业微信5.0 智能机器人对接 Dify 智能体
笔记·机器人·企业微信
yjx233325 小时前
并行多核体系结构基础——共享存储并行编程与针对链式数据结构的并行编程(笔记)
笔记
越前君5 小时前
如何开发一个 Raycast 扩展?
前端·笔记
悠哉悠哉愿意6 小时前
【机器学习学习笔记】机器学习引言
笔记·学习·机器学习