Spaces:
Running
Running
vlff李飞飞
commited on
Commit
•
1fdcb00
1
Parent(s):
f001d2a
update oai
Browse files
browser_qwen/src/popup_副本.js
ADDED
@@ -0,0 +1,65 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
|
3 |
+
chrome.runtime.onMessage.addListener((msg, sender, sendResponse) => {
|
4 |
+
// if (msg.flag == 'from_content'){
|
5 |
+
// console.log(msg.rsp);
|
6 |
+
// var sessionContainer = document.getElementById('session');
|
7 |
+
// sessionContainer.innerText = msg.rsp;
|
8 |
+
// sendResponse({ msg: 'Get!' });
|
9 |
+
// }
|
10 |
+
if (msg.flag === 'from_llm'){
|
11 |
+
// var sessionContainer = document.getElementById('session');
|
12 |
+
// // sessionContainer.innerHTML = msg.rsp;
|
13 |
+
// sessionContainer.innerText = msg.rsp;
|
14 |
+
sendResponse({ message: 'Get Response!' });
|
15 |
+
}
|
16 |
+
});
|
17 |
+
|
18 |
+
|
19 |
+
document.addEventListener('DOMContentLoaded', function() {
|
20 |
+
chrome.tabs.query({ active: true, currentWindow: true }, function(tabs) {
|
21 |
+
var currentUrl = tabs[0].url;
|
22 |
+
|
23 |
+
chrome.runtime.sendMessage({ data: currentUrl , close: true , flag: 'open_popup_and_send_url_from_popup'});
|
24 |
+
|
25 |
+
});
|
26 |
+
setTimeout(function() {
|
27 |
+
// console.log('This message will be logged after 0.5 second');
|
28 |
+
var popup_url='';
|
29 |
+
chrome.storage.local.get(['database_host'], function(result) {
|
30 |
+
if (result.database_host) {
|
31 |
+
console.log('database_host currently is ' + result.database_host);
|
32 |
+
popup_url = "http://"+result.database_host+":7863/";
|
33 |
+
} else {
|
34 |
+
popup_url = "http://127.0.0.1:7863/";
|
35 |
+
}
|
36 |
+
var iframe = document.createElement('iframe');
|
37 |
+
iframe.src = popup_url;
|
38 |
+
iframe.height = '570px';
|
39 |
+
// iframe.sandbox = 'allow-same-origin allow-scripts';
|
40 |
+
// iframe.allow = "geolocation *;";
|
41 |
+
var iframe_area = document.getElementById('iframe_area')
|
42 |
+
iframe_area.appendChild(iframe);
|
43 |
+
|
44 |
+
});
|
45 |
+
}, 500);
|
46 |
+
|
47 |
+
// fetch('../config_host.json')
|
48 |
+
// .then(response => response.json())
|
49 |
+
// .then(data => {
|
50 |
+
// console.log(data);
|
51 |
+
// popup_url = "http://"+data.database_host+":"+data.app_in_browser_port+"/";
|
52 |
+
// console.log(popup_url);
|
53 |
+
// })
|
54 |
+
// .catch(error => console.error('Error:', error));
|
55 |
+
})
|
56 |
+
|
57 |
+
document.getElementById('set_addr').addEventListener('click', function() {
|
58 |
+
var addr = document.getElementById('addr').value;
|
59 |
+
// save config
|
60 |
+
chrome.storage.local.set({database_host: addr}, function() {
|
61 |
+
console.log('database_host is set to ' + addr);
|
62 |
+
// chrome.runtime.sendMessage({ data: addr , close: true , flag: 'set_addr'});
|
63 |
+
document.getElementById('addr').value = '';
|
64 |
+
});
|
65 |
+
})
|
qwen_server/server_config_副本.json
ADDED
@@ -0,0 +1 @@
|
|
|
|
|
1 |
+
{"path": {"work_space_root": "workspace/", "cache_root": "workspace/browser_cache/", "download_root": "workspace/download/", "code_interpreter_ws": "workspace/ci_workspace/"}, "server": {"server_host": "127.0.0.1", "fast_api_port": 7866, "app_in_browser_port": 7863, "workstation_port": 7864, "model_server": "dashscope", "api_key": "", "llm": "qwen-plus", "max_ref_token": 4000, "max_days": 7}}
|