SimpleChatTC: Clarify some type definitions to avoid warnings
ie in vs code with ts-check
This commit is contained in:
parent
a408e5e017
commit
ef85ed41d4
|
|
@ -18,6 +18,7 @@ class ApiEP {
|
||||||
Chat: "chat",
|
Chat: "chat",
|
||||||
Completion: "completion",
|
Completion: "completion",
|
||||||
}
|
}
|
||||||
|
/** @type {Object<string, string>} */
|
||||||
static UrlSuffix = {
|
static UrlSuffix = {
|
||||||
'chat': `/chat/completions`,
|
'chat': `/chat/completions`,
|
||||||
'completion': `/completions`,
|
'completion': `/completions`,
|
||||||
|
|
@ -40,6 +41,7 @@ class ApiEP {
|
||||||
class AssistantResponse {
|
class AssistantResponse {
|
||||||
|
|
||||||
constructor(content="", toolname="", toolargs="", trimmedContent="") {
|
constructor(content="", toolname="", toolargs="", trimmedContent="") {
|
||||||
|
/** @type {Object<string, string>} */
|
||||||
this.response = { content: content, toolname: toolname, toolargs: toolargs, trimmedContent: trimmedContent };
|
this.response = { content: content, toolname: toolname, toolargs: toolargs, trimmedContent: trimmedContent };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -539,7 +541,7 @@ class SimpleChat {
|
||||||
try {
|
try {
|
||||||
tools.tc_switch[fn]["handler"](JSON.parse(ar.response.toolargs))
|
tools.tc_switch[fn]["handler"](JSON.parse(ar.response.toolargs))
|
||||||
return tools.tc_switch[fn]["result"]
|
return tools.tc_switch[fn]["result"]
|
||||||
} catch (error) {
|
} catch (/** @type {any} */error) {
|
||||||
return `Tool/Function call raised an exception:${error.name}:${error.message}`
|
return `Tool/Function call raised an exception:${error.name}:${error.message}`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -824,11 +826,15 @@ class Me {
|
||||||
"Last4": 5,
|
"Last4": 5,
|
||||||
};
|
};
|
||||||
this.apiEP = ApiEP.Type.Chat;
|
this.apiEP = ApiEP.Type.Chat;
|
||||||
|
/** @type {Object<string, string>} */
|
||||||
this.headers = {
|
this.headers = {
|
||||||
"Content-Type": "application/json",
|
"Content-Type": "application/json",
|
||||||
"Authorization": "", // Authorization: Bearer OPENAI_API_KEY
|
"Authorization": "", // Authorization: Bearer OPENAI_API_KEY
|
||||||
}
|
}
|
||||||
// Add needed fields wrt json object to be sent wrt LLM web services completions endpoint.
|
/**
|
||||||
|
* Add needed fields wrt json object to be sent wrt LLM web services completions endpoint.
|
||||||
|
* @type {Object<string, any>}
|
||||||
|
*/
|
||||||
this.apiRequestOptions = {
|
this.apiRequestOptions = {
|
||||||
"model": "gpt-3.5-turbo",
|
"model": "gpt-3.5-turbo",
|
||||||
"temperature": 0.7,
|
"temperature": 0.7,
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue