SimpleChatTC:Tools: Show available tool names
Dont allow tool names to be changed in settings page
This commit is contained in:
parent
aa8c8040cf
commit
aac5213104
|
|
@ -1017,7 +1017,8 @@ class Me {
|
||||||
this.multiChat = new MultiChatUI();
|
this.multiChat = new MultiChatUI();
|
||||||
this.tools = {
|
this.tools = {
|
||||||
enabled: false,
|
enabled: false,
|
||||||
fetchProxyUrl: "http://127.0.0.1:3128"
|
fetchProxyUrl: "http://127.0.0.1:3128",
|
||||||
|
toolNames: /** @type {Array<string>} */([])
|
||||||
};
|
};
|
||||||
this.chatProps = {
|
this.chatProps = {
|
||||||
apiEP: ApiEP.Type.Chat,
|
apiEP: ApiEP.Type.Chat,
|
||||||
|
|
@ -1117,6 +1118,9 @@ class Me {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
elProp.placeholder = "Bearer OPENAI_API_KEY";
|
elProp.placeholder = "Bearer OPENAI_API_KEY";
|
||||||
}
|
}
|
||||||
|
if (prop.startsWith("tools:toolName")) {
|
||||||
|
/** @type {HTMLInputElement} */(elProp).disabled = true
|
||||||
|
}
|
||||||
}, [":chatProps:apiEP", ":chatProps:iRecentUserMsgCnt"], (propWithPath, prop, elParent)=>{
|
}, [":chatProps:apiEP", ":chatProps:iRecentUserMsgCnt"], (propWithPath, prop, elParent)=>{
|
||||||
if (propWithPath == ":chatProps:apiEP") {
|
if (propWithPath == ":chatProps:apiEP") {
|
||||||
let sel = ui.el_creatediv_select("SetApiEP", "ApiEndPoint", ApiEP.Type, this.chatProps.apiEP, (val)=>{
|
let sel = ui.el_creatediv_select("SetApiEP", "ApiEndPoint", ApiEP.Type, this.chatProps.apiEP, (val)=>{
|
||||||
|
|
@ -1150,7 +1154,7 @@ function startme() {
|
||||||
document["du"] = du;
|
document["du"] = du;
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
document["tools"] = tools;
|
document["tools"] = tools;
|
||||||
tools.init()
|
tools.init().then((toolNames)=>gMe.tools.toolNames=toolNames)
|
||||||
for (let cid of gMe.defaultChatIds) {
|
for (let cid of gMe.defaultChatIds) {
|
||||||
gMe.multiChat.new_chat_session(cid);
|
gMe.multiChat.new_chat_session(cid);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,11 +14,14 @@ let gToolsWorker = new Worker('./toolsworker.mjs', { type: 'module' });
|
||||||
*/
|
*/
|
||||||
export let tc_switch = {}
|
export let tc_switch = {}
|
||||||
|
|
||||||
export function init() {
|
export async function init() {
|
||||||
tjs.init(gToolsWorker).then(()=>{
|
return tjs.init(gToolsWorker).then(()=>{
|
||||||
|
let toolNames = []
|
||||||
for (const key in tjs.tc_switch) {
|
for (const key in tjs.tc_switch) {
|
||||||
tc_switch[key] = tjs.tc_switch[key]
|
tc_switch[key] = tjs.tc_switch[key]
|
||||||
|
toolNames.push(key)
|
||||||
}
|
}
|
||||||
|
return toolNames
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue