Skip to content

Commit

Permalink
fix: random text loss
Browse files Browse the repository at this point in the history
  • Loading branch information
chouch0u committed Feb 4, 2024
1 parent 64bc001 commit c0bc667
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webpilot",
"version": "0.9.1102",
"version": "0.10.0204",
"author": "webpilot.ai",
"displayName": "Webpilot - Copilot for All, Free & Open",
"description": "__MSG_extensionDescription__",
Expand Down
2 changes: 1 addition & 1 deletion src/components/PromptEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ref="textareaRef"
v-model="command"
:class="$style.content__textarea"
maxlength="2048"
maxlength="8192"
:placeholder="prompt.command || $gettext('Set a prompt here')"
/>
<article :class="$style.content__back">
Expand Down
4 changes: 2 additions & 2 deletions src/hooks/useAskAi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,8 @@ export default function useAskAi() {
...toRaw(currentConfig.model),
}
if (isAskPage) {
// 全局 popup,默认使用 16k 接口`
model.model = 'gpt-3.5-turbo-16k'
// Global popup,use 0125 as default`
model.model = 'gpt-3.5-turbo-0125'
}

let storeAuthKey = currentConfig.authKey
Expand Down
4 changes: 2 additions & 2 deletions src/io.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export async function askOpenAI({authKey, model, message, baseURL = null, apiOri
// Reassemble model and process long content request
const requestModel = {...model}
requestModel.messages =
requestModel.model === 'gpt-3.5-turbo-16k' ? getNewCutMessages(message) : message
requestModel.model === 'gpt-3.5-turbo-0125' ? getNewCutMessages(message) : message
requestModel.stream = true

// Assemble url
Expand Down Expand Up @@ -144,7 +144,7 @@ export async function parseStream(streamReader, onUpdate) {
if (done) return onUpdate({done, text})

const chunk = decoder.decode(value, {stream: true})
const dataStrList = chunk.split('\n\n')
const dataStrList = chunk.split('\n').filter(line => line !== '' && line !== '[DONE]')

// eslint-disable-next-line
dataStrList.forEach(dataStr => {
Expand Down

0 comments on commit c0bc667

Please sign in to comment.