123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- <!DOCTYPE html>
- <html>
- <head>
- <title>合同信息提取</title>
- <style>
- body {
- font-family: Arial, sans-serif;
- padding: 20px;
- }
- button {
- padding: 10px 20px;
- background-color: #4caf50;
- color: white;
- border: none;
- border-radius: 4px;
- cursor: pointer;
- }
- button:hover {
- background-color: #45a049;
- }
- #result {
- margin-top: 20px;
- padding: 15px;
- border: 1px solid #ddd;
- border-radius: 4px;
- white-space: pre-wrap;
- }
- </style>
- </head>
- <body>
- <button onclick="sendRequest()">提取合同信息</button>
- <div id="result"></div>
- <script>
- async function sendRequest() {
- const url = "http://192.168.10.204:5000/api/chats/contract_extract";
- const payload = {
- ip: "192.168.10.204",
- port: "8080",
- chat_id: "74d25da0fd8a11ef9b830242ac120006",
- question:
- "抽取合同关键信息,将信息转为结构化数据 抽取信息如下:金额(相同含义:服务费)、甲方信息(甲方,甲方法定代表人(负责人),住 所)、乙方信息(已方,乙方法定代表人(负责人),住 所)、付款计划(服务费结算期限)、合同期限,以key-value的方式返回信息",
- stream: false,
- session_id: "f0ee1021110047d4a51f82e0570f43ca",
- };
- try {
- const response = await fetch(url, {
- method: "POST",
- headers: {
- "Content-Type": "application/json",
- Authorization: "Bearer ragflow-I5ZWRhYzU2ZmEzMTExZWZiYmI3MDI0Mm",
- },
- body: JSON.stringify(payload),
- });
- if (!response.ok) {
- throw new Error(`HTTP error! status: ${response.status}`);
- }
- const data = await response.json();
- document.getElementById("result").textContent = JSON.stringify(
- data,
- null,
- 2
- );
- } catch (error) {
- console.error("Error:", error);
- document.getElementById("result").textContent =
- "请求失败: " + error.message;
- }
- }
- </script>
- </body>
- </html>
|