����deepseek��html���a���d
�l(f��)���r�g:2025-02-13 11:58 [ ��Ҫ�ԌW(xu��)�W(w��ng)ԭ��(chu��ng) ] �l(f��)����: samohu ��x: 1047

���deepseek���ȫ�������˕��뵽�����ֱ����һ�����ε�h5���Ϳ����M���ᆖ������Ҫdeepseek�L���W(w��ng)վ��app�������������������չʾ��Ч���ʹ��a


������һ�����εĽ���DeepSeek����(w��)��HTML���aʾ�����������A(ch��)��API�{(di��o)�úͽ��潻����

<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>DeepSeek����ʾ��</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            max-width: 800px;
            margin: 0 auto;
            padding: 20px;
        }
        .container {
            border: 1px solid #e0e0e0;
            border-radius: 8px;
            padding: 20px;
            margin-top: 20px;
        }
        input, button {
            padding: 10px;
            margin: 5px;
            border-radius: 4px;
        }
        input {
            width: 70%;
            border: 1px solid #ddd;
        }
        button {
            background-color: #007bff;
            color: white;
            border: none;
            cursor: pointer;
        }
        button:hover {
            background-color: #0056b3;
        }
        #result {
            margin-top: 20px;
            padding: 15px;
            border: 1px solid #eee;
            border-radius: 4px;
            min-height: 100px;
        }
        .loading {
            color: #666;
            font-style: italic;
        }
    </style>
</head>
<body>
    <div class="container">
        <h2>DeepSeek ������ʾ</h2>
        <input type="text" id="questionInput" placeholder="ݔ�����Ć��}...">
        <button onclick="askDeepSeek()">�ᆖ</button>
        <div id="result"></div>
    </div>

    <script>
        // ��Q�����Č��HAPI���
        const API_KEY = 'YOUR_DEEPSEEK_API_KEY';
        const API_URL = 'https://api.deepseek.com/v1/chat/completions'; // ���O(sh��)��API��ַ

        async function askDeepSeek() {
            const question = document.getElementById('questionInput').value;
            const resultDiv = document.getElementById('result');
           
            if (!question) {
                alert('Ոݔ�놖�}');
                return;
            }

            resultDiv.innerHTML = '<div class="loading">˼����...</div>';

            try {
                const response = await fetch(API_URL, {
                    method: 'POST',
                    headers: {
                        'Content-Type': 'application/json',
                        'Authorization': `Bearer ${API_KEY}`
                    },
                    body: JSON.stringify({
                        model: "deepseek-chat", // ����(j��)���Hģ���޸�
                        messages: [{
                            role: "user",
                            content: question
                        }]
                    })
                });

                const data = await response.json();
               
                if (response.ok) {
                    const answer = data.choices[0].message.content;
                    resultDiv.innerHTML = `<strong>�𰸣�</strong>${answer}`;
                } else {
                    resultDiv.innerHTML = `�e�`��${data.error.message}`;
                }
            } catch (error) {
                resultDiv.innerHTML = `Ո��ʧ����${error.message}`;
            }
        }
    </script>
</body>
</html>



��Ҫ�f����

  1. ��Ҫ��Q�ă�(n��i)�ݣ�

  • �� YOUR_DEEPSEEK_API_KEY ��Q�������H��API���


api����L�������¾W(w��ng)ַ�M�Ы@ȡhttps://www.deepseek.com�����_�W(w��ng)ַ�x��api�_��ƽ�_��
���ˆD��ʾ






HTML���A(ch��)ҕ�l�̳�
��Ҫ�ԌW(xu��)�W(w��ng)�̳� ��30 Ԫ
�M��ُ�I
�����uՓ
���ӱ���
�������A���񹲺͇��ĸ�헵��·�Ҏ(gu��)��
�Г��������О����(d��o)�µķ���؟����
��վ�Й�(qu��n)������h���Р��h�uՓ��
���c���uՓ���������ѽ�(j��ng)��x������
�����l����
V
�ػݳ�ֵ
“(li��n)ϵ�ͷ�
APP���d
�ٷ�΢��
����픲�
����x��:
��X�k�� ƽ���O(sh��)Ӌ �҃�(n��i)�O(sh��)Ӌ �����O(sh��)Ӌ �Cе�O(sh��)Ӌ ���I(y��)�Ԅӻ� Ӱҕ�Ӯ� �����_�l(f��) �W(w��ng)��O(sh��)Ӌ ��Ӌ�n�� �dȤ���L AIGC