Skip to content

Commit

Permalink
by default use open ai message format (#479)
Browse files Browse the repository at this point in the history
* Refactor chat stream function selection logic

* Add placeholder comment for unimplemented summarize mode feature
  • Loading branch information
swuecho authored Jun 28, 2024
1 parent 4600dd4 commit 41cd6c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 4 additions & 4 deletions api/chat_main_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,6 @@ func (h *ChatHandler) chooseChatStreamFn(chat_session sqlc_queries.ChatSession,
isClaude = false
isClaude3 = true
}
isChatGPT := strings.HasPrefix(model, "gpt") || strings.HasPrefix(model, "deepseek") || strings.HasPrefix(model, "yi") || strings.HasPrefix(model, "qwen")
isOllama := strings.HasPrefix(model, "ollama-")
isGemini := strings.HasPrefix(model, "gemini")

Expand All @@ -283,22 +282,23 @@ func (h *ChatHandler) chooseChatStreamFn(chat_session sqlc_queries.ChatSession,
completionModel.Add(openai.GPT3TextDavinci003)
completionModel.Add(openai.GPT3TextDavinci002)
isCompletion := completionModel.Contains(model)
isCustom := strings.HasPrefix(model, "custom-")

chatStreamFn := h.customChatStream
chatStreamFn := h.chatStream
if isClaude {
chatStreamFn = h.chatStreamClaude
} else if isClaude3 {
chatStreamFn = h.chatStreamClaude3
} else if isTestChat {
chatStreamFn = h.chatStreamTest
} else if isChatGPT {
chatStreamFn = h.chatStream
} else if isOllama {
chatStreamFn = h.chatOllamStram
} else if isCompletion {
chatStreamFn = h.CompletionStream
} else if isGemini {
chatStreamFn = h.chatStreamGemini
} else if isCustom {
chatStreamFn = h.customChatStream
}
return chatStreamFn
}
Expand Down
2 changes: 2 additions & 0 deletions web/src/views/chat/components/Session/SessionConfig.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ const defaultToken = computed(() => {
</NSpace>
</NRadioGroup>
</NFormItem>
<!-- not implemented
<NFormItem :label="$t('chat.summarize_mode')" path="summarize_mode">
<NSwitch v-model:value="modelRef.summarizeMode" data-testid="summarize_mode">
<template #checked>
Expand All @@ -130,6 +131,7 @@ const defaultToken = computed(() => {
</template>
</NSwitch>
</NFormItem>
-->
<NFormItem :label="$t('chat.contextCount', { contextCount: modelRef.contextCount })" path="contextCount">
<NSlider v-model:value="modelRef.contextCount" :min="1" :max="40" :tooltip="false" show-tooltip />
</NFormItem>
Expand Down

0 comments on commit 41cd6c5

Please sign in to comment.