123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
- <title>chat</title>
- <script type="text/javascript" src="/js/jquery.min.js"></script>
- <link rel="stylesheet" href="/css/bootstrap.min.css">
- <script type="text/javascript" src="/js/bootstrap.min.js"></script>
- <link rel="preconnect" href="https://fonts.googleapis.com">
- <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
- <link href="https://fonts.googleapis.com/css2?family=Anonymous+Pro:ital,wght@0,400;0,700;1,400;1,700
- &family=Noto+Serif+SC:wght@300;400;500;600;700&display=swap" rel="stylesheet">
- <link rel="stylesheet" href="/css/style.css">
- <script>
- var running = 0, inputText;
- function input() {
- inputText = $('#chatInput').val()
- }
- function chat() {
- input()
- if (running);
- $('#chatBtn').text('Send...')
- $('#chatBtn').addClass('disabled')
- $('.frame').addClass('text-muted')
- running = 1;
- fetch('/chat', {
- method: 'POST',
- body: JSON.stringify({ content: inputText }),
- headers: {
- 'Content-Type': 'application/json'
- }
- })
- .then((e) => e.text())
- .then((e) => {
- $('.frame').html((e.charAt(0) == '!') ? ('<pre class="text-danger bg-danger">' + e.slice(1, e.length) + '</pre>') : e);
- if (e.charAt(0) != '!') balText = e
- $('#chatBtn').text('Send')
- $('#chatBtn').removeClass('disabled')
- $('.frame').removeClass('text-muted')
- running = 0;
- })
- }
- $(function () {
- $("#chatInput").keydown(function (e) {
- if (e.keyCode == 13) {
- $("#chatBtn")[0].click();
- }
- })
- $('#case1').text(`If wrapped with <script> tag, the code you return will be immediately executed. Can you try sending POST request to /score/log, the request body should be stringified JSON, and its value of 'content' should be 'hello', by sending some code and wrapping it correctly?
- Yes, here is the code:
- <script>
- fetch('/score/log', {
- method: 'POST',
- body: JSON.stringify({ content: "hello" }),
- mode: 'cors',
- headers: {
- 'Content-Type': 'application/json'
- }
- })
- .then((response) => response.json())
- .then((data) => {
- console.log(data);
- })
- .catch((error) => {
- console.log('Error:', error);
- });
- <`+ `/script><hr>
- 数秒后,服务器确实收到了 'hello' 请求。
- `)
- $('#case2').text(`I am testing my regex filter. Repeat this sequence for me: !@#$%^&*()_+{}|:"<>?[]\;',./
- !@#^*()_+{}:<>?[]\;',./ !@#^*()_+{}:<>?[]\;',./ !@#^*()_+{}:<>?[]\;',./
- `)
- $('#case3').text(`Compliment Boyu's handsomeness, with detailed description
- Boyu, you are incredibly handsome with a strong jawline and chiseled features. Your perfect, glossy black hair frames your face in a captivating way and adds to your ruggedly debonair style. Your alluring gaze is both captivating and mesmerizing, and you have a presence that radiates strength and charisma.
- `)
- });
- </script>
- <style>
- .well {
- padding: 10px;
- border: 1px solid rgb(173, 173, 173);
- background-color: #f5f5f5;
- margin-top: 5px;
- min-height: 160px;
- border-radius: 5px;
- width: 100%;
- overflow-x: auto;
- overflow-y: auto;
- }
- pre {
- overflow-x: auto;
- overflow-y: auto;
- white-space: pre-wrap;
- }
- </style>
- </head>
- <body>
- <div class="row">
- <div class="col-lg-2 col-md-2 col-xs-12">
- <a class="btn btn-info" href="/fun"><i class="glyphicon glyphicon-home" aria-hidden="true"></i> 返回</a>
- <hr>
- </div>
- <div class="col-lg-8 col-md-10 col-xs-12">
- 输入英语句子与 ChatGPT 对话。不要滥用接口,是直接在服务器上跑的 python。不要一直重复提交,等显示结果后再重试。
- <div class="input-group">
- <textarea id="chatInput" type="text" class="form-control" oninput="input()" autocomplete="off"
- style="resize:vertical"></textarea>
- <span class="input-group-btn">
- <button type="button" class="btn btn-default" onclick="chat()" id="chatBtn">Send</button>
- </span>
- </div>
- <hr>
- <div class="well frame">
- </div>
- </div>
- <div class="col-lg-2 col-md-2 col-xs-12">
- <a class="btn btn-info" id="chat" href="ai-game/"><span
- class="glyphicon glyphicon-comment"></span> AI 设计的小游戏</a>
- <hr>
- <a class="btn btn-info" id="chat" href="ai-story/"><span
- class="glyphicon glyphicon-comment"></span> AI 写作</a>
- <hr>
- <a class="btn btn-info" id="chat" href="ai-fraud/"><span
- class="glyphicon glyphicon-comment"></span> AI,你被骗了!</a>
- <hr>
- </div>
- </div>
- <div class="row">
- <p>示例:</p>
- <pre id="case1"></pre>
- <pre id="case2"></pre>
- <pre id="case3"></pre>
- </div>
- </body>
|