Skip to content

Commit

Permalink
feat(config): rename [chatglm] to [siliconflow] and update model name
Browse files Browse the repository at this point in the history
  • Loading branch information
crazygo committed Nov 10, 2024
1 parent 5061d74 commit 367c4d0
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/assets/conf/models.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# The name here can be customized without affecting the actual API request
# For example, [chatglm] can be renamed to [gem] or [paid-openai]
# Just ensure it's unique within this config file
[chatglm]
[siliconflow]
# The protocol used to send requests, currently only supporting openai, is HTTPS
sdk = "openai"
# API key, left empty here
Expand All @@ -12,7 +12,7 @@ base_url = "https://extapi.askman.dev/v1/"
send_api_key = false
cloudflare_gateway_url = ""
models = [
{ name = "free", max_tokens = 32768 } # THUDM/glm-4-9b-chat via siliconflow
{ name = "THUDM/glm-4-9b-chat", max_tokens = 32768 } # THUDM/glm-4-9b-chat via siliconflow
]
[openrouter]
api_key = "sk-xxx"
Expand Down
7 changes: 4 additions & 3 deletions src/components/ask-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,7 @@ function AskPanel(props: AskPanelProps) {

// 检测左右方向键
if (e.key === 'ArrowLeft' || e.key === 'ArrowRight') {
console.log('[ask-panel] listened key press, arrow left or right', e.target, e.currentTarget);
// console.log('[ask-panel] listened key press, arrow left or right', e.target, e.currentTarget);
if (isToolDropdownOpen || isModelDropdownOpen) {
e.preventDefault();
e.stopPropagation();
Expand Down Expand Up @@ -247,7 +247,7 @@ function AskPanel(props: AskPanelProps) {
useEffect(() => {
if (!isToolDropdownOpen && !isQuoteDropdownOpen && !isModelDropdownOpen && inputRef.current) {
setTimeout(() => {
console.log('focus on input because menus are closed');
// console.log('focus on input because menus are closed');
inputRef.current.focus();
}, 33);
}
Expand Down Expand Up @@ -473,7 +473,8 @@ function AskPanel(props: AskPanelProps) {
}
}
// github 上面按 s 会触发页面搜索
if (e.key.match(/^[a-z/\\]$/) && !e.shiftKey && !e.ctrlKey && !e.altKey) e.stopPropagation();
// if (e.key.match(/^[a-z/\\]$/) && !e.shiftKey && !e.ctrlKey && !e.altKey) e.stopPropagation();
e.stopPropagation();
}}
onChange={e => {
setUserInput(e.currentTarget.value);
Expand Down
10 changes: 5 additions & 5 deletions src/components/ask-tooldropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export default function ToolDropdown({
const [isOpened, setIsOpen] = useState(initOpen);
const { showPreview, previewPos, previewContent, showToolPreview, hideToolPreview } = useToolPreview();
const buttonRef = useRef<HTMLButtonElement>(null);
console.log('create ToolDropdown, initOpen = ' + initOpen);
// console.log('create ToolDropdown, initOpen = ' + initOpen);

useEffect(() => {
const fetchUserTools = async () => {
Expand All @@ -91,18 +91,18 @@ export default function ToolDropdown({
const menuItemsRef = useRef<(HTMLButtonElement | null)[]>([]);

useEffect(() => {
console.log('[ToolDropdown] initOpen = ' + initOpen, 'isOpened = ' + isOpened);
// console.log('[ToolDropdown] initOpen = ' + initOpen, 'isOpened = ' + isOpened);
if (initOpen && !isOpened) {
console.log('[ToolDropdown] click menu button to open');
// console.log('[ToolDropdown] click menu button to open');
buttonRef.current?.click();
} else if (!initOpen && isOpened) {
console.log('[ToolDropdown] click menu button to close');
// console.log('[ToolDropdown] click menu button to close');
buttonRef.current?.click();
}
}, [initOpen]);

useEffect(() => {
console.log('[ToolDropdown] isOpened = ' + isOpened);
// console.log('[ToolDropdown] isOpened = ' + isOpened);
statusListener(isOpened);
if (isOpened) {
setTimeout(() => menuItemsRef.current[0]?.focus(), 0);
Expand Down
8 changes: 4 additions & 4 deletions src/components/ask/ModelDropDown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,18 @@ export default function ModelDropdown({
let isCommandPressed = false;

useEffect(() => {
console.log('[ModelDropdown] initOpen = ' + initOpen, 'isOpened = ' + isOpened);
// console.log('[ModelDropdown] initOpen = ' + initOpen, 'isOpened = ' + isOpened);
if (initOpen && !isOpened) {
console.log('[ModelDropdown] click menu button to open');
// console.log('[ModelDropdown] click menu button to open');
buttonRef.current?.click();
} else if (!initOpen && isOpened) {
console.log('[ModelDropdown] click menu button to close');
// console.log('[ModelDropdown] click menu button to close');
buttonRef.current?.click();
}
}, [initOpen]);

useEffect(() => {
console.log('[ModelDropdown] isOpened = ' + isOpened);
// console.log('[ModelDropdown] isOpened = ' + isOpened);
statusListener(isOpened);
if (isOpened) {
setTimeout(() => menuItemsRef.current[0]?.focus(), 0);
Expand Down

0 comments on commit 367c4d0

Please sign in to comment.