Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixture/add-client-side-http-connectors-to-other-llms #8

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions src/components/chat-window.vue
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ export default {
if (this.isActive) return;
const msg = this.userMessage;
console.log('submit: ', msg);

this.isLoading = true; this.$forceUpdate();

// if (this.selectedPlugins?.length > 0) {
// try{
// console.log('chat:submit: Selected plugins: ', this.selectedPlugins);
Expand All @@ -191,7 +191,7 @@ export default {
// }

try{
const config = {
const config = {
frequency_penalty: this.bot?.frequency_penalty,
presence_penalty: this.bot?.presence_penalty,
temperature: this.bot?.temperature,
Expand All @@ -214,7 +214,7 @@ export default {
this.userMessage = '';
this.messages.push(newUserMsg)
}

const newMsg = {role:'assistant', content: ''};
this.messages.push(newMsg);
this.scrollChatToBottom();
Expand All @@ -230,15 +230,21 @@ export default {
if (this.selectedPlugins?.length > 0) {
await this.altGpt.performSmartCompletion(messages, this.selectedPlugins, config, onDelta, priming, this.pluginsSettings);
} else {
await this.openAI.createChatCompletionStream(messages, config, priming, onDelta);
// await this.openAI.createChatCompletionStream(messages, config, priming, onDelta);
await this.openAI.createChatCompletionRes(
messages,
config,
priming,
onDelta
);
}

this.$forceUpdate();

this.messages.push(this.messages.pop()); // so it'll be stored properly in cache
// newText = newMsg.content;
} catch(err) {
let msg = err?.error?.message || err?.message;
let msg = err?.error?.message || err?.message || err;
if (err.statusText) msg = `${err?.statusText} (${err?.statusCode})`;

helpers.toast(`Failed to process request: ${msg || ''}`, 'is-danger', 'is-top');
Expand Down Expand Up @@ -334,5 +340,4 @@ export default {
p { margin-top:0; margin-bottom:0; }
img { min-width:40px; min-height:40px; border: 1px solid #999; background-color:#555 ; }
}

</style>
3 changes: 1 addition & 2 deletions src/scripts/ts/modules/altGPT.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,7 @@ export class AltGPT {
});
const _priming = `You are a bot designed to assist machines in answering user inquiries based solely on the given context. If relevant to user's inquiry, extract full links from the context and maintain them unchanged. If there are multiple outcomes, present them as bullet points, each accompanied by the pertinent link. If the supplied context is empty or yields no results, state that the search produced no findings and recommend refining the query. If the answer is not included, respond with 'Hmm, I'm not sure...'. ${priming}`;
const _config = { ...this.basicConfig, ...config };
const res = await this.openAI.createChatCompletionStream(_messages, _config, _priming, onDelta);

const res = await this.openAI.createChatCompletionRes(_messages, _config, _priming, onDelta);
return res;
}

Expand Down
Loading